aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs30
1 files changed, 12 insertions, 18 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 272c8ac1..92a631ed 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -112,13 +112,11 @@ impl EditorView {
self.render_diagnostics(doc, view, inner, surface, theme, debugger);
- let area = Rect::new(
- view.area.x,
- view.area.y + view.area.height.saturating_sub(1),
- view.area.width,
- 1,
- );
- self.render_statusline(doc, view, area, surface, theme, is_focused);
+ let statusline_area = view
+ .area
+ .clip_top(view.area.height.saturating_sub(1))
+ .clip_bottom(1); // -1 from bottom to remove commandline
+ self.render_statusline(doc, view, statusline_area, surface, theme, is_focused);
}
/// Get syntax highlights for a document in a view represented by the first line
@@ -201,7 +199,9 @@ impl EditorView {
.find_scope_index("diagnostic")
.or_else(|| theme.find_scope_index("ui.cursor"))
.or_else(|| theme.find_scope_index("ui.selection"))
- .expect("no selection scope found!");
+ .expect(
+ "at least one of the following scopes must be defined in the theme: `diagnostic`, `ui.cursor`, or `ui.selection`",
+ );
doc.diagnostics()
.iter()
@@ -226,7 +226,7 @@ impl EditorView {
let selection_scope = theme
.find_scope_index("ui.selection")
- .expect("no selection scope found!");
+ .expect("could not find `ui.selection` scope in the theme!");
let base_cursor_scope = theme
.find_scope_index("ui.cursor")
.unwrap_or(selection_scope);
@@ -598,12 +598,7 @@ impl EditorView {
let width = 80.min(viewport.width);
let height = 15.min(viewport.height);
paragraph.render(
- Rect::new(
- viewport.right() - width,
- viewport.y as u16 + 1,
- width,
- height,
- ),
+ Rect::new(viewport.right() - width, viewport.y + 1, width, height),
surface,
);
}
@@ -642,7 +637,7 @@ impl EditorView {
theme.get("ui.statusline.inactive")
};
// statusline
- surface.set_style(Rect::new(viewport.x, viewport.y, viewport.width, 1), style);
+ surface.set_style(viewport.with_height(1), style);
if is_focused {
surface.set_string(viewport.x + 1, viewport.y, mode, style);
}
@@ -1071,8 +1066,7 @@ impl Component for EditorView {
surface.set_style(area, cx.editor.theme.get("ui.background"));
// if the terminal size suddenly changed, we need to trigger a resize
- cx.editor
- .resize(Rect::new(area.x, area.y, area.width, area.height - 1)); // - 1 to account for commandline
+ cx.editor.resize(area.clip_bottom(1)); // -1 from bottom for commandline
for (view, is_focused) in cx.editor.tree.views() {
let doc = cx.editor.document(view.doc).unwrap();