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

@@ -0,0 +1,11 @@
# ResetTerminal
*since: nightly builds only*
Sends the `RIS` "Reset to Initial State" escape sequence (`ESC-c`) to the
output side of the current pane, causing the terminal emulator to reset its
state.
This will reset tab stops, margins, modes, graphic rendition, palette, activate
the primary screen, erase the display and move the cursor to the home position.
+34
View File
@@ -0,0 +1,34 @@
# `pane:inject_output(text)`
*Since: nightly builds only*
Sends text, which may include escape sequences, to the output side of the
current pane. The text will be evaluated by the terminal emulator and can thus
be used to inject/force the terminal to process escape sequences that adjust
the current mode, as well as sending human readable output to the terminal.
Note that if you move the cursor position as a result of using this method, you
should expect the display to change and for text UI programs to get confused.
In this contrived and useless example, pressing ALT-k will output `hello there`
in italics to the current pane:
```lua
local wezterm = require 'wezterm'
return {
keys = {
{
key = 'k',
mods = 'ALT',
action = wezterm.action_callback(function(window, pane)
pane:inject_output '\r\n\x1b[3mhello there\r\n'
end),
},
},
}
```
Not all panes support this method; at the time of writing, this works for local
panes but not for multiplexer panes.