@@ -233,19 +233,8 @@ impl EditorView {
233 // TODO: render also if only one of the ranges is in viewport
233 // TODO: render also if only one of the ranges is in viewport
234 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
234 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
235 let mut end = view.screen_coords_at_pos(doc, text, selection.head);
235 let mut end = view.screen_coords_at_pos(doc, text, selection.head);
238− if let Some(end) = end {
237+ let head = end;
241− viewport.x + end.col as u16,
242− viewport.y + end.row as u16,
250 if selection.head < selection.anchor {
239 if selection.head < selection.anchor {
251 std::mem::swap(&mut start, &mut end);
240 std::mem::swap(&mut start, &mut end);
@@ -260,7 +249,7 @@ impl EditorView {
260 Rect::new(
249 Rect::new(
261 viewport.x + start.col as u16,
250 viewport.x + start.col as u16,
262 viewport.y + start.row as u16,
251 viewport.y + start.row as u16,
263− (end.col - start.col) as u16,
252+ (end.col - start.col) as u16 + 1,
266 selection_style,
255 selection_style,
@@ -293,6 +282,19 @@ impl EditorView {
293 selection_style,
282 selection_style,
287+ if let Some(head) = head {
290+ viewport.x + head.col as u16,
291+ viewport.y + head.row as u16,