on master help sign in
Fix incorrect line hihglight when a selection is at the end of a line.
commit1910fa77235de8e85c39ea2f390af243f18dfc81 authorNathan Vegdahl <cessen@cessen.com> dateTue 20 Jul 2021, 10:26 (5 years ago) parent1792dc6
1 file changed+9−1
helix-term/src/ui/editor.rs+9−1
helix-term/src/ui/editor.rs+9−1
@@ -378,7 +378,15 @@ impl EditorView {
378378 let selection = doc.selection(view.id);
379379
380380 for selection in selection.iter().filter(|range| range.overlaps(&screen)) {
381− let head = view.screen_coords_at_pos(doc, text, selection.head);
381+ let head = view.screen_coords_at_pos(
382+ doc,
383+ text,
384+ if selection.head > selection.anchor {
385+ selection.head - 1
386+ } else {
387+ selection.head
388+ },
389+ );
382390 if let Some(head) = head {
383391 // Draw line number for selected lines.
384392 let line_number = view.first_line + head.row;