From b543aaa2c9cf8123ed2fe7dbb6c211a9cd415124 Mon Sep 17 00:00:00 2001 From: James Trew <66286082+jamestrew@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:40:00 -0400 Subject: [PATCH] fix: `prompt_prefix` leading whitespace normal mode cc (#2699) * fix: `prompt_prefix` leading whitespace normal mode cc * [docgen] Update doc/telescope.txt skip-checks: true --------- Co-authored-by: Github Actions --- lua/telescope/pickers.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index c7c60ea..1c2dd00 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -1513,7 +1513,10 @@ end --- Get the prompt text without the prompt prefix. function Picker:_get_prompt() - return vim.api.nvim_buf_get_lines(self.prompt_bufnr, 0, 1, false)[1]:sub(#self.prompt_prefix + 1) + local cursor_line = vim.api.nvim_win_get_cursor(self.prompt_win)[1] - 1 + return vim.api + .nvim_buf_get_lines(self.prompt_bufnr, cursor_line, cursor_line + 1, false)[1] + :sub(#self.prompt_prefix + 1) end function Picker:_reset_highlights()