Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
The bug first appears in 8.1.1522 (it works in 8.1.1521).
The issue is triggered by a plugin (in this case coc.nvim), but it seems related to the popup feature.
Environment (please complete the following information):
I don't know what that plugin does, that messes up byte2line() return value. If I disable it with
I'll see if I can reproduce without plugins, just with function calls. I'll take a look at that plugin source and see if I can figure out something.
I'm seeing something similar when trying to use
I've tried unsuccessfully to get a very simple reproduction path. However, I do have a clear (though not simple) reproduction path.
Here's the line that I can comment out to avoid the
I can reproduce a bug with byte2line for buffers which have text properties. If byte2line is given a byte count for any line after (but not including) the first line in the buffer which has text props, either the correct line number minus 1 is returned (for the line after) or -1 is returned (for all other subsequent lines).
byte2line returning correct line number - 1
Outputs 4 then 3. Should of course be 4 for both.
byte2line returning -1 (only the line number for line2byte is changed).
Outputs 4 then -1. The same result can be achieved by adding another text prop before line 3.
I don't think line2byte is affected by this, just byte2line.
I've been looking at
Sorry to double-post. I thought it better to add this seperately.
Ryan Hackett wrote:
I've been looking at `ml_find_line_or_offset` in `memline.c` which is called by `byte2line` and I've found that removing lines 5783 to 5793 (which sets len when a buffer has text props) seems to fix this bug, but likely has other side effects I'm not aware of. Any thoughts on this?
Most likely will cause other problems. It would mainly compensate for the error in byte2line() by also breaking line2byte() :-). I made a solution. It's not very efficient, using STRLEN() a lot. But it should fix the problem.…
-- ERIC IDLE PLAYED: THE DEAD COLLECTOR, MR BINT (A VILLAGE NE'ER-DO -WELL VERY KEEN ON BURNING WITCHES), SIR ROBIN, THE GUARD WHO DOESN'T HICOUGH BUT TRIES TO GET THINGS STRAIGHT, CONCORDE (SIR LAUNCELOT'S TRUSTY STEED), ROGER THE SHRUBBER (A SHRUBBER), BROTHER MAYNARD "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///