Skip to content

feat: unify note display using virtual lines - #10

Merged
ushmz merged 2 commits into
mainfrom
feat/unify-note-display-with-virtual-lines
Nov 18, 2025
Merged

feat: unify note display using virtual lines#10
ushmz merged 2 commits into
mainfrom
feat/unify-note-display-with-virtual-lines

Conversation

@ushmz

@ushmz ushmz commented Nov 18, 2025

Copy link
Copy Markdown
Owner

Summary

This PR unifies the note display behavior between unnamed sessions and retrace mode by using virtual lines above the target line for both modes.

Previously, unnamed sessions displayed notes at the end of line (eol), while retrace mode displayed them above the target line using virtual lines. This inconsistency has been resolved by standardizing on the virtual lines approach.

Changes

Removed display_note function

  • lua/tabi/ui/display.lua:
    • Removed M.display_note function that displayed notes as end-of-line virtual text
    • Removed unused note_module dependency
    • Modified M.refresh_buffer to use M.display_note_as_virtual_line for all displays

Updated tests

  • test/tabi/integration/note_lifecycle_spec.lua: Updated assertions to verify virt_lines instead of virt_text
  • test/tabi/ui/display_spec.lua:
    • Removed tests for deprecated display_note function
    • Updated clear_buffer tests to use display_note_as_virtual_line

Benefits

  • Consistent UX: Notes appear in the same position (above the line) in both unnamed sessions and retrace mode
  • Code simplification: Both modes now share the same rendering logic (display_note_as_virtual_line)
  • Better readability: Multi-line notes are displayed more naturally above the target line
  • Reduced code complexity: Removed duplicate display logic

Test Results

All 307 tests pass:

Success: 307
Failure: 0

Checklist

  • Code follows project conventions (luacheck, stylua)
  • All tests pass (vusted)
  • Changes are backward compatible
  • Commits are logically separated
  • Unused code removed

Change M.refresh_buffer to use M.display_note_as_virtual_line instead
of M.display_note, ensuring consistent display behavior between unnamed
sessions and retrace mode. Notes now appear above the target line in
both modes, improving visual consistency.

This change:
- Uses virt_lines_above for all note displays
- Removes the eol (end-of-line) display mode
- Shares the same rendering logic between sessions and retrace mode
Update note_lifecycle_spec.lua to verify virt_lines instead of virt_text,
aligning test expectations with the new unified display behavior. Tests
now check for virt_lines_above implementation in both note creation and
update scenarios.

Changes:
- Replace virt_text checks with virt_lines checks
- Update extmark data access pattern (virt_lines[1][1][1])
- Maintain test coverage for display functionality
@ushmz ushmz changed the title Unify note display using virtual lines feat: unify note display using virtual lines Nov 18, 2025
@ushmz
ushmz merged commit 4f26475 into main Nov 18, 2025
4 checks passed
@ushmz
ushmz deleted the feat/unify-note-display-with-virtual-lines branch November 18, 2025 12:37
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