fix: disable newlines in single-line inputs

This commit is contained in:
2026-04-05 00:38:13 +03:00
parent 16ebf11bec
commit c8e2795afb
2 changed files with 41 additions and 0 deletions

View File

@@ -327,6 +327,13 @@ function M:_install_keymaps(input)
-- Block insert mode on the select display buffer.
vim.keymap.set("n", "i", "<Nop>", { buffer = buf, nowait = true, silent = true })
vim.keymap.set("n", "a", "<Nop>", { buffer = buf, nowait = true, silent = true })
elseif input.type == "text" then
-- Single-line text inputs must never contain newlines. <CR> in insert
-- mode just exits insert mode (accepting the value) rather than inserting
-- a line break. Multiline inputs intentionally keep <CR> for newline entry.
map("i", "<CR>", function()
vim.cmd("stopinsert")
end)
end
end