From a289633bbee952776c40bb9b283fe6f1a56ced58 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 17:15:25 +0200 Subject: [PATCH 01/18] updated for version 7.4a.027 Problem: When Python adds lines to another buffer the cursor position is wrong, it might be below the last line causing ml_get errors. (Vlad Irnov) Solution: Temporarily change the current window, so that marks are corrected properly. --- src/if_py_both.h | 39 ++++++++++++++++++++++++++++----------- src/proto/buffer.pro | 1 + src/version.c | 2 ++ src/window.c | 3 ++- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 48b7be7beb..4ac2ebfad9 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -3997,30 +3997,43 @@ SetBufferLineList( static int InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) { + buf_T *save_curbuf = NULL; + win_T *wp; + win_T *save_curwin = NULL; + tabpage_T *tp; + tabpage_T *save_curtab = NULL; + /* First of all, we check the type of the supplied Python object. * It must be a string or a list, or the call is in error. */ if (PyBytes_Check(lines) || PyUnicode_Check(lines)) { - char *str = StringToLine(lines); - buf_T *savebuf; + char *str = StringToLine(lines); if (str == NULL) return FAIL; PyErr_Clear(); VimTryStart(); - switch_buffer(&savebuf, buf); + if (find_win_for_buf(buf, &wp, &tp) == FAIL + || switch_win(&save_curwin, &save_curtab, wp, tp, TRUE) + == FAIL) + switch_buffer(&save_curbuf, buf); - if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL) + if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL) RAISE_UNDO_FAIL; else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL) RAISE_INSERT_LINE_FAIL; - else + else if (save_curbuf == NULL) + /* Only adjust marks if we managed to switch to a window that + * holds the buffer, otherwise line numbers will be invalid. */ appended_lines_mark((linenr_T)n, 1L); vim_free(str); - restore_buffer(savebuf); + if (save_curbuf == NULL) + restore_win(save_curwin, save_curtab, TRUE); + else + restore_buffer(save_curbuf); update_screen(VALID); if (VimTryEnd()) @@ -4036,7 +4049,6 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) PyInt i; PyInt size = PyList_Size(lines); char **array; - buf_T *savebuf; array = PyMem_New(char *, size); if (array == NULL) @@ -4061,7 +4073,10 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) PyErr_Clear(); VimTryStart(); - switch_buffer(&savebuf, buf); + if (find_win_for_buf(buf, &wp, &tp) == FAIL + || switch_win(&save_curwin, &save_curtab, wp, tp, TRUE) + == FAIL) + switch_buffer(&save_curbuf, buf); if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL) RAISE_UNDO_FAIL; @@ -4087,11 +4102,13 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) } /* Free the array of lines. All of its contents have now - * been freed. - */ + * been freed. */ PyMem_Free(array); - restore_buffer(savebuf); + if (save_curbuf == NULL) + restore_win(save_curwin, save_curtab, TRUE); + else + restore_buffer(save_curbuf); update_screen(VALID); if (VimTryEnd()) diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro index ad205c0b3c..9e97f67e44 100644 --- a/src/proto/buffer.pro +++ b/src/proto/buffer.pro @@ -52,6 +52,7 @@ void do_modelines __ARGS((int flags)); int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing)); void write_viminfo_bufferlist __ARGS((FILE *fp)); char_u *buf_spname __ARGS((buf_T *buf)); +int find_win_for_buf __ARGS((buf_T *buf, win_T **wp, tabpage_T **tp)); void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr)); linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr)); int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type)); diff --git a/src/version.c b/src/version.c index eb48ddd257..64325c2aec 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 27, /**/ 26, /**/ diff --git a/src/window.c b/src/window.c index 2435952e15..28bb12547c 100644 --- a/src/window.c +++ b/src/window.c @@ -6577,7 +6577,8 @@ restore_snapshot_rec(sn, fr) #endif -#if defined(FEAT_EVAL) || defined(PROTO) +#if defined(FEAT_EVAL) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ + || defined(PROTO) /* * Set "win" to be the curwin and "tp" to be the current tab page. * restore_win() MUST be called to undo. From d78a2cb83c8588e535bec2f73413a169f4af5d71 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 17:15:26 +0200 Subject: [PATCH 02/18] Added tag v7-4a-027 for changeset 8edba3805d78 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cbc227f9a4..5bb70d8a1a 100644 --- a/.hgtags +++ b/.hgtags @@ -2678,3 +2678,4 @@ c28202427d71b4460122754884bb548f084c3d7a v7-4a-022 ba9a11fe25637103e1a77fefbbaed4ac2ff182f9 v7-4a-024 1b89e3f916c59fbdfdbd31e4d8af8b22274275b2 v7-4a-025 b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 +8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027 From b07b81ed45d5b9d31201bc2fdf0f977f11f29822 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 17:35:13 +0200 Subject: [PATCH 03/18] updated for version 7.4a.028 Problem: Crash when spell checking in new buffer. Solution: Set the b_p_key field. (Mike Williams) --- src/spell.c | 3 +++ src/testdir/test58.in | 4 ++++ src/version.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/spell.c b/src/spell.c index e558a99e4a..20344f25fe 100644 --- a/src/spell.c +++ b/src/spell.c @@ -9054,6 +9054,9 @@ open_spellbuf() { buf->b_spell = TRUE; buf->b_p_swf = TRUE; /* may create a swap file */ +#ifdef FEAT_CRYPT + buf->b_p_key = empty_option; +#endif ml_open(buf); ml_open_file(buf); /* create swap file now */ } diff --git a/src/testdir/test58.in b/src/testdir/test58.in index 9600e83f81..cef1cfa1ba 100644 --- a/src/testdir/test58.in +++ b/src/testdir/test58.in @@ -7,6 +7,10 @@ STARTTEST :set enc=latin1 :e! :" +:" Check using z= in new buffer (crash fixed by patch 7.4a.028). +:set maxmem=512 spell +iasdz=:" +:" :" Function to test .aff/.dic with list of good and bad words. :func TestOne(aff, dic) set spellfile= diff --git a/src/version.c b/src/version.c index 64325c2aec..f0dd371196 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 28, /**/ 27, /**/ From d242b944a26b29d3ade76fbd63662da9835089d9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 17:35:13 +0200 Subject: [PATCH 04/18] Added tag v7-4a-028 for changeset 7aca84c0cd37 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5bb70d8a1a..adf72b60fc 100644 --- a/.hgtags +++ b/.hgtags @@ -2679,3 +2679,4 @@ ba9a11fe25637103e1a77fefbbaed4ac2ff182f9 v7-4a-024 1b89e3f916c59fbdfdbd31e4d8af8b22274275b2 v7-4a-025 b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027 +7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028 From ee01b9231f89ce04a34f9d72731739f88ecfb484 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 18:58:11 +0200 Subject: [PATCH 05/18] updated for version 7.4a.029 Problem: Can't build with MzScheme on Ubuntu 13.04. Solution: Add configure check for the "ffi" library. --- src/auto/configure | 85 +++++++++++++++++++++++++++++++++++++++++++--- src/configure.in | 30 +++++++++++++--- src/version.c | 2 ++ 3 files changed, 109 insertions(+), 8 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index f6bd0534be..a7ebc222ca 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -5014,13 +5014,90 @@ $as_echo "needed" >&6; } $as_echo "not needed" >&6; } fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ffi_type_void in -lffi" >&5 +$as_echo_n "checking for ffi_type_void in -lffi... " >&6; } +if test "${ac_cv_lib_ffi_ffi_type_void+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lffi $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ffi_type_void (); +int +main () +{ +return ffi_type_void (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ffi_ffi_type_void=yes +else + ac_cv_lib_ffi_ffi_type_void=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ffi_ffi_type_void" >&5 +$as_echo "$ac_cv_lib_ffi_ffi_type_void" >&6; } +if test "x$ac_cv_lib_ffi_ffi_type_void" = x""yes; then : + MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi" +fi + + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" - MZSCHEME_SRC="if_mzsch.c" - MZSCHEME_OBJ="objects/if_mzsch.o" - MZSCHEME_PRO="if_mzsch.pro" - $as_echo "#define FEAT_MZSCHEME 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compile and link flags for MzScheme are sane" >&5 +$as_echo_n "checking if compile and link flags for MzScheme are sane... " >&6; } + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" + LIBS="$LIBS $MZSCHEME_LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; mzs_ok=yes +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no: MZSCHEME DISABLED" >&5 +$as_echo "no: MZSCHEME DISABLED" >&6; }; mzs_ok=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$cflags_save + LIBS=$libs_save + if test $mzs_ok = yes; then + MZSCHEME_SRC="if_mzsch.c" + MZSCHEME_OBJ="objects/if_mzsch.o" + MZSCHEME_PRO="if_mzsch.pro" + $as_echo "#define FEAT_MZSCHEME 1" >>confdefs.h + + else + MZSCHEME_CFLAGS= + MZSCHEME_LIBS= + MZSCHEME_EXTRA= + MZSCHEME_MZC= + fi fi diff --git a/src/configure.in b/src/configure.in index 65013602f3..89d8895adc 100644 --- a/src/configure.in +++ b/src/configure.in @@ -702,12 +702,34 @@ if test "$enable_mzschemeinterp" = "yes"; then AC_MSG_RESULT(not needed) fi + dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'". + AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"]) + MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \ -DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'" - MZSCHEME_SRC="if_mzsch.c" - MZSCHEME_OBJ="objects/if_mzsch.o" - MZSCHEME_PRO="if_mzsch.pro" - AC_DEFINE(FEAT_MZSCHEME) + + dnl Test that we can compile a simple program with these CFLAGS and LIBS. + AC_MSG_CHECKING([if compile and link flags for MzScheme are sane]) + cflags_save=$CFLAGS + libs_save=$LIBS + CFLAGS="$CFLAGS $MZSCHEME_CFLAGS" + LIBS="$LIBS $MZSCHEME_LIBS" + AC_TRY_LINK(,[ ], + AC_MSG_RESULT(yes); mzs_ok=yes, + AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no) + CFLAGS=$cflags_save + LIBS=$libs_save + if test $mzs_ok = yes; then + MZSCHEME_SRC="if_mzsch.c" + MZSCHEME_OBJ="objects/if_mzsch.o" + MZSCHEME_PRO="if_mzsch.pro" + AC_DEFINE(FEAT_MZSCHEME) + else + MZSCHEME_CFLAGS= + MZSCHEME_LIBS= + MZSCHEME_EXTRA= + MZSCHEME_MZC= + fi fi AC_SUBST(MZSCHEME_SRC) AC_SUBST(MZSCHEME_OBJ) diff --git a/src/version.c b/src/version.c index f0dd371196..dc7c05b9c1 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 29, /**/ 28, /**/ From 7ef68934172a7c953ff8504291dd052f02197f41 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 18:58:11 +0200 Subject: [PATCH 06/18] Added tag v7-4a-029 for changeset 2b58913e19a5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index adf72b60fc..a138f005d0 100644 --- a/.hgtags +++ b/.hgtags @@ -2680,3 +2680,4 @@ ba9a11fe25637103e1a77fefbbaed4ac2ff182f9 v7-4a-024 b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027 7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028 +2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029 From fb7ba5a7e3deaf3fe744e349efd8d6a5f758d66b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 19:12:57 +0200 Subject: [PATCH 07/18] updated for version 7.4a.030 Problem: Missing find_win_for_buf(). (toothpik) Solution: Add missing changes. --- src/buffer.c | 30 ++++++++++++++++++++++++------ src/version.c | 2 ++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 3a91719d91..238af14309 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5313,18 +5313,14 @@ buf_spname(buf) #if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS) if (bt_quickfix(buf)) { - win_T *win = NULL; + win_T *win; tabpage_T *tp; /* * For location list window, w_llist_ref points to the location list. * For quickfix window, w_llist_ref is NULL. */ - FOR_ALL_TAB_WINDOWS(tp, win) - if (win->w_buffer == buf) - goto win_found; -win_found: - if (win != NULL && win->w_llist_ref != NULL) + if (find_win_for_buf(buf, &win, &tp) == OK && win->w_llist_ref != NULL) return (char_u *)_(msg_loclist); else return (char_u *)_(msg_qflist); @@ -5345,6 +5341,28 @@ win_found: return NULL; } +#if (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ + || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \ + || defined(PROTO) +/* + * Find a window for buffer "buf". + * If found OK is returned and "wp" and "tp" are set to the window and tabpage. + * If not found FAIL is returned. + */ + int +find_win_for_buf(buf, wp, tp) + buf_T *buf; + win_T **wp; + tabpage_T **tp; +{ + FOR_ALL_TAB_WINDOWS(*tp, *wp) + if ((*wp)->w_buffer == buf) + goto win_found; + return FAIL; +win_found: + return OK; +} +#endif #if defined(FEAT_SIGNS) || defined(PROTO) /* diff --git a/src/version.c b/src/version.c index dc7c05b9c1..65cd3b08f2 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 30, /**/ 29, /**/ From 3bebe7e7d4919f683be0db7e7480a1e9b192c3fe Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 19:12:57 +0200 Subject: [PATCH 08/18] Added tag v7-4a-030 for changeset bc4fb0317465 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a138f005d0..0f0b6bf29a 100644 --- a/.hgtags +++ b/.hgtags @@ -2681,3 +2681,4 @@ b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027 7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028 2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029 +bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 From 8d0b12fb678855326122b16df0b5e73054d81466 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 19:22:13 +0200 Subject: [PATCH 09/18] updated for version 7.4a.031 Problem: Compiler warnings. (Charles Campbell) Solution: Initialize variables even when not needed. --- src/regexp_nfa.c | 11 ++++++++++- src/search.c | 3 +-- src/version.c | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 02fe49ea16..f920e09b50 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -4060,9 +4060,13 @@ skip_add: sub = &subs->norm; } + /* avoid compiler warnings */ + save_ptr = NULL; + save_lpos.lnum = 0; + save_lpos.col = 0; + /* Set the position (with "off" added) in the subexpression. Save * and restore it when it was in use. Otherwise fill any gap. */ - save_ptr = NULL; if (REG_MULTI) { if (subidx < sub->in_use) @@ -4192,11 +4196,16 @@ skip_add: sub->list.multi[subidx].end.col = (colnr_T)(reginput - regline + off); } + /* avoid compiler warnings */ + save_ptr = NULL; } else { save_ptr = sub->list.line[subidx].end; sub->list.line[subidx].end = reginput + off; + /* avoid compiler warnings */ + save_lpos.lnum = 0; + save_lpos.col = 0; } subs = addstate(l, state->out, subs, pim, off); diff --git a/src/search.c b/src/search.c index b3ff18fa8b..23dc27ea87 100644 --- a/src/search.c +++ b/src/search.c @@ -4509,7 +4509,7 @@ current_search(count, forward) int result; /* result of various function calls */ char_u old_p_ws = p_ws; int flags = 0; - pos_T save_VIsual; + pos_T save_VIsual = VIsual; int one_char; /* wrapping should not occur */ @@ -4522,7 +4522,6 @@ current_search(count, forward) if (VIsual_active) { orig_pos = curwin->w_cursor; - save_VIsual = VIsual; pos = curwin->w_cursor; start_pos = VIsual; diff --git a/src/version.c b/src/version.c index 65cd3b08f2..e241066933 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 31, /**/ 30, /**/ From 6def751ef3193dc9479a29a432563c4b68d04f4e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 19:22:13 +0200 Subject: [PATCH 10/18] Added tag v7-4a-031 for changeset 839ebe7c1b2f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0f0b6bf29a..12c50e0fb7 100644 --- a/.hgtags +++ b/.hgtags @@ -2682,3 +2682,4 @@ b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028 2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029 bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 +839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031 From 15ce067c0452f8a610750c21ce176e8136bc9367 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:10:51 +0200 Subject: [PATCH 11/18] updated for version 7.4a.032 Problem: New regexp engine: Does not match shorter alternative. (Ingo Karkat) Solution: Do not drop a new state when the PIM info is different. --- src/regexp_nfa.c | 37 ++++++++++++++++++++++++++++++++----- src/version.c | 2 ++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index f920e09b50..72e3a74ff5 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -3535,7 +3535,8 @@ static void copy_sub __ARGS((regsub_T *to, regsub_T *from)); static void copy_sub_off __ARGS((regsub_T *to, regsub_T *from)); static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2)); static int match_backref __ARGS((regsub_T *sub, int subidx, int *bytelen)); -static int has_state_with_pos __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs)); +static int has_state_with_pos __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim)); +static int pim_equal __ARGS((nfa_pim_T *one, nfa_pim_T *two)); static int state_in_list __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs)); static regsubs_T *addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs_arg, nfa_pim_T *pim, int off)); static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, nfa_pim_T *pim, int *ip)); @@ -3701,10 +3702,11 @@ report_state(char *action, * positions as "subs". */ static int -has_state_with_pos(l, state, subs) +has_state_with_pos(l, state, subs, pim) nfa_list_T *l; /* runtime state list */ nfa_state_T *state; /* state to update */ regsubs_T *subs; /* pointers to subexpressions */ + nfa_pim_T *pim; /* postponed match or NULL */ { nfa_thread_T *thread; int i; @@ -3718,12 +3720,37 @@ has_state_with_pos(l, state, subs) && (!nfa_has_zsubexpr || sub_equal(&thread->subs.synt, &subs->synt)) #endif - ) + && pim_equal(&thread->pim, pim)) return TRUE; } return FALSE; } +/* + * Return TRUE if "one" and "two" are equal. That includes when both are not + * set. + */ + static int +pim_equal(one, two) + nfa_pim_T *one; + nfa_pim_T *two; +{ + int one_unused = (one == NULL || one->result == NFA_PIM_UNUSED); + int two_unused = (two == NULL || two->result == NFA_PIM_UNUSED); + + if (one_unused) + /* one is unused: equal when two is also unused */ + return two_unused; + if (two_unused) + /* one is used and two is not: not equal */ + return FALSE; + /* compare the position */ + if (REG_MULTI) + return one->end.pos.lnum == two->end.pos.lnum + && one->end.pos.col == two->end.pos.col; + return one->end.ptr == two->end.ptr; +} + /* * Return TRUE if "state" leads to a NFA_MATCH without advancing the input. */ @@ -3825,7 +3852,7 @@ state_in_list(l, state, subs) { if (state->lastlist[nfa_ll_index] == l->id) { - if (!nfa_has_backref || has_state_with_pos(l, state, subs)) + if (!nfa_has_backref || has_state_with_pos(l, state, subs, NULL)) return TRUE; } return FALSE; @@ -3952,7 +3979,7 @@ skip_add: /* Do not add the state again when it exists with the same * positions. */ - if (has_state_with_pos(l, state, subs)) + if (has_state_with_pos(l, state, subs, pim)) goto skip_add; } diff --git a/src/version.c b/src/version.c index e241066933..97ffa7828d 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 32, /**/ 31, /**/ From bb97b61ce020b94e094afc4d3d93abe47b8f3a87 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:10:51 +0200 Subject: [PATCH 12/18] Added tag v7-4a-032 for changeset 2741b46e96bf --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 12c50e0fb7..6d6423db54 100644 --- a/.hgtags +++ b/.hgtags @@ -2683,3 +2683,4 @@ b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029 bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031 +2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032 From a4e29f382d8ff67be42ea1055d6bb51de15c430e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:40:31 +0200 Subject: [PATCH 13/18] updated for version 7.4a.033 Problem: Test 98 always passes. Solution: Include test98a.in in test98.in, execute the crucial command in one line. (Yukihiro Nakadaira) --- src/testdir/test98.in | 24 +++++++++++++++++++++++- src/testdir/test98a.in | 28 ---------------------------- src/version.c | 2 ++ 3 files changed, 25 insertions(+), 29 deletions(-) delete mode 100644 src/testdir/test98a.in diff --git a/src/testdir/test98.in b/src/testdir/test98.in index b316017dc4..83ccba09e9 100644 --- a/src/testdir/test98.in +++ b/src/testdir/test98.in @@ -1,7 +1,29 @@ Test for 'scrollbind' causing an unexpected scroll of one of the windows. STARTTEST :so small.vim -:source test98a.in +:" We don't want the status line to cause problems: +:set laststatus=0 +:let g:totalLines = &lines * 20 +:let middle = g:totalLines / 2 +:wincmd n +:wincmd o +:for i in range(1, g:totalLines) +: call setline(i, 'LINE ' . i) +:endfor +:exe string(middle) +:normal zt +:normal M +:aboveleft vert new +:for i in range(1, g:totalLines) +: call setline(i, 'line ' . i) +:endfor +:exe string(middle) +:normal zt +:normal M +:" Execute the following two command at once to reproduce the problem. +:setl scb | wincmd p +:setl scb +:wincmd w :let topLineLeft = line('w0') :wincmd p :let topLineRight = line('w0') diff --git a/src/testdir/test98a.in b/src/testdir/test98a.in deleted file mode 100644 index df07a6c3fa..0000000000 --- a/src/testdir/test98a.in +++ /dev/null @@ -1,28 +0,0 @@ -" We don't want the status line to cause problems: -set laststatus=0 -redraw! -let g:totalLines = &lines * 20 -let middle = g:totalLines / 2 -wincmd n -wincmd o -for i in range(1, g:totalLines) - call setline(i, 'LINE ' . i) -endfor - -exe string(middle) -normal zt -normal M - -aboveleft vert new -for i in range(1, g:totalLines) - call setline(i, 'line ' . i) -endfor -exe string(middle) -normal zt -normal M -setl scb - -wincmd p - -setl scb -wincmd w diff --git a/src/version.c b/src/version.c index 97ffa7828d..2ac4f98849 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 33, /**/ 32, /**/ From d08f0a40ba5327725e138696da525298df7a4834 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:40:31 +0200 Subject: [PATCH 14/18] Added tag v7-4a-033 for changeset fa024ce48542 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6d6423db54..8218c3a5b0 100644 --- a/.hgtags +++ b/.hgtags @@ -2684,3 +2684,4 @@ b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026 bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031 2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032 +fa024ce48542356206bf86bdc9286ecf0510ad49 v7-4a-033 From cd90767d62b66bf39b0942a286add4f2571bb58c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:59:13 +0200 Subject: [PATCH 15/18] updated for version 7.4a.034 Problem: The tabline may flicker when opening a new tab after 7.3.759 on Win32. Solution: Move call to TabCtrl_SetCurSel(). (Ken Takata) --- src/gui_w48.c | 10 +++++----- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui_w48.c b/src/gui_w48.c index 78aba03be1..8097fb9c1d 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -2529,13 +2529,13 @@ gui_mch_update_tabline(void) while (nr < TabCtrl_GetItemCount(s_tabhwnd)) TabCtrl_DeleteItem(s_tabhwnd, nr); - if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) - TabCtrl_SetCurSel(s_tabhwnd, curtabidx); - /* Re-enable redraw and redraw. */ SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0); RedrawWindow(s_tabhwnd, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + + if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx) + TabCtrl_SetCurSel(s_tabhwnd, curtabidx); } /* @@ -2548,8 +2548,8 @@ gui_mch_set_curtab(nr) if (s_tabhwnd == NULL) return; - if (TabCtrl_GetCurSel(s_tabhwnd) != nr -1) - TabCtrl_SetCurSel(s_tabhwnd, nr -1); + if (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1) + TabCtrl_SetCurSel(s_tabhwnd, nr - 1); } #endif diff --git a/src/version.c b/src/version.c index 2ac4f98849..3dadcaf77b 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 34, /**/ 33, /**/ From 30a208aceb8e3b6bd2ee85feb476da1486f6ac2d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 21:59:14 +0200 Subject: [PATCH 16/18] Added tag v7-4a-034 for changeset 947edb6335d1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8218c3a5b0..e61bfa1c54 100644 --- a/.hgtags +++ b/.hgtags @@ -2685,3 +2685,4 @@ bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031 2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032 fa024ce48542356206bf86bdc9286ecf0510ad49 v7-4a-033 +947edb6335d1e196c27e2e7e0e0a5ed8f6b78498 v7-4a-034 From c21fd43e5b90ef650e6130c087e120dba12b767b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 22:35:39 +0200 Subject: [PATCH 17/18] updated for version 7.4a.035 Problem: Fix in patch 7.4a.032 is not tested. Solution: Add test. --- src/testdir/test64.in | 1 + src/testdir/test64.ok | 3 +++ src/version.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/testdir/test64.in b/src/testdir/test64.in index c414c6e76e..ec6107fb1a 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -339,6 +339,7 @@ STARTTEST :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar ']) :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo']) :call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:']) +:call add(tl, [2, 'm\k\+_\@=\%(_\@!\k\)\@<=\k\+e', 'mx__xe', 'mx__xe']) :" :"""" Combining different tests and features :call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab']) diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index 8ac9e32cbc..4203c8f391 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -773,6 +773,9 @@ OK 2 - ^\%(.*bar\)\@!.*\zsfoo OK 0 - [ ]\@!\p\%([ ]\@!\p\)*: OK 1 - [ ]\@!\p\%([ ]\@!\p\)*: OK 2 - [ ]\@!\p\%([ ]\@!\p\)*: +OK 0 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e +OK 1 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e +OK 2 - m\k\+_\@=\%(_\@!\k\)\@<=\k\+e OK 0 - [[:alpha:]]\{-2,6} OK 1 - [[:alpha:]]\{-2,6} OK 2 - [[:alpha:]]\{-2,6} diff --git a/src/version.c b/src/version.c index 3dadcaf77b..04f05b0383 100644 --- a/src/version.c +++ b/src/version.c @@ -727,6 +727,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 35, /**/ 34, /**/ From 753cc613eae4a82534ed29036272a92ac14440e1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Jul 2013 22:35:39 +0200 Subject: [PATCH 18/18] Added tag v7-4a-035 for changeset 4ceacc1b0054 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e61bfa1c54..895cac3f93 100644 --- a/.hgtags +++ b/.hgtags @@ -2686,3 +2686,4 @@ bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030 2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032 fa024ce48542356206bf86bdc9286ecf0510ad49 v7-4a-033 947edb6335d1e196c27e2e7e0e0a5ed8f6b78498 v7-4a-034 +4ceacc1b00548c0b21c0dc2628608515899df721 v7-4a-035