|
|
@ -234,18 +234,7 @@ impl EditorView {
|
|
|
|
let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
|
|
|
|
let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
|
|
|
|
let mut end = view.screen_coords_at_pos(doc, text, selection.head);
|
|
|
|
let mut end = view.screen_coords_at_pos(doc, text, selection.head);
|
|
|
|
|
|
|
|
|
|
|
|
// cursor
|
|
|
|
let head = end;
|
|
|
|
if let Some(end) = end {
|
|
|
|
|
|
|
|
surface.set_style(
|
|
|
|
|
|
|
|
Rect::new(
|
|
|
|
|
|
|
|
viewport.x + end.col as u16,
|
|
|
|
|
|
|
|
viewport.y + end.row as u16,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
cursor_style,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if selection.head < selection.anchor {
|
|
|
|
if selection.head < selection.anchor {
|
|
|
|
std::mem::swap(&mut start, &mut end);
|
|
|
|
std::mem::swap(&mut start, &mut end);
|
|
|
@ -260,7 +249,7 @@ impl EditorView {
|
|
|
|
Rect::new(
|
|
|
|
Rect::new(
|
|
|
|
viewport.x + start.col as u16,
|
|
|
|
viewport.x + start.col as u16,
|
|
|
|
viewport.y + start.row as u16,
|
|
|
|
viewport.y + start.row as u16,
|
|
|
|
(end.col - start.col) as u16,
|
|
|
|
(end.col - start.col) as u16 + 1,
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
selection_style,
|
|
|
|
selection_style,
|
|
|
@ -293,6 +282,19 @@ impl EditorView {
|
|
|
|
selection_style,
|
|
|
|
selection_style,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cursor
|
|
|
|
|
|
|
|
if let Some(head) = head {
|
|
|
|
|
|
|
|
surface.set_style(
|
|
|
|
|
|
|
|
Rect::new(
|
|
|
|
|
|
|
|
viewport.x + head.col as u16,
|
|
|
|
|
|
|
|
viewport.y + head.row as u16,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
1,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
cursor_style,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|