mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Fixed bug with wrong visual ranges
This commit is contained in:
@@ -2717,13 +2717,14 @@ local function ToggleTodo(opts)
|
|||||||
-- - [x] by -
|
-- - [x] by -
|
||||||
-- enter insert mode if opts.i == true
|
-- enter insert mode if opts.i == true
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
-- Neovim sends wrong visual selection when using a mapping
|
|
||||||
-- See https://github.com/neovim/neovim/issues/15144
|
|
||||||
vim.cmd("execute 'normal! \\<ESC>'")
|
|
||||||
local startline = vim.api.nvim_buf_get_mark(0, "<")[1]
|
local startline = vim.api.nvim_buf_get_mark(0, "<")[1]
|
||||||
local endline = vim.api.nvim_buf_get_mark(0, ">")[1]
|
local endline = vim.api.nvim_buf_get_mark(0, ">")[1]
|
||||||
local cursorlinenr = vim.api.nvim_win_get_cursor(0)[1]
|
local cursorlinenr = vim.api.nvim_win_get_cursor(0)[1]
|
||||||
if startline == 0 or endline == 0 then
|
-- to avoid the visual range marks not being reset when calling
|
||||||
|
-- command from normal mode
|
||||||
|
vim.api.nvim_buf_set_mark(0, "<", 0, 0, {})
|
||||||
|
vim.api.nvim_buf_set_mark(0, ">", 0, 0, {})
|
||||||
|
if startline <= 0 or endline <= 0 then
|
||||||
startline = cursorlinenr
|
startline = cursorlinenr
|
||||||
endline = cursorlinenr
|
endline = cursorlinenr
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user