on master help sign in
Fix rendering issues for infobox
6710855Ivan Tham
helix-term/src/commands.rs+4−2
@@ -3422,6 +3422,7 @@ macro_rules! mode_info {
3422 ],
3422 ],
3423 ));
3423 ));
3424 $cx.on_next_key(move |cx, event| {
3424 $cx.on_next_key(move |cx, event| {
3425+ cx.editor.autoinfo = None;
3425 match event {
3426 match event {
3426 $(
3427 $(
3427 $keyp => $func(cx),
3428 $keyp => $func(cx),
@@ -3441,8 +3442,8 @@ fn space_mode(cx: &mut Context) {
3441 key!('w'); key!('w') => window_mode; "window mode",
3442 key!('w'); key!('w') => window_mode; "window mode",
3442 key!('y'); key!('y') => yank_joined_to_clipboard; "yank joined to clipboard",
3443 key!('y'); key!('y') => yank_joined_to_clipboard; "yank joined to clipboard",
3443 key!('Y'); key!('Y') => yank_main_selection_to_clipboard; "yank main selection to clipboard",
3444 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_after; "paste system clipboard after selections",
3445− key!('P'); key!('P') => paste_clipboard_before; "paste clipboard before",
3446+ key!('P'); key!('P') => paste_clipboard_before; "paste system clipboard before selections",
3446 key!('R'); key!('R') => replace_selections_with_clipboard; "replace selections with clipboard",
3447 key!('R'); key!('R') => replace_selections_with_clipboard; "replace selections with clipboard",
3447 key!(' '); key!(' ') => keep_primary_selection; "keep primary selection",
3448 key!(' '); key!(' ') => keep_primary_selection; "keep primary selection",
3448 }
3449 }
@@ -3466,6 +3467,7 @@ fn space_mode(cx: &mut Context) {
3466// ],
3467// ],
3467// ));
3468// ));
3468// cx.on_next_key(move |cx, event| {
3469// cx.on_next_key(move |cx, event| {
3470+// cx.editor.autoinfo = None;
3469// match event {
3471// match event {
3470// key!('f') => file_picker(cx),
3472// key!('f') => file_picker(cx),
3471// key!('b') => buffer_picker(cx),
3473// key!('b') => buffer_picker(cx),
helix-term/src/ui/editor.rs+1
@@ -719,6 +719,7 @@ impl Component for EditorView {
719
719
720 if let Some(info) = std::mem::take(&mut cx.editor.autoinfo) {
720 if let Some(info) = std::mem::take(&mut cx.editor.autoinfo) {
721 info.render(area, surface, cx);
721 info.render(area, surface, cx);
722+ cx.editor.autoinfo = Some(info);
722 }
723 }
723
724
724 // render status msg
725 // render status msg
helix-term/src/ui/info.rs+7−2
@@ -6,14 +6,19 @@ use tui::widgets::{Block, Borders, Widget};
6
6
7impl Component for Info {
7impl Component for Info {
8 fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
8 fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
9+ let style = cx.editor.theme.get("ui.popup");
10+ let block = Block::default()
11+ .title(self.title)
9− let block = Block::default().title(self.title).borders(Borders::ALL);
12+ .borders(Borders::ALL)
13+ .border_style(style);
10 let Info { width, height, .. } = self;
14 let Info { width, height, .. } = self;
11 let (w, h) = (*width + 2, *height + 2);
15 let (w, h) = (*width + 2, *height + 2);
12 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
16 // -2 to subtract command line + statusline. a bit of a hack, because of splits.
13 let area = Rect::new(viewport.width - w, viewport.height - h - 2, w, h);
17 let area = Rect::new(viewport.width - w, viewport.height - h - 2, w, h);
18+ surface.clear_with(area, style);
14 let Rect { x, y, .. } = block.inner(area);
19 let Rect { x, y, .. } = block.inner(area);
15 for (y, line) in (y..).zip(self.text.lines()) {
20 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);
17 }
22 }
18 block.render(area, surface);
23 block.render(area, surface);
19 }
24 }