aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands
diff options
context:
space:
mode:
authorWeiyuan Wu2023-09-08 01:46:36 +0000
committerGitHub2023-09-08 01:46:36 +0000
commit8017bb29990bd15eb31542fa25e8cb1207364b07 (patch)
treed035eb5f2348967bb41dcda6cb9f50fcf73ecd17 /helix-term/src/commands
parentc0fd8bc61b4c1611a48312938aaf0e3121f393b1 (diff)
add redraw command (#6949)
Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r--helix-term/src/commands/typed.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index e38853c0..ef539180 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -2291,6 +2291,29 @@ fn clear_register(
Ok(())
}
+fn redraw(
+ cx: &mut compositor::Context,
+ _args: &[Cow<str>],
+ event: PromptEvent,
+) -> anyhow::Result<()> {
+ if event != PromptEvent::Validate {
+ return Ok(());
+ }
+
+ let callback = Box::pin(async move {
+ let call: job::Callback =
+ job::Callback::EditorCompositor(Box::new(|_editor, compositor| {
+ compositor.need_full_redraw();
+ }));
+
+ Ok(call)
+ });
+
+ cx.jobs.callback(callback);
+
+ Ok(())
+}
+
pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
TypableCommand {
name: "quit",
@@ -2877,6 +2900,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
fun: clear_register,
signature: CommandSignature::none(),
},
+ TypableCommand {
+ name: "redraw",
+ aliases: &[],
+ doc: "Clear and re-render the whole UI",
+ fun: redraw,
+ signature: CommandSignature::none(),
+ },
];
pub static TYPABLE_COMMAND_MAP: Lazy<HashMap<&'static str, &'static TypableCommand>> =