diff options
author | Blaž Hrastnik | 2021-03-31 08:17:01 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-03-31 08:17:01 +0000 |
commit | 6c4093c94634a94adbccb4783cddb90076881c02 (patch) | |
tree | 34d4691fe6daca0d14ce77b434830cdef72deb47 /helix-term/src/ui/editor.rs | |
parent | 9eaef6e33376407931162780cd402297c44f26c4 (diff) |
Weave through view_id references so that views into one file have independent selects.
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r-- | helix-term/src/ui/editor.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 1f4bf6bd..7ceeb6ca 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -64,7 +64,7 @@ impl EditorView { // TODO: this seems to prevent setting style later // surface.set_style(viewport, theme.get("ui.background")); - self.render_diagnostics(&doc, area, surface, theme, is_focused); + self.render_diagnostics(&doc, view, area, surface, theme, is_focused); let area = Rect::new( viewport.x, @@ -224,7 +224,7 @@ impl EditorView { let selection_style = Style::default().bg(Color::Rgb(84, 0, 153)); for selection in doc - .selection() + .selection(view.id) .iter() .filter(|range| range.overlaps(&screen)) { @@ -332,6 +332,7 @@ impl EditorView { pub fn render_diagnostics( &self, doc: &Document, + view: &View, viewport: Rect, surface: &mut Surface, theme: &Theme, @@ -344,7 +345,7 @@ impl EditorView { widgets::{Paragraph, Widget}, }; - let cursor = doc.selection().cursor(); + let cursor = doc.selection(view.id).cursor(); let line = doc.text().char_to_line(cursor); let diagnostics = doc.diagnostics.iter().filter(|diagnostic| { @@ -486,11 +487,14 @@ impl Component for EditorView { EventResult::Consumed(None) } Event::Key(event) => { - let id = cx.editor.view().doc; + let view = cx.editor.view(); + let view_id = view.id; + let id = view.doc; let mode = cx.editor.document(id).unwrap().mode(); let mut cxt = commands::Context { editor: &mut cx.editor, + view_id, count: 1, callback: None, callbacks: cx.callbacks, |