on master help sign in
Fix incorrect line hihglight when a selection is at the end of a line.
1910fa7Nathan Vegdahl
helix-term/src/ui/editor.rs+9−1
@@ -378,7 +378,15 @@ impl EditorView {
378 let selection = doc.selection(view.id);
378 let selection = doc.selection(view.id);
379
379
380 for selection in selection.iter().filter(|range| range.overlaps(&screen)) {
380 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+ );
382 if let Some(head) = head {
390 if let Some(head) = head {
383 // Draw line number for selected lines.
391 // Draw line number for selected lines.
384 let line_number = view.first_line + head.row;
392 let line_number = view.first_line + head.row;