Mercurial > vim
view src/GvimExt/README.txt @ 34854:97b5457962ed v9.1.0296
patch 9.1.0296: regexp: engines do not handle case-folding well
Commit: https://github.com/vim/vim/commit/7a27c108e0509f3255ebdcb6558e896c223e4d23
Author: Christian Brabandt <cb@256bit.org>
Date: Tue Apr 9 22:53:19 2024 +0200
patch 9.1.0296: regexp: engines do not handle case-folding well
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: #14294
closes: #14433
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 09 Apr 2024 23:00:08 +0200 |
parents | 9b6bfce90778 |
children |
line wrap: on
line source
README.txt for the gvimext DLL. Written by Tianmiao Hu. Edited by Bram Moolenaar. INSTALLATION To install the "Edit with Vim" popup menu entry, it is recommended to use the "install.exe" program. It will ask you a few questions and install the needed registry entries. In special situations you might want to make changes by hand. Check these items: - The gvimext.dll, gvim.exe and uninstall.exe either need to be in the search path, or you have to set the full path in the registry entries. You could move the gvimext.dll to the "windows\system" or "windows\system32" directory, where the other DLL files are. - You can find the names of the used registry entries in the file "GvimExt.reg". You can edit this file to add the paths. To install the registry entries, right-click the gvimext.reg file and choose the "merge" menu option. - The registry key [HKEY_LOCAL_MACHINE\Software\Vim\Gvim] is used by the gvimext.dll. The value "path" specifies the location of "gvim.exe". If gvim.exe is in the search path, the path can be omitted. The value "lang" can be used to set the language, for example "de" for German. If "lang" is omitted, the language set for Windows will be used. It is the preferred method to keep gvim.exe with the runtime files, so that Vim will find them (also the translated menu items are there). UNINSTALLATION To uninstall the "Edit with Vim" popup menu entry, it is recommended to use the "uninstal.exe" program. In special situations you might want to uninstall by hand: - Open the registry by running regedit.exe. - Delete all the keys listed in GvimExt.reg, except this one: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] For this key, only delete one value: "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="Vim Shell Extension" - Delete the gvimext.dll, if you want. You might need to reboot the machine in order to remove this file. A quick way is to log off and re-login. Another method is by using the uninst.bat script: uninst gvimext.inf This batch file will remove all the registry keys from the system. Then you can remove the gvimext.dll file. Note: In order for this batch file to work, you must have two system files: rundll32.exe and setupapi.dll. I believe you will have rundll32.exe in your system. I know windows nt 4.0 with the service pack 4 has setupapi.dll. My windows 95 has setupapi.dll. I find that the internet explorer 4.0 comes with the setupapi.dll in file Ie4_5.cab. If you do encounter problems running this script, then probably you need to modify the uninst.bat to suit to your system. Basically, you must find out where are the locations for your rundll32.exe and setupapi.dll files. In windows nt, both files are under c:\winnt\system32 directory. In my windows 95 system, I got setupapi.dll at c:\windows\system and rundll32.exe at c:\windows. So you might want to try something like: rundll32.exe c:\windows\system\setupapi.dll,InstallHinfSection DefaultUninstall 128 %1 where %1 can be substituted by gvimext.inf THE SOURCE CODE I have provided the source code here in hope that gvim users around world can further enhance this little dll. I believe the only thing you need to change is gvimext.cpp file. The important two functions you need to look at are QueryContextMenu and InvokeCommand. You can modify right-click menus in the QueryContextMenu function and invoke gvim in the InvokeCommand function. Note the selected files can be accessed from the DragQueryFile function. I am not familiar with the invoking options for gvim. I believe there are some improvements that can be made on that side. I use MS Visual C++ 6.0's nmake to make the gvimext.dll. I don't have a chance to try earlier versions of MSVC. The files that are required for build are: gvimext.cpp gvimext.h gvimext.def gvimext.rc resource.h Makefile To compile the DLL from the command line: vcvars32 nmake -f Makefile If you did something interesting to this dll, please let me know @ tianmiao@acm.org. Happy vimming!!!