Skip to content

feat: show absolute line number on the cursor line - #27

Merged
vasiltop merged 2 commits into
mainfrom
feat/hybrid-line-numbers
Jul 23, 2026
Merged

feat: show absolute line number on the cursor line#27
vasiltop merged 2 commits into
mainfrom
feat/hybrid-line-numbers

Conversation

@vasiltop

Copy link
Copy Markdown
Owner

In relative line-number mode the gutter showed 0 on the cursor's own line, since its distance from itself is zero. This shows its absolute line number there instead — vim's hybrid number + relativenumber: relative distances above and below for motions, plus the real line you're on.

The change is a single special case in EditorLineNumberLabel (core/editor/editor.cpp). The gutter already sizes on the buffer's line count, so the wider cursor-line number fits without reflowing the text, and the cursor line keeps its distinct line_number_current color.

vasiltop added 2 commits July 23, 2026 19:23
In relative mode the gutter showed 0 on the cursor's own line, since its
distance from itself is zero. Show its absolute line number there instead,
matching vim's hybrid number + relativenumber: relative distances for
motions, plus the real line you're on. The gutter already sizes on the
buffer's line count, so the wider number fits without reflowing.
The relative-label test still asserted 0 on the cursor's own line, which
this branch's change replaced with the line's absolute number. Update the
two cursor-line expectations to match the hybrid behavior.
@vasiltop
vasiltop merged commit ee1ee1a into main Jul 23, 2026
3 checks passed
@vasiltop
vasiltop deleted the feat/hybrid-line-numbers branch July 23, 2026 23:52
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