aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroni-link <knil.ino@gmail.com>2014-05-22 13:13:00 +0200
committerJustin M. Keyes <justinkz@gmail.com>2014-06-06 18:39:31 -0400
commit37fe5aa44452d351b6c0ad6a4b2aa75f10540d22 (patch)
tree7257cb3409bbee0f1b37eb257b1afda1babc4520 /src
parent01ca4600bae9cd1aa5f0cfe4fc4294e7da0b4ee3 (diff)
downloadrneovim-37fe5aa44452d351b6c0ad6a4b2aa75f10540d22.tar.gz
rneovim-37fe5aa44452d351b6c0ad6a4b2aa75f10540d22.tar.bz2
rneovim-37fe5aa44452d351b6c0ad6a4b2aa75f10540d22.zip
vim-patch:7.4.292 #754
Problem: Searching for "a" does not match accented "a" with new regexp engine, does match with old engine. (David Bürgin) "ca" does not match "ca" with accented "a" with either engine. Solution: Change the old engine, check for following composing character also for single-byte patterns. https://code.google.com/p/vim/source/detail?r=60cdaa05a6ad31cef55eb6b3dc1f57ecac6fcf79
Diffstat (limited to 'src')
-rw-r--r--src/nvim/regexp.c37
-rw-r--r--src/nvim/testdir/test95.in2
-rw-r--r--src/nvim/testdir/test95.ok6
-rw-r--r--src/nvim/version.c2
4 files changed, 29 insertions, 18 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 8c0652dd01..b37fb1e39d 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -4093,25 +4093,28 @@ regmatch (
else if (*opnd == NUL) {
/* match empty string always works; happens when "~" is
* empty. */
- } else if (opnd[1] == NUL
- && !(enc_utf8 && ireg_ic)
- )
- ++reginput; /* matched a single char */
- else {
- len = (int)STRLEN(opnd);
- /* Need to match first byte again for multi-byte. */
- if (cstrncmp(opnd, reginput, &len) != 0)
- status = RA_NOMATCH;
- /* Check for following composing character. */
- else if (enc_utf8
- && UTF_COMPOSINGLIKE(reginput, reginput + len)) {
- /* raaron: This code makes a composing character get
- * ignored, which is the correct behavior (sometimes)
- * for voweled Hebrew texts. */
- if (!ireg_icombine)
+ } else {
+ if (opnd[1] == NUL && !(enc_utf8 && ireg_ic)) {
+ len = 1; /* matched a single byte above */
+ } else {
+ // Need to match first byte again for multi-byte.
+ len = (int)STRLEN(opnd);
+ if (cstrncmp(opnd, reginput, &len) != 0) {
status = RA_NOMATCH;
- } else
+ }
+ }
+ // Check for following composing character.
+ if (status != RA_NOMATCH && enc_utf8
+ && UTF_COMPOSINGLIKE(reginput, reginput + len)
+ && !ireg_icombine) {
+ // raaron: This code makes a composing character get
+ // ignored, which is the correct behavior (sometimes)
+ // for voweled Hebrew texts.
+ status = RA_NOMATCH;
+ }
+ if (status != RA_NOMATCH) {
reginput += len;
+ }
}
}
break;
diff --git a/src/nvim/testdir/test95.in b/src/nvim/testdir/test95.in
index 9afcc7fa6a..568563f88d 100644
--- a/src/nvim/testdir/test95.in
+++ b/src/nvim/testdir/test95.in
@@ -49,6 +49,8 @@ STARTTEST
:call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"])
:call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"])
:call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"])
+:call add(tl, [2, "a", "ca\u0300t"])
+:call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"])
:"""" Test \Z
diff --git a/src/nvim/testdir/test95.ok b/src/nvim/testdir/test95.ok
index c378221a70..e2baee8d29 100644
--- a/src/nvim/testdir/test95.ok
+++ b/src/nvim/testdir/test95.ok
@@ -67,6 +67,12 @@ OK 2 - ֹֻ
OK 0 - .ֹֻ
OK 1 - .ֹֻ
OK 2 - .ֹֻ
+OK 0 - a
+OK 1 - a
+OK 2 - a
+OK 0 - à
+OK 1 - à
+OK 2 - à
OK 0 - ú\Z
OK 1 - ú\Z
OK 2 - ú\Z
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 84165f021a..32dcfbe575 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -226,7 +226,7 @@ static int included_patches[] = {
//295,
//294,
//293,
- //292,
+ 292,
//291,
//290,
289,