feat(statusline): integrate changes from #2676 after rebasing

This commit is contained in:
etienne-k 2022-07-05 22:04:52 +02:00
parent 28fa36f46f
commit 8d28f9543c
No known key found for this signature in database
GPG Key ID: BFCB7E748E5F8A50
2 changed files with 10 additions and 22 deletions

View File

@ -164,7 +164,7 @@ pub fn render_view(
.clip_bottom(1); // -1 from bottom to remove commandline
let mut context =
statusline::RenderContext::new(doc, view, theme, is_focused, &self.spinners);
statusline::RenderContext::new(doc, view, &editor.theme, is_focused, &self.spinners);
StatusLine::render(editor, &mut context, statusline_area, surface);
}
@ -735,26 +735,6 @@ pub fn highlight_cursorline(doc: &Document, view: &View, surface: &mut Surface,
}
}
pub fn render_statusline(
&self,
editor: &Editor,
doc: &Document,
view: &View,
viewport: Rect,
surface: &mut Surface,
is_focused: bool,
) {
let context = statusline::RenderContext {
doc,
view,
theme: &editor.theme,
focused: is_focused,
spinners: &self.spinners,
};
StatusLine::render(editor, &context, viewport, surface);
}
/// Handle events by looking them up in `self.keymaps`. Returns None
/// if event was handled (a command was executed or a subkeymap was
/// activated). Only KeymapResult::{NotFound, Cancelled} is returned

View File

@ -174,7 +174,15 @@ fn render_mode<F>(context: &mut RenderContext, write: F)
" "
}
),
None,
if visible {
match context.doc.mode() {
Mode::Insert => Some(context.theme.get("ui.statusline.insert")),
Mode::Select => Some(context.theme.get("ui.statusline.select")),
Mode::Normal => Some(context.theme.get("ui.statusline.normal")),
}
} else {
None
},
);
}