diff options
author | Blaž Hrastnik | 2021-08-08 05:07:14 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-08-08 05:10:01 +0000 |
commit | a2ccfffda1171bde5118c1a1120af49dc87aecca (patch) | |
tree | 54138341e17ebf600c37c9830914a546ce39fb04 /helix-term/src/ui | |
parent | f0eb6ed96a6e61ee6abe3aa14071cfc003d0b37f (diff) |
config: Rename [terminal] to [editor] and pass it into Editor
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/editor.rs | 14 | ||||
-rw-r--r-- | helix-term/src/ui/mod.rs | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index a2b169ed..496edf42 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -36,7 +36,7 @@ pub struct EditorView { pub autoinfo: Option<Info>, } -const OFFSET: u16 = 7; // 1 diagnostic + 5 linenr + 1 gutter +pub const GUTTER_OFFSET: u16 = 7; // 1 diagnostic + 5 linenr + 1 gutter impl Default for EditorView { fn default() -> Self { @@ -72,9 +72,9 @@ impl EditorView { loader: &syntax::Loader, ) { let area = Rect::new( - view.area.x + OFFSET, + view.area.x + GUTTER_OFFSET, view.area.y, - view.area.width - OFFSET, + view.area.width - GUTTER_OFFSET, view.area.height.saturating_sub(1), ); // - 1 for statusline @@ -339,7 +339,7 @@ impl EditorView { use helix_core::diagnostic::Severity; if let Some(diagnostic) = doc.diagnostics().iter().find(|d| d.line == line) { surface.set_stringn( - viewport.x - OFFSET, + viewport.x - GUTTER_OFFSET, viewport.y + i as u16, "●", 1, @@ -360,7 +360,7 @@ impl EditorView { format!("{:>5}", line + 1) }; surface.set_stringn( - viewport.x + 1 - OFFSET, + viewport.x + 1 - GUTTER_OFFSET, viewport.y + i as u16, line_number_text, 5, @@ -401,7 +401,7 @@ impl EditorView { format!("{:>5}", line_number + 1) }; surface.set_stringn( - viewport.x + 1 - OFFSET, + viewport.x + 1 - GUTTER_OFFSET, viewport.y + head.row as u16, line_number_text, 5, @@ -778,7 +778,7 @@ impl Component for EditorView { } let (view, doc) = current!(cx.editor); - view.ensure_cursor_in_view(doc); + view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff); // mode transitions match (mode, doc.mode()) { diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 9e71cfe7..f68ad0a7 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -1,5 +1,5 @@ mod completion; -mod editor; +pub(crate) mod editor; mod info; mod markdown; mod menu; @@ -63,7 +63,7 @@ pub fn regex_prompt( fun(view, doc, registers, regex); - view.ensure_cursor_in_view(doc); + view.ensure_cursor_in_view(doc, cx.editor.config.scrolloff); } Err(_err) => (), // TODO: mark command line as error } |