Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_lines handler reports wrong value for Visual Block #22009

Open
MIvanchev opened this issue Jan 26, 2023 · 0 comments
Open

on_lines handler reports wrong value for Visual Block #22009

MIvanchev opened this issue Jan 26, 2023 · 0 comments
Labels
bug issues reporting wrong behavior

Comments

@MIvanchev
Copy link

Describe the bug

Create a buffer with some lines. Register an event handler with

local function on_lines(_, bufnr, changedtick, first, last, last_updated, _, _, _)
  print(bufnr .. ' ' .. changedtick .. ' ' .. first .. ' ' .. last .. ' ' .. last_updated)
end

vim.api.nvim_buf_attach(0, false, {
  on_lines = on_lines
})

Go to the beginning of line 1. Go into Visual Block (C-V), insert a space (Shift + I, then space, then Escape). I get <bufnr> <changedtick> 1 1 1. Deleting the space with with x results in <bufnr> <changedtick> 0 1 1 which is the correct result according to https://neovim.io/doc/user/api.html#nvim_buf_attach() (first value zero-indexed, rest probably not)

<bufnr> <changedtick> 1 1 1 is wrong and should be <bufnr> <changedtick> 0 1 1 (zero-based 1st line edited and was the only line edited, line number after edit is still 1.

Steps to reproduce

See description.

Expected behavior

See description.

Neovim version (nvim -v)

0.8.1

Vim (not Nvim) behaves the same?

no, neovim specifics

Operating system/version

Ubuntu 20.04

Terminal name/version

Neovim-qt

$TERM environment variable

n/a

Installation

Self-compiled

@MIvanchev MIvanchev added the bug issues reporting wrong behavior label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
Development

No branches or pull requests

1 participant