Skip to content

feat: add line range comment support with visual selection mode#115

Merged
agavra merged 3 commits intoagavra:mainfrom
dmvk:multiline
Jan 18, 2026
Merged

feat: add line range comment support with visual selection mode#115
agavra merged 3 commits intoagavra:mainfrom
dmvk:multiline

Conversation

@dmvk
Copy link
Copy Markdown
Contributor

@dmvk dmvk commented Jan 18, 2026

Add support for comments that span multiple lines (e.g., L10-L15):

  • Add LineRange struct with start/end bounds and helper methods
  • Add line_range field to Comment with serde(default) for backward compat
  • Add VisualSelect input mode with V keybinding to enter visual mode
  • Use j/k to extend selection, c/Enter to create range comment
  • Display ranges as "L10-L15" in comment panel and status bar
  • Export ranges as file:10-15 or file:~10-~25 for old side
  • Add visual selection highlighting in unified diff view
  • Add 23 new tests covering LineRange, Comment, and export functionality

Copy link
Copy Markdown
Owner

@agavra agavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, I've been wanting to add this feature. I'll be curious to see if the agent does any better with mutliline ranges than with leaving a comment somewhere within the range. I'll definitely use it!

Comment on lines +521 to +522
// Apply visual selection highlighting if applicable
let style = if is_in_visual_selection {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that highlighting doesn't seem to work in split mode

Copy link
Copy Markdown
Contributor Author

@dmvk dmvk Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some options Claude offers:

❯ Multiline selection doesn't really work in split mode, since it would select both old and new side at the same time. Is there a way
  to fix it without harming UX or should we just disable multiline support for split mode altogether?
  
⏺ Good catch. Let me think through the options for handling visual selection in side-by-side mode.

  Option 1: Disable visual mode in split view
  - Simplest implementation
  - User can switch to unified view (v) to use visual selection
  - Minor UX friction but keeps behavior predictable

  Option 2: Use h/l to select which side in visual mode
  - In side-by-side + visual mode, h/l could switch between selecting old vs new side
  - j/k still extends the selection vertically
  - Status bar shows which side is active: "VISUAL L10-L15 (new)" or "VISUAL L10-L15 (old)"
  - More complex but preserves full functionality
  
  --

I'd be slightly in favor of 2, since this also seems weird for single line comments (should the comment apply to old or new side)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like favor 2 as well, though instead of h/l let's use ;h and ;l (nerdtree bindings, the way you can navigate between file browser/diff browser) and add it to the cycle with tab. since that gets chunky let's just ignore this bug and file a ticket we can follow up with that change in a future PR. (h/l is for horizontal scrolling, which is useless in split mode because it ...s but nice to have consistency)

dmvk and others added 3 commits January 18, 2026 15:43
Add support for comments that span multiple lines (e.g., L10-L15):

- Add LineRange struct with start/end bounds and helper methods
- Add line_range field to Comment with serde(default) for backward compat
- Add VisualSelect input mode with V keybinding to enter visual mode
- Use j/k to extend selection, c/Enter to create range comment
- Display ranges as "L10-L15" in comment panel and status bar
- Export ranges as `file:10-15` or `file:~10-~25` for old side
- Add visual selection highlighting in unified diff view
- Add 23 new tests covering LineRange, Comment, and export functionality

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add visual mode to Features list
- Add V keybinding to Review Actions table
- Add new Visual Mode keybindings section
- Update Review Output example to show line range format

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Map both `v` and `V` to visual mode for entering/exiting line range
selection. The diff view toggle is now accessible via the `:diff`
command instead of the `v` key.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@agavra agavra merged commit 74d6319 into agavra:main Jan 18, 2026
4 checks passed
@agavra
Copy link
Copy Markdown
Owner

agavra commented Jan 18, 2026

Thanks for the contribution @dmvk! 🔥

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.

2 participants