@@ -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;