Skip to content

[Fix] [Code] align mouse cursor mapping with tab width#2901

Draft
RDeckard wants to merge 1 commit intonesbox:mainfrom
RDeckard:fix/2330-code-mouse-tab-alignment
Draft

[Fix] [Code] align mouse cursor mapping with tab width#2901
RDeckard wants to merge 1 commit intonesbox:mainfrom
RDeckard:fix/2330-code-mouse-tab-alignment

Conversation

@RDeckard
Copy link
Contributor

@RDeckard RDeckard commented Mar 3, 2026

Why

Original issue: #2330

Mouse cursor placement in the code editor is misaligned when tabSize > 1 because tab expansion was not considered.

What

  • Add tab-aware visual column mapping in src/studio/editors/code.c.
  • Add a mouse-specific cursor placement path (setCursorPositionVisual(...)).
  • Use this mapping for mouse click/drag handling.
  • Keep keyboard cursor logic unchanged.

Impact

  • Mouse placement and selection now align with rendered tab width when tabSize > 1.
  • Keyboard behavior remains unchanged.

Reviewer question: when clicking inside a tab visual span, should the tie-breaking stay biased to the right boundary (current behavior) or switch to the left?

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.

1 participant