aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp_nfa.c
diff options
context:
space:
mode:
authoroni-link <knil.ino@gmail.com>2014-05-22 12:41:41 +0200
committerJustin M. Keyes <justinkz@gmail.com>2014-06-06 19:38:06 -0400
commit057e36ea1975bc0da720593e60407263bcb25806 (patch)
tree82a547af78d1bb8dd6aa9dd0b6aa87258901b168 /src/nvim/regexp_nfa.c
parent37fe5aa44452d351b6c0ad6a4b2aa75f10540d22 (diff)
downloadrneovim-057e36ea1975bc0da720593e60407263bcb25806.tar.gz
rneovim-057e36ea1975bc0da720593e60407263bcb25806.tar.bz2
rneovim-057e36ea1975bc0da720593e60407263bcb25806.zip
vim-patch:7.4.290 #753
Problem: A non-greedy match followed by a branch is too greedy. (Ingo Karkat) Solution: Add NFA_MATCH when it is already in the state list if the position differs. https://code.google.com/p/vim/source/detail?r=b871734bf54ea185dbd2cc759d86dbfbe21cde26
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r--src/nvim/regexp_nfa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index a4e7f1df13..8781e06649 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -3877,8 +3877,10 @@ addstate (
if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP) {
/* This state is already in the list, don't add it again,
* unless it is an MOPEN that is used for a backreference or
- * when there is a PIM. */
- if (!nfa_has_backref && pim == NULL && !l->has_pim) {
+ * when there is a PIM. For NFA_MATCH check the position,
+ * lower position is preferred. */
+ if (!nfa_has_backref && pim == NULL && !l->has_pim
+ && state->c != NFA_MATCH) {
skip_add:
#ifdef REGEXP_DEBUG
nfa_set_code(state->c);