neovim/runtime
zeertzjq f49408454d
vim-patch:9.1.0296: regexp: engines do not handle case-folding well (#28259)
Problem:  Regex engines do not handle case-folding well
Solution: Correctly calculate byte length of characters to skip

When the regexp engine compares two utf-8 codepoints case insensitively
it may match an adjacent character, because it assumes it can step over
as many bytes as the pattern contains.

This however is not necessarily true because of case-folding, a
multi-byte UTF-8 character can be considered equal to some single-byte
value.

Let's consider the pattern 'ſ' and the string 's'. When comparing and
ignoring case, the single character 's' matches, and since it matches
Vim will try to step over the match (by the amount of bytes of the
pattern), assuming that since it matches, the length of both strings is
the same.

However in that case, it should only step over the single byte
value 's' so by 1 byte and try to start matching after it again. So for the
backtracking engine we need to ensure:
- we try to match the correct length for the pattern and the text
- in case of a match, we step over it correctly

The same thing can happen for the NFA engine, when skipping to the next
character to test for a match. We are skipping over the regstart
pointer, however we do not consider the case that because of
case-folding we may need to adjust the number of bytes to skip over. So
this needs to be adjusted in find_match_text() as well.

A related issue turned out, when prog->match_text is actually empty. In
that case we should try to find the next match and skip this condition.

fixes: vim/vim#14294
closes: vim/vim#14433

7a27c108e0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-04-10 07:08:49 +08:00
..
autoload vim-patch:08d2401fbc6d 2024-04-04 10:29:58 +02:00
colors fix(treesitter): document more standard highlight groups 2024-03-19 09:41:16 +01:00
compiler vim-patch:9.1.0276: No pandoc syntax support 2024-04-09 10:24:49 +02:00
doc vim-patch:9.1.0296: regexp: engines do not handle case-folding well (#28259) 2024-04-10 07:08:49 +08:00
ftplugin vim-patch:9.1.0278: filetype: zathurarc files not recognized 2024-04-09 09:54:07 +02:00
indent vim-patch:63833bb0217f 2024-03-26 21:48:41 +01:00
keymap vim-patch:caee7956a21a 2023-11-05 21:56:56 +01:00
lua vim-patch:9.1.0276: No pandoc syntax support 2024-04-09 10:24:49 +02:00
macros vim-patch:79230f027a25 2024-02-16 08:57:45 +01:00
pack/dist/opt vim-patch:d3c0ff5d5a90 2024-03-24 10:32:07 +01:00
plugin feat(defaults): add :Inspect to right-click menu (#28181) 2024-04-05 18:08:54 +08:00
queries fix(treesitter): update parsers and queries 2024-04-05 18:36:17 +02:00
spell feat(runtime): import cleanadd.vim from Vim (#17699) 2022-03-13 04:52:45 +00:00
syntax vim-patch:e43ace558aee (#28258) 2024-04-10 06:31:10 +08:00
tools vim-patch:e80086446cc2 (#19848) 2022-08-20 10:04:55 +02:00
tutor docs: fix typos (#27868) 2024-03-28 09:32:32 +08:00
CMakeLists.txt build: various fixes 2024-02-01 12:06:55 +01:00
delmenu.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
filetype.lua fix(filetype): use unexpanded file name (#27931) 2024-03-23 11:46:23 +08:00
ftoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugin.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
ftplugof.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indent.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
indoff.vim vim-patch:e978b4534a5e (#24697) 2023-08-13 13:25:10 +01:00
macmap.vim re-integrate runtime/ vim-patch:0 #938 2014-07-29 02:12:31 +00:00
makemenu.vim vim-patch:9.1.0013: Modula2 filetype support lacking (#27020) 2024-01-16 17:45:57 +00:00
menu.vim vim-patch:e059fae10044 2023-08-24 11:33:06 +09:00
mswin.vim vim-patch:45da32964d6e 2024-03-14 15:04:31 +08:00
neovim.ico feat(windows): show icon in terminal titlebar, taskbar #20607 2022-10-13 05:48:12 -07:00
nvim.appdata.xml docs: add wiki FAQ to the runtime documentation (#26539) 2023-12-13 17:31:39 +01:00
nvim.desktop build(nvim.desktop): central Kurdish translation #17065 2022-05-13 11:58:22 -07:00
nvim.png Dist: make icon a proper square (#9716) 2019-03-11 21:00:12 +01:00
optwin.vim vim-patch:9.1.0147: Cannot keep a buffer focused in a window 2024-03-11 11:38:13 +08:00
synmenu.vim vim-patch:9.1.0013: Modula2 filetype support lacking (#27020) 2024-01-16 17:45:57 +00:00