From 6082bea6acae266c392cd25317414cf3a167a596 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 13 May 2014 18:04:00 +0200 Subject: =?UTF-8?q?updated=20for=20version=207.4.292=20Problem:=20=20=20?= =?UTF-8?q?=20Searching=20for=20"a"=20does=20not=20match=20accented=20"a"?= =?UTF-8?q?=20with=20new=20regexp=20=20=20=20=20=20=20=20=20=20=20=20=20en?= =?UTF-8?q?gine,=20does=20match=20with=20old=20engine.=20(David=20B=C3=BCr?= =?UTF-8?q?gin)=20=20=20=20=20=20=20=20=20=20=20=20=20"ca"=20does=20not=20?= =?UTF-8?q?match=20"ca"=20with=20accented=20"a"=20with=20either=20engine.?= =?UTF-8?q?=20Solution:=20=20=20Change=20the=20old=20engine,=20check=20for?= =?UTF-8?q?=20following=20composing=20character=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20also=20for=20single-byte=20patterns.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/regexp.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/regexp.c') diff --git a/src/regexp.c b/src/regexp.c index fe837721e..d66cd2062 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -4692,31 +4692,37 @@ regmatch(scan) /* match empty string always works; happens when "~" is * empty. */ } - else if (opnd[1] == NUL + else + { + if (opnd[1] == NUL #ifdef FEAT_MBYTE && !(enc_utf8 && ireg_ic) #endif ) - ++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; + { + 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; + } #ifdef FEAT_MBYTE /* Check for following composing character. */ - else if (enc_utf8 - && UTF_COMPOSINGLIKE(reginput, reginput + len)) + 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. */ - if (!ireg_icombine) - status = RA_NOMATCH; + status = RA_NOMATCH; } #endif - else + if (status != RA_NOMATCH) reginput += len; } } -- cgit v1.2.1