Remove update-right-status defer hack, call PromptInputLine directly

The real bug was the invalid initial_value field (fixed previously),
not Enter bleed-through from InputSelector. The defer-via-status-tick
workaround left a gap (up to the status update interval) between the
InputSelector closing and the PromptInputLine actually capturing
keyboard input -- during that gap the underlying shell was visible
(the reported flash) and any keystrokes typed during it went to the
shell instead of the field. This is especially damaging for the
3-step SSH domain flow, where hitting the gap on any step submits an
empty line and the whole entry is silently cancelled without saving.
Calling perform_action synchronously, as before the call_after/defer
detour, removes the gap entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 00:41:44 +09:00
parent 387c9d7397
commit 9c36a97dd2

View File

@@ -94,23 +94,7 @@ end)
-- ------------------------------------------------------------
local pane_start_times = {}
-- InputSelector 선택 콜백 안에서 바로 PromptInputLine을 열면, 선택을 확정한 Enter가
-- 새 입력창에도 흘러들어가 즉시 닫혀버린다 (wezterm.time.call_after가 없는 버전에서는
-- 그 호출 자체가 에러로 죽어서 아예 아무것도 안 뜨고 밑에 있던 셸이 그대로 보인다).
-- 어느 wezterm 버전에서도 이미 동작 중인 update-right-status 틱에 실행을 미뤄서 우회한다.
local pending_action = nil
local function defer(fn)
pending_action = fn
end
wezterm.on("update-right-status", function(window, pane)
if pending_action then
local fn = pending_action
pending_action = nil
fn(window, pane)
end
window:set_left_status(wezterm.format({
{ Background = { Color = "#89b4fa" } },
{ Foreground = { Color = "#1e1e2e" } },
@@ -222,21 +206,19 @@ local function set_config_value(window, pane, key, value)
end
local function prompt_config_value(window, pane, title, key, initial_value, quote_string)
defer(function(inner_window, inner_pane)
inner_window:perform_action(
act.PromptInputLine({
description = title .. " (현재: " .. tostring(initial_value) .. ")",
action = wezterm.action_callback(function(cb_window, cb_pane, line)
if not line or line == "" then
return
end
local value = quote_string and string.format("%q", line) or line
set_config_value(cb_window, cb_pane, key, value)
end),
}),
inner_pane
)
end)
window:perform_action(
act.PromptInputLine({
description = title .. " (현재: " .. tostring(initial_value) .. ")",
action = wezterm.action_callback(function(cb_window, cb_pane, line)
if not line or line == "" then
return
end
local value = quote_string and string.format("%q", line) or line
set_config_value(cb_window, cb_pane, key, value)
end),
}),
pane
)
end
local function show_font_settings(window, pane)
@@ -303,28 +285,26 @@ local ssh_domain_steps = {
local function prompt_ssh_domain_step(window, pane, step_index, data)
local step = ssh_domain_steps[step_index]
defer(function(inner_window, inner_pane)
inner_window:perform_action(
act.PromptInputLine({
description = step.title,
action = wezterm.action_callback(function(cb_window, cb_pane, line)
if not line or line == "" then
notify(cb_window, "SSH 도메인 추가를 취소했습니다")
return
end
window:perform_action(
act.PromptInputLine({
description = step.title,
action = wezterm.action_callback(function(cb_window, cb_pane, line)
if not line or line == "" then
notify(cb_window, "SSH 도메인 추가를 취소했습니다")
return
end
data[step.field] = line
data[step.field] = line
if step_index < #ssh_domain_steps then
prompt_ssh_domain_step(cb_window, cb_pane, step_index + 1, data)
else
append_ssh_domain(cb_window, cb_pane, data.name, data.remote_address, data.username)
end
end),
}),
inner_pane
)
end)
if step_index < #ssh_domain_steps then
prompt_ssh_domain_step(cb_window, cb_pane, step_index + 1, data)
else
append_ssh_domain(cb_window, cb_pane, data.name, data.remote_address, data.username)
end
end),
}),
pane
)
end
local function prompt_ssh_domain(window, pane)