Skip to content

studio: the code editor scrolls by the columns it draws - #3141

Merged
nesbox merged 1 commit into
mainfrom
code-editor-tab-scroll
Oct 26, 2026
Merged

nesbox merged 1 commit into
mainfrom
code-editor-tab-scroll

Conversation

@nesbox

@nesbox nesbox commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Fixes #3138.

The horizontal view has always moved in drawn columns: a tab covers the cells up to its stop in drawCode, and the mouse click and the right-drag already map pixels to columns. updateEditor alone advanced scroll.x by the caret's raw character count, where a tab counts as one, so on a line with tabs at tab size 2 or more the caret ran past the right edge while the view stayed put. Line numbers only narrow the editor by a couple of columns and are not the cause.

  • getVisualCursorColumn counts the caret column the way the text is drawn;
  • updateEditor and recenterScroll use it for scroll.x; the raw column stays for the status line and the vertical moves;
  • getCursorPosition takes NULL out-params, as getWidths does, so the recentre can ask for the line alone.

Checked on the desktop build with tab size 2: the caret runs off the right edge before the change and follows the view after it, and at tab size 1 nothing moves.

πŸ€– Generated with Claude Code

The horizontal view has always moved in drawn columns β€” a tab covers the
cells up to its stop β€” in the drawing, in the mouse click and in the
right-drag. updateEditor alone moved it by raw characters, where a tab
counts as one, so on a line with tabs at tab size 2 or more the caret ran
past the right edge while the view stayed put (#3138).

The caret column is now counted the way the text is drawn, and the
recentre uses the same count; the raw column stays for the status line
and the vertical moves that follow it.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@nesbox nesbox self-assigned this Oct 26, 2026
@nesbox
nesbox merged commit 6d280f9 into main Oct 26, 2026
17 checks passed
@nesbox
nesbox deleted the code-editor-tab-scroll branch October 26, 2026 18:21
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.

Cursor disappears at the right edge of the code editor in version 1.4.0 on Android

1 participant