From 83265dc12a22b787a0ccfde29dda2bd1d3fc9f0b Mon Sep 17 00:00:00 2001 From: CPea Date: Wed, 27 Aug 2025 12:26:03 +0700 Subject: [PATCH 1/2] feat: use `prompt_getinput` to get content --- README.md | 2 +- lua/input/init.lua | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 640fe1b..dcc9421 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Opinionated, simple replacement for `vim.ui.input`. ### Requirements -- Neovim >= 0.11.0 +- Neovim >= 0.12.0 ## ⚙️ Setup diff --git a/lua/input/init.lua b/lua/input/init.lua index 2e55354..4a56737 100644 --- a/lua/input/init.lua +++ b/lua/input/init.lua @@ -62,9 +62,7 @@ local function input(opts, on_confirm) vim.keymap.set("n", "", cancel, { buffer = bufnr }) vim.keymap.set("n", "q", cancel, { buffer = bufnr }) vim.keymap.set("n", "", function() - local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) - local content = table.concat(lines, "\n") - + local content = vim.fn.prompt_getinput(bufnr) confirm(content) end, { buffer = bufnr }) From 2e614818c42401e40da9d34623499b0414a4c957 Mon Sep 17 00:00:00 2001 From: CPea Date: Wed, 27 Aug 2025 20:51:13 +0700 Subject: [PATCH 2/2] fix: fix failed test --- tests/config_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/config_spec.lua b/tests/config_spec.lua index b8af4c1..cb7c207 100644 --- a/tests/config_spec.lua +++ b/tests/config_spec.lua @@ -3,7 +3,7 @@ local config = require "input.config" describe("Config options", function() it("could be indexed without options field", function() - assert.equal("", config.icon) + assert.equal(" ", config.icon) assert.equal("Input", config.default_prompt) end) end)