Add ResetTerminal and pane:inject_output method

refs: https://github.com/wez/wezterm/discussions/2606
This commit is contained in:
Wez Furlong committed 2022-10-08 10:25:22 -07:00
1 parent 473316934b
commit 4e5945c061
9 files changed
+88 -1

No files matched your search

+1
View File
@@ -15,4 +15,5 @@ log = "0.4"
luahelper = { path = "../../luahelper" }
portable-pty = { path = "../../pty" }
smol = "1.2"
termwiz = { path = "../../termwiz" }
mux = { path = "../../mux" }
+12
View File
@@ -196,6 +196,18 @@ impl UserData for MuxPane {
None => Ok("".to_string()),
}
});
methods.add_method("inject_output", |_, this, text: String| {
let mux = get_mux()?;
let pane = this.resolve(&mux)?;
let mut parser = termwiz::escape::parser::Parser::new();
let mut actions = vec![];
parser.parse(text.as_bytes(), |action| actions.push(action));
pane.perform_actions(actions);
Ok(())
});
}
}