1use crate::compositor::{Component, Context};
2use helix_view::graphics::{Margin, Rect};
3use helix_view::info::Info;
4use tui::buffer::Buffer as Surface;
5use tui::widgets::{Block, Borders, Paragraph, Widget};
7impl Component for Info {
8 fn render(&mut self, viewport: Rect, surface: &mut Surface, cx: &mut Context) {
9 let text_style = cx.editor.theme.get("ui.text.focus");
10 let popup_style = text_style.patch(cx.editor.theme.get("ui.popup"));
12 // Calculate the area of the terminal to modify. Because we want to
13 // render at the bottom right, we use the viewport's width and height
14 // which evaluate to the most bottom right coordinate.
15 let width = self.width + 2 + 2; // +2 for border, +2 for margin
16 let height = self.height + 2; // +2 for border
17 let area = viewport.intersection(Rect::new(
18 viewport.width.saturating_sub(width),
19 viewport.height.saturating_sub(height + 2), // +2 for statusline
23 surface.clear_with(area, popup_style);
25 let block = Block::default()
26 .title(self.title.as_str())
27 .borders(Borders::ALL)
28 .border_style(popup_style);
34 let inner = block.inner(area).inner(&margin);
35 block.render(area, surface);
37 Paragraph::new(self.text.as_str())
39 .render(inner, surface);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list