From 347f6ece7fce64b413d1d9949b3987476a2a08bd Mon Sep 17 00:00:00 2001 From: Son Pham-Ba Date: Fri, 31 Jan 2025 10:21:25 +0100 Subject: [PATCH] fix: account for noice.nvim api change of vim.g.ui_cmdline_pos --- .pre-commit-config.yaml | 1 + lua/smear_cursor/screen.lua | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3ca395..cfea80c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,7 @@ repos: - id: codespell additional_dependencies: - tomli + args: ["--ignore-words-list=noice"] - repo: https://github.com/compilerla/conventional-pre-commit rev: v3.6.0 hooks: diff --git a/lua/smear_cursor/screen.lua b/lua/smear_cursor/screen.lua index 5f03644..35a33e1 100644 --- a/lua/smear_cursor/screen.lua +++ b/lua/smear_cursor/screen.lua @@ -17,10 +17,16 @@ M.get_screen_cursor_position = function() end M.get_screen_cmd_cursor_position = function() - if vim.g.ui_cmdline_pos ~= nil then - local row = vim.g.ui_cmdline_pos["row"] - local col = vim.g.ui_cmdline_pos["col"] + vim.fn.getcmdpos() + 1 + if vim.g.ui_cmdline_pos ~= nil then -- noice.nvim + local row = vim.g.ui_cmdline_pos[1] + local col = vim.g.ui_cmdline_pos[2] + if not row or not col then + row = vim.g.ui_cmdline_pos.row + col = vim.g.ui_cmdline_pos.col + end + + col = col + vim.fn.getcmdpos() + 1 return row, col end