Display something useful in help

This commit is contained in:
Greg Shuflin committed 2024-04-10 03:22:27 -07:00
1 parent eab49608c8
commit e995551d2f
2 files changed
+12 -7

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ impl TextBuffer {
pub(crate) fn help() -> Self {
let mut buf = Self::new();
buf.text = TextLines::from_text("Dummy help text");
buf.text = TextLines::from_text("Dummy help text\nA newline\nSome other stuff desu");
buf.writeable = false;
buf.title = Some("Help".to_string());
buf
+11 -6
View File
@@ -68,8 +68,6 @@ impl TerminalState {
} else {
Color::Blue
};
//TODO fillin text
//let text = single_buffer_lines(buffer, rect.height, cursor_style, line_number_style);
let block = Block::default()
.title(title)
.borders(Borders::ALL)
@@ -95,19 +93,26 @@ impl TerminalState {
let inner_rect = centered_rect(50, 50, outer_rect);
frame.render_widget(Clear, inner_rect);
frame.render_widget(block, inner_rect);
//frame.render_widget(block, inner_rect);
let start = 0;
let end = inner_rect.height as usize;
let raw_lines = buffer.visible_lines(start, end);
let lines: Vec<_> = raw_lines.into_iter().map(Line::from).collect();
let paragraph = Paragraph::new(lines).block(block);
frame.render_widget(paragraph, inner_rect);
}
fn render_main_buffers(&mut self, frame: &mut Frame, rect: Rect, core: &EditorCore) {
let cursor_style = cursor_style(&core);
let line_number_style = line_number_style(&core);
let cursor_style = cursor_style(core);
let line_number_style = line_number_style(core);
let active_buffer = core.active_buffer();
let pane_layout = core.pane_layout();
if let Buffer::Text(tb) = active_buffer {
let text = single_buffer_lines(&tb, rect.height, cursor_style, line_number_style);
let text = single_buffer_lines(tb, rect.height, cursor_style, line_number_style);
frame.render_widget(Paragraph::new(text).white().on_black(), rect);
}