on master help sign in
Fix rendering issues for infobox
commit6710855eac4826ffdc77d22901b010ae20bbaf3e authorIvan Tham <pickfire@riseup.net> dateWed 30 Jun 2021, 21:39 (5 years ago) parent9effe71
3 files changed+12−4
helix-term/src/commands.rs+4−2 helix-term/src/ui/editor.rs+1 helix-term/src/ui/info.rs+7−2
helix-term/src/commands.rs+4−2
@@ -3422,6 +3422,7 @@ macro_rules! mode_info {
34223422 ],
34233423 ));
34243424 $cx.on_next_key(move |cx, event| {
3425+ cx.editor.autoinfo = None;
34253426 match event {
34263427 $(
34273428 $keyp => $func(cx),
@@ -3441,8 +3442,8 @@ fn space_mode(cx: &mut Context) {
34413442 key!('w'); key!('w') => window_mode; "window mode",
34423443 key!('y'); key!('y') => yank_joined_to_clipboard; "yank joined to clipboard",
34433444 key!('Y'); key!('Y') => yank_main_selection_to_clipboard; "yank main selection to clipboard",
3444− key!('p'); key!('p') => paste_clipboard_after; "paste clipboard after",
3445− key!('P'); key!('P') => paste_clipboard_before; "paste clipboard before",
3445+ key!('p'); key!('p') => paste_clipboard_after; "paste system clipboard after selections",
3446+ key!('P'); key!('P') => paste_clipboard_before; "paste system clipboard before selections",
34463447 key!('R'); key!('R') => replace_selections_with_clipboard; "replace selections with clipboard",
34473448 key!(' '); key!(' ') => keep_primary_selection; "keep primary selection",
34483449 }
@@ -3466,6 +3467,7 @@ fn space_mode(cx: &mut Context) {
34663467// ],
34673468// ));
34683469// cx.on_next_key(move |cx, event| {
3470+// cx.editor.autoinfo = None;
34693471// match event {
34703472// key!('f') => file_picker(cx),
34713473// key!('b') => buffer_picker(cx),
helix-term/src/ui/editor.rs+1
@@ -719,6 +719,7 @@ impl Component for EditorView {
719719
720720 if let Some(info) = std::mem::take(&mut cx.editor.autoinfo) {
721721 info.render(area, surface, cx);
722+ cx.editor.autoinfo = Some(info);
722723 }
723724
724725 // render status msg
helix-term/src/ui/info.rs+7−2
@@ -6,14 +6,19 @@ use tui::widgets::{Block, Borders, Widget};
66
77impl Component for Info {
88 fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
9− let block = Block::default().title(self.title).borders(Borders::ALL);
9+ let style = cx.editor.theme.get("ui.popup");
10+ let block = Block::default()
11+ .title(self.title)
12+ .borders(Borders::ALL)
13+ .border_style(style);
1014 let Info { width, height, .. } = self;
1115 let (w, h) = (*width + 2, *height + 2);
1216 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
1317 let area = Rect::new(viewport.width - w, viewport.height - h - 2, w, h);
18+ surface.clear_with(area, style);
1419 let Rect { x, y, .. } = block.inner(area);
1520 for (y, line) in (y..).zip(self.text.lines()) {
16− surface.set_string(x, y, line, Style::default());
21+ surface.set_string(x, y, line, style);
1722 }
1823 block.render(area, surface);
1924 }