Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.

Conversation

@xanderlmk
Copy link
Owner

No description provided.

@xanderlmk xanderlmk merged commit aac32a8 into main Jun 10, 2025
2 checks passed
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 11, 2025

Reviewer's Guide

This PR overhauls the KaTeX menu UI to support an expandable header with drag gestures and new inline, newline, and delete actions; extends cursor and notation update logic (with nested-notation protection); refactors norm-selection mapping; ensures composition state is preserved in text updates; and applies minor configuration adjustments and cleanup.

File-Level Changes

Change Details Files
Revamped KaTeX menu UI
  • Introduce expanded state with rememberSaveable and toggle text
  • Render conditional detail panel using Column, IconButtons, Texts, and dividers
  • Implement pointerInput drag gesture on header and responsive orientation-based layout
  • Apply RoundedCornerShape, background, border, and dynamic width/offset
KaTeXMenu.kt
Introduced new cursor actions & protections
  • Add Inline, NewLine, and Delete to SelectedAnnotation.CursorChange
  • Throw IsInsideException when attempting inline/newline inside existing notation
  • Implement Inline, NewLine, and Delete branches in updateCursor with insertion/deletion logic
KaTeXMenu.kt
KatexSA.kt
Exception handling & user feedback
  • Wrap updateCursor calls in try-catch for IsInsideException in LatexKeyboard
  • Log error and display a toast when nested notation is detected
  • Invoke onIdle after exception handling to reset state
KeyboardInputs.kt
Refactored norm selection mapping
  • Replace inline replace chain with convertNormSel() call
  • Extract latexNormMap for mapping selection keys to LaTeX sequences
BuildKatexMenuWebView.kt
Preserve composition in text updates
  • Set composition = TextRange(insertionPoint) alongside selection in katexMapper returns
KatexMapping.kt
Minor configuration tweaks & cleanup
  • Adjust default KaTeX menu width from 400.dp to 375.dp
  • Add "\{\}" entry to NORMAL_OPS_NUMS list
  • Remove unused imports and fix formatting in NavViewModel.toggleKeyboard
  • Clean up whitespace in BuildKatexMenuWebView replacements
ScreenConfig.kt
BuildKeyboardHtml.kt
NavViewModel.kt
BuildKatexMenuWebView.kt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @xanderlmk - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • convertNormSel() is not defined in scope (link)
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 1 other issue
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

.replace("sqrt", "\\\\sqrt").replace("pi", "\\\\pi")
.replace("ti", "\\\\ti").replace("div", "\\\\div").replace("a", "")
.replace("{x}", "{}").replace("b", "")
val replaced = sel.convertNormSel()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): convertNormSel() is not defined in scope

Please implement String.convertNormSel() (using latexNormMap), or revert to the previous replace chain to prevent compilation errors.

if (kt.sa is SelectedAnnotation.CursorChange) {
try {
textFieldValue = updateCursor(kt.sa, textFieldValue, text) { onValueChanged(it) }
} catch (e : IsInsideException) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Missing onIdle() call after catching exception

onIdle() should be called in the catch block to ensure the selection state is reset after an exception.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants