diff options
author | Nathan Vegdahl | 2021-07-20 17:26:00 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-20 17:26:00 +0000 |
commit | 1910fa77235de8e85c39ea2f390af243f18dfc81 (patch) | |
tree | 798448d6184eddf5f8eec4dc09fdfde8ecf56f59 /helix-term | |
parent | 1792dc6f935f581e7fed3842b1f01e2d5d3d7e05 (diff) |
Fix incorrect line hihglight when a selection is at the end of a line.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/ui/editor.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index acf60905..8e29be6c 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -378,7 +378,15 @@ impl EditorView { let selection = doc.selection(view.id); for selection in selection.iter().filter(|range| range.overlaps(&screen)) { - let head = view.screen_coords_at_pos(doc, text, selection.head); + let head = view.screen_coords_at_pos( + doc, + text, + if selection.head > selection.anchor { + selection.head - 1 + } else { + selection.head + }, + ); if let Some(head) = head { // Draw line number for selected lines. let line_number = view.first_line + head.row; |