Skip to content

Comments

Fix expression cursor on popup#974

Merged
kanushka merged 2 commits intowso2:bi-1.5.xfrom
senithkay:fix-expression-cursor-on-popup
Nov 20, 2025
Merged

Fix expression cursor on popup#974
kanushka merged 2 commits intowso2:bi-1.5.xfrom
senithkay:fix-expression-cursor-on-popup

Conversation

@senithkay
Copy link
Contributor

Purpose

The expression editor had an issue where newly created variables were always inserted at the start of the editor instead of the current cursor position.
This happened because the editor was explicitly resetting the cursor position when the user clicked outside the editor.
This PR fixes the behavior so new variables insert at the correct cursor location.

Resolves: wso2/product-ballerina-integrator#1968

Goals

  • Prevent the unintended cursor reset when the user interacts outside the editor.
  • Ensure newly created variables are inserted at the correct cursor position maintained internally by CodeMirror.
  • Remove unnecessary logic that interferes with CodeMirror’s own cursor state handling.

Approach

  • Removed the explicit cursor reset that manually set the cursor to position 0 on blur/outside clicks.
  • Since we already call viewRef.current?.dom.blur();, the cursor visually disappears for the user, but CodeMirror internally maintains the correct cursor position.
  • With the explicit reset removed, variable insertion now respects the last valid cursor position managed by CodeMirror.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@senithkay senithkay changed the base branch from main to bi-1.5.x November 20, 2025 07:56
@kanushka kanushka merged commit 73c0bee into wso2:bi-1.5.x Nov 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In expression editor newly created variables are added to the start of the expression

2 participants