mirror of
https://github.com/neovim/neovim.git
synced 2026-07-16 22:21:30 +00:00
vim-patch:8.2.1461: Vim9: string indexes are counted in bytes
Problem: Vim9: string indexes are counted in bytes.
Solution: Use character indexes. (closes vim/vim#6574)
e3c37d8ebf
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -1152,6 +1152,8 @@ text column numbers start with one! Example, to get the byte under the
|
||||
cursor: >
|
||||
:let c = getline(".")[col(".") - 1]
|
||||
|
||||
Index zero gives the first byte. Careful: text column numbers start with one!
|
||||
|
||||
If the length of the String is less than the index, the result is an empty
|
||||
String. A negative index always results in an empty string (reason: backward
|
||||
compatibility). Use [-1:] to get the last byte.
|
||||
|
||||
Reference in New Issue
Block a user