Skip to content

Commit

Permalink
fix: account for noice.nvim api change of vim.g.ui_cmdline_pos
Browse files Browse the repository at this point in the history
  • Loading branch information
sphamba committed Jan 31, 2025
1 parent 4b402d4 commit 347f6ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 9 additions & 3 deletions lua/smear_cursor/screen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 347f6ec

Please sign in to comment.