feat: add a way to spawn populated LineEditor

feat: support pre-filled content in prompts

docs: document new PromptInputLine parameter

fix: remove reset of line contents
This commit is contained in:
Eduard Korchmar authored and Wez Furlong committed 2024-09-22 14:45:11 -07:00
1 parent de0ecc60eb
commit b59cc5b008
5 files changed
+12 -2

No files matched your search

@@ -8,7 +8,7 @@ from the user.
When the user enters the line, emits an event that allows you to act
upon the input.
`PromptInputLine` accepts three fields:
`PromptInputLine` accepts four fields:
* `description` - the text to show at the top of the display area. You may
embed escape sequences and/or use [wezterm.format](../wezterm/format.md).
@@ -20,6 +20,9 @@ upon the input.
anything, or CTRL-C to cancel the input.
* `prompt` - the text to show as the prompt. You may embed escape sequences
and/or use [wezterm.format](../wezterm/format.md). Defaults to: `"> "`. {{since('nightly', inline=True)}}
* `initial_value` - optional. If provided, the initial content of the input
field will be set to this value. The user may edit it prior to submitting
the input.
## Example of interactively renaming the current tab
@@ -34,6 +37,7 @@ config.keys = {
mods = 'CTRL|SHIFT',
action = act.PromptInputLine {
description = 'Enter new name for tab',
initial_value = 'My Tab Name',
action = wezterm.action_callback(function(window, pane, line)
-- line will be `nil` if they hit escape without entering anything
-- An empty string if they just hit enter
@@ -39,6 +39,7 @@ wezterm.on('augment-command-palette', function(window, pane)
action = act.PromptInputLine {
description = 'Enter new name for tab',
initial_value = 'My Tab Name',
action = wezterm.action_callback(function(window, pane, line)
if line then
window:active_tab():set_title(line)