helix
helix copied to clipboard
How to refresh/reset/redraw/repaint the screen?
Discussed in https://github.com/helix-editor/helix/discussions/4349
Originally posted by GlassGruber October 18, 2022 I'm not really sure what is the correct term, so I've listed some that came to mind regarding this minor display issue.
I'm a new user and testing things around I've faced some glitches like characters of previous lines not cleared when moving cursor while testing different color themes.
I think however that this is more related to my terminal rather than an hx direct issue.
So I thought something like using shortcut ctrl+L could "refresh" current screen and remove all displayed inconsistencies, but nothing happened and looking for commands like :redraw :clear came up to nothing (BTW the fuzzy cmd : search is very smooth and the tooltip tui pretty nice, hat to you!🎩)
I've checked the keymap docs page but haven't found anything about this.
Hope it's not a RTFM case, thank you!
There's a clear function that is defined on Compositor.terminal:
https://github.com/helix-editor/helix/blob/7f75458e6f29f2dc0717557a1072b70deee27acb/helix-tui/src/terminal.rs#L214-L219
It should be possible to add a redraw command/keybind that calls this method by adding a Job, something like this:
fn redraw(cx: &mut Context) {
let callback = Box::pin(async move {
let call: job::Callback = Box::new(|_editor, compositor| {
// expose a wrapper `clear` method that calls
// compositor.terminal.clear()
compositor.clear();
});
Ok(call)
});
cx.jobs.callback(callback);
}
Doesn't previewing a theme using :theme rerender the whole screen?
Looking through the new architecture, it's not totally obvious to me how to approach this. What about a needs_clear flag in Compositor that we can set on a command, and that instructs Application::render to clear the terminal screen?
closed by https://github.com/helix-editor/helix/pull/6949