diff options
| author | bfredl <bjorn.linse@gmail.com> | 2026-10-06 15:39:26 +0200 |
|---|---|---|
| committer | bfredl <bjorn.linse@gmail.com> | 2026-10-11 21:00:14 +0200 |
| commit | 64b46e4ad44e57a4c72f09a154c7f41e6670d7d1 (patch) | |
| tree | de0ccfee6dc7b73873ffb83a9eacd1b58e169f40 /runtime/lua/vim/_ftplugin/lua.lua | |
| parent | 7e1ae5115f1f7088abe329892948708fc809d45e (diff) | |
| download | rneovim-64b46e4ad44e57a4c72f09a154c7f41e6670d7d1.tar.gz rneovim-64b46e4ad44e57a4c72f09a154c7f41e6670d7d1.tar.bz2 rneovim-64b46e4ad44e57a4c72f09a154c7f41e6670d7d1.zip | |
fix(setreg): use better estimate of register width
vim-patch:9.2.1175: setreg() block width wrong for unprintable chars
When yanking, the width of a <c-v>{motion}y register
is determined by the virtual colums of the text. However
in setreg() in 'b' mode use an idosyncratic width measurement
where C0 control chars (ASCII 0x00 - 0x19) and invalid UTF-8 bytes
have width 1 instead of their display width (2 or 4 cells).
Consider the following test case:
let strings = ['"reference', '"Übel', "\"aa\x07bb", "\"qq\x82", "\"x\nbabbel"]
for string in strings
call append('$', string)
exec "normal G0\<c-v>$\"ay"
let one = getregtype('a')
if string != strings[-1]
call setreg("b", string, 'b')
let two = getregtype('b')
else
let two = "na"
endif
call setreg("c", [string], 'b')
let three = getregtype('c')
call append('$', '"yank: '.one.", string: ".two.", list: ".three)
endfor
AFter this fix, all the three ways of measuring the width gives
equal values (or two, in the case of not being able to use setreg()
with a plain string in the first case)
Diffstat (limited to 'runtime/lua/vim/_ftplugin/lua.lua')
0 files changed, 0 insertions, 0 deletions