@@ -240,7 +240,7 @@ impl EditorView {
240 for selection in doc
240 for selection in doc
241 .selection(view.id)
241 .selection(view.id)
243− .filter(|range| range.overlaps(&screen))
243+ .filter(|range| screen.overlaps(&range))
245 // TODO: render also if only one of the ranges is in viewport
245 // TODO: render also if only one of the ranges is in viewport
246 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
246 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
@@ -261,7 +261,7 @@ impl EditorView {
261 Rect::new(
261 Rect::new(
262 viewport.x + start.col as u16,
262 viewport.x + start.col as u16,
263 viewport.y + start.row as u16,
263 viewport.y + start.row as u16,
264− (end.col - start.col) as u16 + 1,
264+ ((end.col - start.col) as u16 + 1).min(viewport.width),
267 selection_style,
267 selection_style,
@@ -633,6 +633,10 @@ impl Component for EditorView {
633 // clear with background color
633 // clear with background color
634 surface.set_style(area, cx.editor.theme.get("ui.background"));
634 surface.set_style(area, cx.editor.theme.get("ui.background"));
636+ // if the terminal size suddenly changed, we need to trigger a resize
638+ .resize(Rect::new(area.x, area.y, area.width, area.height - 1)); // - 1 to account for commandline
636 for (view, is_focused) in cx.editor.tree.views() {
640 for (view, is_focused) in cx.editor.tree.views() {
637 let doc = cx.editor.document(view.doc).unwrap();
641 let doc = cx.editor.document(view.doc).unwrap();
638 self.render_view(doc, view, area, surface, &cx.editor.theme, is_focused);
642 self.render_view(doc, view, area, surface, &cx.editor.theme, is_focused);