Skip to content

Commit 606fa88

Browse files
committed
Merge branch 'vim'
Conflicts: src/auto/configure
2 parents 44cb070 + 753cc61 commit 606fa88

17 files changed

Lines changed: 321 additions & 68 deletions

.hgtags

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,3 +2678,12 @@ c28202427d71b4460122754884bb548f084c3d7a v7-4a-022
26782678
ba9a11fe25637103e1a77fefbbaed4ac2ff182f9 v7-4a-024
26792679
1b89e3f916c59fbdfdbd31e4d8af8b22274275b2 v7-4a-025
26802680
b3ff17862b4c9d06411bd3c854cfceb77d5b97b6 v7-4a-026
2681+
8edba3805d787f50b51d7fd59899c5361c09a348 v7-4a-027
2682+
7aca84c0cd37ab4eceab8897e0297e2e318b8fff v7-4a-028
2683+
2b58913e19a5a40d169f2aa1ef9530a78c375d2e v7-4a-029
2684+
bc4fb031746594e4e84b36e64389e78454617a86 v7-4a-030
2685+
839ebe7c1b2fb8150714fc48ec597d2e1f1c7557 v7-4a-031
2686+
2741b46e96bfe6c06a5e9704bcad649655f7b50f v7-4a-032
2687+
fa024ce48542356206bf86bdc9286ecf0510ad49 v7-4a-033
2688+
947edb6335d1e196c27e2e7e0e0a5ed8f6b78498 v7-4a-034
2689+
4ceacc1b00548c0b21c0dc2628608515899df721 v7-4a-035

src/auto/configure

Lines changed: 131 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5124,15 +5124,142 @@ echo "${ECHO_T}needed" >&6; }
51245124
echo "${ECHO_T}not needed" >&6; }
51255125
fi
51265126

5127+
{ echo "$as_me:$LINENO: checking for ffi_type_void in -lffi" >&5
5128+
echo $ECHO_N "checking for ffi_type_void in -lffi... $ECHO_C" >&6; }
5129+
if test "${ac_cv_lib_ffi_ffi_type_void+set}" = set; then
5130+
echo $ECHO_N "(cached) $ECHO_C" >&6
5131+
else
5132+
ac_check_lib_save_LIBS=$LIBS
5133+
LIBS="-lffi $LIBS"
5134+
cat >conftest.$ac_ext <<_ACEOF
5135+
/* confdefs.h. */
5136+
_ACEOF
5137+
cat confdefs.h >>conftest.$ac_ext
5138+
cat >>conftest.$ac_ext <<_ACEOF
5139+
/* end confdefs.h. */
5140+
5141+
/* Override any GCC internal prototype to avoid an error.
5142+
Use char because int might match the return type of a GCC
5143+
builtin and then its argument prototype would still apply. */
5144+
#ifdef __cplusplus
5145+
extern "C"
5146+
#endif
5147+
char ffi_type_void ();
5148+
int
5149+
main ()
5150+
{
5151+
return ffi_type_void ();
5152+
;
5153+
return 0;
5154+
}
5155+
_ACEOF
5156+
rm -f conftest.$ac_objext conftest$ac_exeext
5157+
if { (ac_try="$ac_link"
5158+
case "(($ac_try" in
5159+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5160+
*) ac_try_echo=$ac_try;;
5161+
esac
5162+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5163+
(eval "$ac_link") 2>conftest.er1
5164+
ac_status=$?
5165+
grep -v '^ *+' conftest.er1 >conftest.err
5166+
rm -f conftest.er1
5167+
cat conftest.err >&5
5168+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5169+
(exit $ac_status); } && {
5170+
test -z "$ac_c_werror_flag" ||
5171+
test ! -s conftest.err
5172+
} && test -s conftest$ac_exeext &&
5173+
$as_test_x conftest$ac_exeext; then
5174+
ac_cv_lib_ffi_ffi_type_void=yes
5175+
else
5176+
echo "$as_me: failed program was:" >&5
5177+
sed 's/^/| /' conftest.$ac_ext >&5
5178+
5179+
ac_cv_lib_ffi_ffi_type_void=no
5180+
fi
5181+
5182+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5183+
conftest$ac_exeext conftest.$ac_ext
5184+
LIBS=$ac_check_lib_save_LIBS
5185+
fi
5186+
{ echo "$as_me:$LINENO: result: $ac_cv_lib_ffi_ffi_type_void" >&5
5187+
echo "${ECHO_T}$ac_cv_lib_ffi_ffi_type_void" >&6; }
5188+
if test $ac_cv_lib_ffi_ffi_type_void = yes; then
5189+
MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"
5190+
fi
5191+
5192+
51275193
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
51285194
-DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
5129-
MZSCHEME_SRC="if_mzsch.c"
5130-
MZSCHEME_OBJ="objects/if_mzsch.o"
5131-
MZSCHEME_PRO="if_mzsch.pro"
5132-
cat >>confdefs.h <<\_ACEOF
5195+
5196+
{ echo "$as_me:$LINENO: checking if compile and link flags for MzScheme are sane" >&5
5197+
echo $ECHO_N "checking if compile and link flags for MzScheme are sane... $ECHO_C" >&6; }
5198+
cflags_save=$CFLAGS
5199+
libs_save=$LIBS
5200+
CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
5201+
LIBS="$LIBS $MZSCHEME_LIBS"
5202+
cat >conftest.$ac_ext <<_ACEOF
5203+
/* confdefs.h. */
5204+
_ACEOF
5205+
cat confdefs.h >>conftest.$ac_ext
5206+
cat >>conftest.$ac_ext <<_ACEOF
5207+
/* end confdefs.h. */
5208+
5209+
int
5210+
main ()
5211+
{
5212+
5213+
;
5214+
return 0;
5215+
}
5216+
_ACEOF
5217+
rm -f conftest.$ac_objext conftest$ac_exeext
5218+
if { (ac_try="$ac_link"
5219+
case "(($ac_try" in
5220+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
5221+
*) ac_try_echo=$ac_try;;
5222+
esac
5223+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
5224+
(eval "$ac_link") 2>conftest.er1
5225+
ac_status=$?
5226+
grep -v '^ *+' conftest.er1 >conftest.err
5227+
rm -f conftest.er1
5228+
cat conftest.err >&5
5229+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
5230+
(exit $ac_status); } && {
5231+
test -z "$ac_c_werror_flag" ||
5232+
test ! -s conftest.err
5233+
} && test -s conftest$ac_exeext &&
5234+
$as_test_x conftest$ac_exeext; then
5235+
{ echo "$as_me:$LINENO: result: yes" >&5
5236+
echo "${ECHO_T}yes" >&6; }; mzs_ok=yes
5237+
else
5238+
echo "$as_me: failed program was:" >&5
5239+
sed 's/^/| /' conftest.$ac_ext >&5
5240+
5241+
{ echo "$as_me:$LINENO: result: no: MZSCHEME DISABLED" >&5
5242+
echo "${ECHO_T}no: MZSCHEME DISABLED" >&6; }; mzs_ok=no
5243+
fi
5244+
5245+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
5246+
conftest$ac_exeext conftest.$ac_ext
5247+
CFLAGS=$cflags_save
5248+
LIBS=$libs_save
5249+
if test $mzs_ok = yes; then
5250+
MZSCHEME_SRC="if_mzsch.c"
5251+
MZSCHEME_OBJ="objects/if_mzsch.o"
5252+
MZSCHEME_PRO="if_mzsch.pro"
5253+
cat >>confdefs.h <<\_ACEOF
51335254
#define FEAT_MZSCHEME 1
51345255
_ACEOF
51355256

5257+
else
5258+
MZSCHEME_CFLAGS=
5259+
MZSCHEME_LIBS=
5260+
MZSCHEME_EXTRA=
5261+
MZSCHEME_MZC=
5262+
fi
51365263
fi
51375264

51385265

src/buffer.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5323,18 +5323,14 @@ buf_spname(buf)
53235323
#if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
53245324
if (bt_quickfix(buf))
53255325
{
5326-
win_T *win = NULL;
5326+
win_T *win;
53275327
tabpage_T *tp;
53285328

53295329
/*
53305330
* For location list window, w_llist_ref points to the location list.
53315331
* For quickfix window, w_llist_ref is NULL.
53325332
*/
5333-
FOR_ALL_TAB_WINDOWS(tp, win)
5334-
if (win->w_buffer == buf)
5335-
goto win_found;
5336-
win_found:
5337-
if (win != NULL && win->w_llist_ref != NULL)
5333+
if (find_win_for_buf(buf, &win, &tp) == OK && win->w_llist_ref != NULL)
53385334
return (char_u *)_(msg_loclist);
53395335
else
53405336
return (char_u *)_(msg_qflist);
@@ -5355,6 +5351,28 @@ buf_spname(buf)
53555351
return NULL;
53565352
}
53575353

5354+
#if (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
5355+
|| defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \
5356+
|| defined(PROTO)
5357+
/*
5358+
* Find a window for buffer "buf".
5359+
* If found OK is returned and "wp" and "tp" are set to the window and tabpage.
5360+
* If not found FAIL is returned.
5361+
*/
5362+
int
5363+
find_win_for_buf(buf, wp, tp)
5364+
buf_T *buf;
5365+
win_T **wp;
5366+
tabpage_T **tp;
5367+
{
5368+
FOR_ALL_TAB_WINDOWS(*tp, *wp)
5369+
if ((*wp)->w_buffer == buf)
5370+
goto win_found;
5371+
return FAIL;
5372+
win_found:
5373+
return OK;
5374+
}
5375+
#endif
53585376

53595377
#if defined(FEAT_SIGNS) || defined(PROTO)
53605378
/*

src/configure.in

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,12 +716,34 @@ if test "$enable_mzschemeinterp" = "yes"; then
716716
AC_MSG_RESULT(not needed)
717717
fi
718718

719+
dnl On Ubuntu this fixes "undefined reference to symbol 'ffi_type_void'".
720+
AC_CHECK_LIB(ffi, ffi_type_void, [MZSCHEME_LIBS="$MZSCHEME_LIBS -lffi"])
721+
719722
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
720723
-DMZSCHEME_COLLECTS='\"${SCHEME_COLLECTS}collects\"'"
721-
MZSCHEME_SRC="if_mzsch.c"
722-
MZSCHEME_OBJ="objects/if_mzsch.o"
723-
MZSCHEME_PRO="if_mzsch.pro"
724-
AC_DEFINE(FEAT_MZSCHEME)
724+
725+
dnl Test that we can compile a simple program with these CFLAGS and LIBS.
726+
AC_MSG_CHECKING([if compile and link flags for MzScheme are sane])
727+
cflags_save=$CFLAGS
728+
libs_save=$LIBS
729+
CFLAGS="$CFLAGS $MZSCHEME_CFLAGS"
730+
LIBS="$LIBS $MZSCHEME_LIBS"
731+
AC_TRY_LINK(,[ ],
732+
AC_MSG_RESULT(yes); mzs_ok=yes,
733+
AC_MSG_RESULT(no: MZSCHEME DISABLED); mzs_ok=no)
734+
CFLAGS=$cflags_save
735+
LIBS=$libs_save
736+
if test $mzs_ok = yes; then
737+
MZSCHEME_SRC="if_mzsch.c"
738+
MZSCHEME_OBJ="objects/if_mzsch.o"
739+
MZSCHEME_PRO="if_mzsch.pro"
740+
AC_DEFINE(FEAT_MZSCHEME)
741+
else
742+
MZSCHEME_CFLAGS=
743+
MZSCHEME_LIBS=
744+
MZSCHEME_EXTRA=
745+
MZSCHEME_MZC=
746+
fi
725747
fi
726748
AC_SUBST(MZSCHEME_SRC)
727749
AC_SUBST(MZSCHEME_OBJ)

src/gui_w48.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,13 +2529,13 @@ gui_mch_update_tabline(void)
25292529
while (nr < TabCtrl_GetItemCount(s_tabhwnd))
25302530
TabCtrl_DeleteItem(s_tabhwnd, nr);
25312531

2532-
if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
2533-
TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
2534-
25352532
/* Re-enable redraw and redraw. */
25362533
SendMessage(s_tabhwnd, WM_SETREDRAW, (WPARAM)TRUE, 0);
25372534
RedrawWindow(s_tabhwnd, NULL, NULL,
25382535
RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
2536+
2537+
if (TabCtrl_GetCurSel(s_tabhwnd) != curtabidx)
2538+
TabCtrl_SetCurSel(s_tabhwnd, curtabidx);
25392539
}
25402540

25412541
/*
@@ -2548,8 +2548,8 @@ gui_mch_set_curtab(nr)
25482548
if (s_tabhwnd == NULL)
25492549
return;
25502550

2551-
if (TabCtrl_GetCurSel(s_tabhwnd) != nr -1)
2552-
TabCtrl_SetCurSel(s_tabhwnd, nr -1);
2551+
if (TabCtrl_GetCurSel(s_tabhwnd) != nr - 1)
2552+
TabCtrl_SetCurSel(s_tabhwnd, nr - 1);
25532553
}
25542554

25552555
#endif

src/if_py_both.h

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3997,30 +3997,43 @@ SetBufferLineList(
39973997
static int
39983998
InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
39993999
{
4000+
buf_T *save_curbuf = NULL;
4001+
win_T *wp;
4002+
win_T *save_curwin = NULL;
4003+
tabpage_T *tp;
4004+
tabpage_T *save_curtab = NULL;
4005+
40004006
/* First of all, we check the type of the supplied Python object.
40014007
* It must be a string or a list, or the call is in error.
40024008
*/
40034009
if (PyBytes_Check(lines) || PyUnicode_Check(lines))
40044010
{
4005-
char *str = StringToLine(lines);
4006-
buf_T *savebuf;
4011+
char *str = StringToLine(lines);
40074012

40084013
if (str == NULL)
40094014
return FAIL;
40104015

40114016
PyErr_Clear();
40124017
VimTryStart();
4013-
switch_buffer(&savebuf, buf);
4018+
if (find_win_for_buf(buf, &wp, &tp) == FAIL
4019+
|| switch_win(&save_curwin, &save_curtab, wp, tp, TRUE)
4020+
== FAIL)
4021+
switch_buffer(&save_curbuf, buf);
40144022

4015-
if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
4023+
if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
40164024
RAISE_UNDO_FAIL;
40174025
else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
40184026
RAISE_INSERT_LINE_FAIL;
4019-
else
4027+
else if (save_curbuf == NULL)
4028+
/* Only adjust marks if we managed to switch to a window that
4029+
* holds the buffer, otherwise line numbers will be invalid. */
40204030
appended_lines_mark((linenr_T)n, 1L);
40214031

40224032
vim_free(str);
4023-
restore_buffer(savebuf);
4033+
if (save_curbuf == NULL)
4034+
restore_win(save_curwin, save_curtab, TRUE);
4035+
else
4036+
restore_buffer(save_curbuf);
40244037
update_screen(VALID);
40254038

40264039
if (VimTryEnd())
@@ -4036,7 +4049,6 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
40364049
PyInt i;
40374050
PyInt size = PyList_Size(lines);
40384051
char **array;
4039-
buf_T *savebuf;
40404052

40414053
array = PyMem_New(char *, size);
40424054
if (array == NULL)
@@ -4061,7 +4073,10 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
40614073

40624074
PyErr_Clear();
40634075
VimTryStart();
4064-
switch_buffer(&savebuf, buf);
4076+
if (find_win_for_buf(buf, &wp, &tp) == FAIL
4077+
|| switch_win(&save_curwin, &save_curtab, wp, tp, TRUE)
4078+
== FAIL)
4079+
switch_buffer(&save_curbuf, buf);
40654080

40664081
if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
40674082
RAISE_UNDO_FAIL;
@@ -4087,11 +4102,13 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change)
40874102
}
40884103

40894104
/* Free the array of lines. All of its contents have now
4090-
* been freed.
4091-
*/
4105+
* been freed. */
40924106
PyMem_Free(array);
40934107

4094-
restore_buffer(savebuf);
4108+
if (save_curbuf == NULL)
4109+
restore_win(save_curwin, save_curtab, TRUE);
4110+
else
4111+
restore_buffer(save_curbuf);
40954112
update_screen(VALID);
40964113

40974114
if (VimTryEnd())

src/proto/buffer.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void do_modelines __ARGS((int flags));
5252
int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
5353
void write_viminfo_bufferlist __ARGS((FILE *fp));
5454
char_u *buf_spname __ARGS((buf_T *buf));
55+
int find_win_for_buf __ARGS((buf_T *buf, win_T **wp, tabpage_T **tp));
5556
void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
5657
linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
5758
int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));

0 commit comments

Comments
 (0)