From 98d113300fdc1f749d1acf8458eea630e78cc951 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 09:30:34 +0000 Subject: [PATCH 01/22] updated for version 7.2-246 --- runtime/doc/if_cscop.txt | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 3d98e4a185..c8f9995635 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -481,7 +481,8 @@ bit of code) was adapted from the cscope interface in nvi. Please report any problems, suggestions, patches, et al., you have for the usage of cscope within Vim to him. *cscope-win32* -For a cscope version for Win32 see: http://iamphet.nm.ru/cscope/index.html +For a cscope version for Win32 see: + http://code.google.com/p/cscope-win32/ Win32 support was added by Sergey Khorev . Contact him if you have Win32-specific issues. diff --git a/src/version.c b/src/version.c index b5ae11220c..a6d959115f 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 246, /**/ 245, /**/ From 6a36ea9a4f85e954bb6b61a74ef9eb8e800e7f9f Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 10:21:41 +0000 Subject: [PATCH 02/22] updated for version 7.2-247 --- src/if_mzsch.c | 8 +++++--- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/if_mzsch.c b/src/if_mzsch.c index bc3dd6bf59..d2d9617a76 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -635,8 +635,10 @@ dynamic_mzscheme_end(void) #endif /* DYNAMIC_MZSCHEME */ /* need to put it here for dynamic stuff to work */ -#ifdef INCLUDE_MZSCHEME_BASE +#if defined(INCLUDE_MZSCHEME_BASE) # include "mzscheme_base.c" +#elif MZSCHEME_VERSION_MAJOR >= 400 +# error MzScheme 4.x must include mzscheme_base.c, for MinGW32 you need to define MZSCHEME_GENERATE_BASE=yes #endif /* @@ -875,14 +877,14 @@ startup_mzscheme(void) #ifdef INCLUDE_MZSCHEME_BASE { /* - * versions 4.x do not provide Scheme bindings by defaults + * versions 4.x do not provide Scheme bindings by default * we need to add them explicitly */ Scheme_Object *scheme_base_symbol = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, scheme_base_symbol); MZ_GC_REG(); - /* invoke function from generated and included base.c */ + /* invoke function from generated and included mzscheme_base.c */ declare_modules(environment); scheme_base_symbol = scheme_intern_symbol("scheme/base"); MZ_GC_CHECK(); diff --git a/src/version.c b/src/version.c index a6d959115f..767152e50f 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 247, /**/ 246, /**/ From e33ea649524bc1482b56e617e28528958ad18d5f Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 10:49:58 +0000 Subject: [PATCH 03/22] updated for version 7.2-248 --- src/Make_cyg.mak | 32 +++++++++++++++++++++++++++++++- src/Make_ming.mak | 5 ++++- src/Make_mvc.mak | 1 + src/version.c | 2 ++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index eaf7309837..0a869dc122 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -212,13 +212,34 @@ ifndef MZSCHEME_VER MZSCHEME_VER = 209_000 endif +ifndef MZSCHEME_PRECISE_GC +MZSCHEME_PRECISE_GC=no +endif + +# for version 4.x we need to generate byte-code for Scheme base +ifndef MZSCHEME_GENERATE_BASE +MZSCHEME_GENERATE_BASE=no +endif + ifeq (yes, $(DYNAMIC_MZSCHEME)) DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" else ifndef MZSCHEME_DLLS MZSCHEME_DLLS = $(MZSCHEME) endif -EXTRA_LIBS += -L$(MZSCHEME_DLLS) -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER) +else +MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) +endif +EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB) +endif +ifeq (yes,$(MZSCHEME_GENERATE_BASE)) +DEFINES += -DINCLUDE_MZSCHEME_BASE +MZ_EXTRA_DEP += mzscheme_base.c +endif +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +DEFINES += -DMZ_PRECISE_GC endif endif @@ -472,6 +493,9 @@ clean: -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe ifdef PERL -$(DEL) if_perl.c +endif +ifdef MZSCHEME + -$(DEL) mzscheme_base.c endif -$(DEL) pathdef.c $(MAKE) -C xxd -f Make_cyg.mak clean @@ -523,9 +547,15 @@ endif $(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP) $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o +$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) + $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o + $(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o +mzscheme_base.c: + $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base + pathdef.c: $(INCL) ifneq (sh.exe, $(SHELL)) @echo creating pathdef.c diff --git a/src/Make_ming.mak b/src/Make_ming.mak index e0717b62ae..ae28a3d47c 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -135,7 +135,7 @@ endif ifndef MZSCHEME_DLLS MZSCHEME_DLLS=$(MZSCHEME) endif -MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) +MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib endif endif @@ -562,6 +562,9 @@ clean: -$(DEL) pathdef.c ifdef PERL -$(DEL) if_perl.c +endif +ifdef MZSCHEME + -$(DEL) mzscheme_base.c endif $(MAKE) -C GvimExt -f Make_ming.mak clean $(MAKE) -C xxd -f Make_cyg.mak clean diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 72e722b426..15a14ade10 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -865,6 +865,7 @@ clean: - if exist dimm_i.c del dimm_i.c - if exist dimm.tlb del dimm.tlb - if exist dosinst.exe del dosinst.exe + - if exist mzscheme_base.c del mzscheme_base.c cd xxd $(MAKE) /NOLOGO -f Make_mvc.mak clean cd .. diff --git a/src/version.c b/src/version.c index 767152e50f..5a34c87902 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 248, /**/ 247, /**/ From d2d8135617b6f6034d0862cd470cd58db480d2dd Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 11:00:05 +0000 Subject: [PATCH 04/22] updated for version 7.2-249 --- src/po/check.vim | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/po/check.vim b/src/po/check.vim index abe999a4f1..b4d50f187e 100644 --- a/src/po/check.vim +++ b/src/po/check.vim @@ -23,6 +23,9 @@ func! GetMline() " remove '%', not used for formatting. let idline = substitute(idline, "'%'", '', 'g') + " remove '%' used for plural forms. + let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '') + " remove everything but % items. return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g') endfunc diff --git a/src/version.c b/src/version.c index 5a34c87902..30b7759fb4 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 249, /**/ 248, /**/ From 2a1aff523b47b905dda52ed5967c4a30235a5e60 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 11:26:56 +0000 Subject: [PATCH 05/22] updated for version 7.2-250 --- src/GvimExt/gvimext.cpp | 4 +++- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp index d317e2fff5..71d180ef91 100644 --- a/src/GvimExt/gvimext.cpp +++ b/src/GvimExt/gvimext.cpp @@ -635,7 +635,9 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, } // Now concatenate strncpy(temp, _("Edit with existing Vim - "), BUFSIZE - 1); - strncat(temp, title, BUFSIZE - 1); + temp[BUFSIZE - 1] = '\0'; + strncat(temp, title, BUFSIZE - 1 - strlen(temp)); + temp[BUFSIZE - 1] = '\0'; InsertMenu(hMenu, indexMenu++, MF_STRING|MF_BYPOSITION, diff --git a/src/version.c b/src/version.c index 30b7759fb4..b0318481c9 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 250, /**/ 249, /**/ From 2688634afbf0db67774163f550e1fac3d4f4da2c Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 11:44:54 +0000 Subject: [PATCH 06/22] updated for version 7.2-251 --- src/auto/configure | 2 +- src/configure.in | 2 +- src/version.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index 1049c0ceb3..85d7da5641 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -17135,7 +17135,7 @@ $as_echo "no" >&6; } { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5 $as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; } if test "$gccmajor" -gt "3"; then - CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" + CFLAGS=`echo "$CFLAGS -D_FORTIFY_SOURCE=1" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g' -e 's/-D_FORTIFY_SOURCE=2//g'` { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else diff --git a/src/configure.in b/src/configure.in index 1ad32d7a3a..fa58c6e750 100644 --- a/src/configure.in +++ b/src/configure.in @@ -3233,7 +3233,7 @@ if test "$GCC" = yes; then dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1) if test "$gccmajor" -gt "3"; then - CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1" + CFLAGS=`echo "$CFLAGS -D_FORTIFY_SOURCE=1" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g' -e 's/-D_FORTIFY_SOURCE=2//g'` AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) diff --git a/src/version.c b/src/version.c index b0318481c9..16e319d1d4 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 251, /**/ 250, /**/ From f6785cd6c8823b87cf75a7f1d83ec544ac56b07b Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 12:02:34 +0000 Subject: [PATCH 07/22] updated for version 7.2-252 --- src/charset.c | 5 +++++ src/version.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/charset.c b/src/charset.c index bac1a20ffe..0535d4cfca 100644 --- a/src/charset.c +++ b/src/charset.c @@ -174,6 +174,11 @@ buf_init_chartab(buf, global) if (VIM_ISDIGIT(*p)) c = getdigits(&p); else +#ifdef FEAT_MBYTE + if (has_mbyte) + c = mb_ptr2char_adv(&p); + else +#endif c = *p++; c2 = -1; if (*p == '-' && p[1] != NUL) diff --git a/src/version.c b/src/version.c index 16e319d1d4..70124e9f30 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 252, /**/ 251, /**/ From 9539d1240e00d6708a7e5ea3b4e8140df49170d4 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 12:19:51 +0000 Subject: [PATCH 08/22] updated for version 7.2-253 --- src/netbeans.c | 18 ++++++++++++------ src/version.c | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/netbeans.c b/src/netbeans.c index 9716329070..b013d7780e 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -1499,7 +1499,8 @@ nb_do_cmd( return FAIL; } first = *pos; - nbdebug((" FIRST POS: line %d, col %d\n", first.lnum, first.col)); + nbdebug((" FIRST POS: line %d, col %d\n", + first.lnum, first.col)); pos = off2pos(buf->bufp, off+count-1); if (!pos) { @@ -1510,7 +1511,8 @@ nb_do_cmd( return FAIL; } last = *pos; - nbdebug((" LAST POS: line %d, col %d\n", last.lnum, last.col)); + nbdebug((" LAST POS: line %d, col %d\n", + last.lnum, last.col)); del_from_lnum = first.lnum; del_to_lnum = last.lnum; doupdate = 1; @@ -1521,7 +1523,8 @@ nb_do_cmd( next = off2pos(buf->bufp, off + count); /* Remove part of the first line. */ - if (first.col != 0 || (next != NULL && first.lnum == next->lnum)) + if (first.col != 0 + || (next != NULL && first.lnum == next->lnum)) { if (first.lnum != last.lnum || (next != NULL && first.lnum != next->lnum)) @@ -1584,7 +1587,8 @@ nb_do_cmd( int id = buf_findsign_id(buf->bufp, (linenr_T)i); if (id > 0) { - nbdebug((" Deleting sign %d on line %d\n", id, i)); + nbdebug((" Deleting sign %d on line %d\n", + id, i)); buf_delsign(buf->bufp, id); } else @@ -1593,7 +1597,8 @@ nb_do_cmd( } } - nbdebug((" Deleting lines %d through %d\n", del_from_lnum, del_to_lnum)); + nbdebug((" Deleting lines %d through %d\n", + del_from_lnum, del_to_lnum)); curwin->w_cursor.lnum = del_from_lnum; curwin->w_cursor.col = 0; del_lines(del_to_lnum - del_from_lnum + 1, FALSE); @@ -3514,7 +3519,8 @@ get_buf_size(buf_T *bufp) eol_size = 1; for (lnum = 1; lnum <= bufp->b_ml.ml_line_count; ++lnum) { - char_count += (long)STRLEN(ml_get(lnum)) + eol_size; + char_count += (long)STRLEN(ml_get_buf(bufp, lnum, FALSE)) + + eol_size; /* Check for a CTRL-C every 100000 characters */ if (char_count > last_check) { diff --git a/src/version.c b/src/version.c index 70124e9f30..9d05ca9d14 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 253, /**/ 252, /**/ From c8d08d3d531c60b3d3cf092b1e18736f80239a4b Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 13:04:24 +0000 Subject: [PATCH 09/22] updated for version 7.2-254 --- src/fileio.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index a9552b558b..46d364a67e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4568,7 +4568,7 @@ restore_backup: c = TRUE; if (write_info.bw_conv_error_lnum != 0) { - int l = STRLEN(IObuff); + size_t l = STRLEN(IObuff); vim_snprintf((char *)IObuff + l, IOSIZE - l, _(" in line %ld;"), (long)write_info.bw_conv_error_lnum); } diff --git a/src/version.c b/src/version.c index 9d05ca9d14..612f715649 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 254, /**/ 253, /**/ From 554448b77f3c85871fcd6f889ccc6e3215668566 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 13:20:33 +0000 Subject: [PATCH 10/22] updated for version 7.2-255 --- src/option.c | 18 ++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/option.c b/src/option.c index 0f69322c28..d680cfb1fd 100644 --- a/src/option.c +++ b/src/option.c @@ -7430,6 +7430,8 @@ set_bool_option(opt_idx, varp, value, opt_flags) { if (curwin->w_p_wrap) curwin->w_leftcol = 0; + if (curwin->w_curswant != MAXCOL) + curwin->w_set_curswant = TRUE; } #ifdef FEAT_WINDOWS @@ -7664,6 +7666,22 @@ set_bool_option(opt_idx, varp, value, opt_flags) } #endif +#ifdef FEAT_LINEBREAK + if ((int *)varp == &curwin->w_p_lbr) + { + if (curwin->w_curswant != MAXCOL) + curwin->w_set_curswant = TRUE; + } +#endif + +#ifdef FEAT_RIGHTLEFT + if ((int *)varp == &curwin->w_p_rl) + { + if (curwin->w_curswant != MAXCOL) + curwin->w_set_curswant = TRUE; + } +#endif + /* * End of handling side effects for bool options. */ diff --git a/src/version.c b/src/version.c index 612f715649..17a4d5f8f9 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 255, /**/ 254, /**/ From 5f972f11ac1ce7411aba1d758f45ae4859db4e63 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 13:46:41 +0000 Subject: [PATCH 11/22] updated for version 7.2-256 --- src/gui_gtk_x11.c | 6 ++++++ src/version.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 33fdaed485..5281453d5b 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -4729,6 +4729,9 @@ gui_mch_font_dialog(char_u *oldval) if (oldval != NULL && *oldval != NUL) gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG(gui.fontdlg), (char *)oldval); + else + gtk_font_selection_dialog_set_font_name( + GTK_FONT_SELECTION_DIALOG(gui.fontdlg), DEFAULT_FONT); if (gui.fontname) { @@ -4816,6 +4819,9 @@ gui_mch_font_dialog(char_u *oldval) if (oldname != oldval) vim_free(oldname); } + else + gtk_font_selection_dialog_set_font_name( + GTK_FONT_SELECTION_DIALOG(dialog), DEFAULT_FONT); response = gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/src/version.c b/src/version.c index 17a4d5f8f9..d4f0b4b99b 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 256, /**/ 255, /**/ From 49a5d8fbabe7c6fb1beffa1df4b8556423ef3261 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 14:17:54 +0000 Subject: [PATCH 12/22] updated for version 7.2-257 --- src/gui_gtk_f.c | 8 +++----- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c index d88499e256..ccf54ece97 100644 --- a/src/gui_gtk_f.c +++ b/src/gui_gtk_f.c @@ -860,11 +860,9 @@ gtk_form_main_filter(GdkXEvent *gdk_xevent, gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static) { #ifdef HAVE_GTK2 - gboolean static_gravity_supported; - - static_gravity_supported = gdk_window_set_static_gravities(window, - use_static); - g_return_if_fail(static_gravity_supported); + /* We don't check if static gravity is actually supported, because it + * results in an annoying assertion error message. */ + gdk_window_set_static_gravities(window, use_static); #else XSetWindowAttributes xattributes; diff --git a/src/version.c b/src/version.c index d4f0b4b99b..be50d62b99 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 257, /**/ 256, /**/ From 0b5eab9c8906be827133620a736baad109a3de2d Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 14:48:27 +0000 Subject: [PATCH 13/22] updated for version 7.2-258 --- src/ui.c | 7 +++---- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui.c b/src/ui.c index aa8a8ac49f..df8008c840 100644 --- a/src/ui.c +++ b/src/ui.c @@ -3055,18 +3055,17 @@ vcol2col(wp, lnum, vcol) int vcol; { /* try to advance to the specified column */ - int col = 0; int count = 0; char_u *ptr; + char_u *start; - ptr = ml_get_buf(wp->w_buffer, lnum, FALSE); + start = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE); while (count <= vcol && *ptr != NUL) { - ++col; count += win_lbr_chartabsize(wp, ptr, count, NULL); mb_ptr_adv(ptr); } - return col; + return (int)(ptr - start); } #endif diff --git a/src/version.c b/src/version.c index be50d62b99..654b350288 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 258, /**/ 257, /**/ From 49c9e43d59956cb106b78035e328385a44252a15 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 11 Sep 2009 15:24:31 +0000 Subject: [PATCH 14/22] updated for version 7.2-259 --- src/fileio.c | 14 +++++--------- src/testdir/Makefile | 2 +- src/testdir/test67.in | 33 +++++++++++++++++++++++++++++++++ src/testdir/test67.ok | 10 ++++++++++ src/version.c | 2 ++ 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/testdir/test67.in create mode 100644 src/testdir/test67.ok diff --git a/src/fileio.c b/src/fileio.c index 46d364a67e..5deb1a3984 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -9498,15 +9498,10 @@ au_exists(arg) ap = first_autopat[(int)event]; if (ap == NULL) goto theend; - if (pattern == NULL) - { - retval = TRUE; - goto theend; - } /* if pattern is "", special handling is needed which uses curbuf */ /* for pattern ", fnamecmp() will work fine */ - if (STRICMP(pattern, "") == 0) + if (pattern != NULL && STRICMP(pattern, "") == 0) buflocal_buf = curbuf; /* Check if there is an autocommand with the given pattern. */ @@ -9515,9 +9510,10 @@ au_exists(arg) /* For buffer-local autocommands, fnamecmp() works fine. */ if (ap->pat != NULL && ap->cmds != NULL && (group == AUGROUP_ALL || ap->group == group) - && (buflocal_buf == NULL - ? fnamecmp(ap->pat, pattern) == 0 - : ap->buflocal_nr == buflocal_buf->b_fnum)) + && (pattern == NULL + || (buflocal_buf == NULL + ? fnamecmp(ap->pat, pattern) == 0 + : ap->buflocal_nr == buflocal_buf->b_fnum))) { retval = TRUE; break; diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 50386ec775..8f9fd13561 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -22,7 +22,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test48.out test49.out test51.out test52.out test53.out \ test54.out test55.out test56.out test57.out test58.out \ test59.out test60.out test61.out test62.out test63.out \ - test64.out test65.out test66.out + test64.out test65.out test66.out test67.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test67.in b/src/testdir/test67.in new file mode 100644 index 0000000000..08b4e3701f --- /dev/null +++ b/src/testdir/test67.in @@ -0,0 +1,33 @@ +Test that groups and patterns are tested correctly when calling exists() for +autocommands. + +STARTTEST +:so small.vim +:let results=[] +:augroup auexists +:augroup END +:call add(results, "##BufEnter: " . exists("##BufEnter")) +:call add(results, "#BufEnter: " . exists("#BufEnter")) +:au BufEnter * let g:entered=1 +:call add(results, "#BufEnter: " . exists("#BufEnter")) +:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) +:augroup auexists +:au BufEnter * let g:entered=1 +:augroup END +:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) +:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) +:au BufEnter *.test let g:entered=1 +:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) +:edit testfile.test +:call add(results, "#BufEnter#: " . exists("#BufEnter#")) +:au BufEnter let g:entered=1 +:call add(results, "#BufEnter#: " . exists("#BufEnter#")) +:edit testfile2.test +:call add(results, "#BufEnter#: " . exists("#BufEnter#")) +:e test.out +:call append(0, results) +:$d +:w +:qa! +ENDTEST + diff --git a/src/testdir/test67.ok b/src/testdir/test67.ok new file mode 100644 index 0000000000..51188e5afd --- /dev/null +++ b/src/testdir/test67.ok @@ -0,0 +1,10 @@ +##BufEnter: 1 +#BufEnter: 0 +#BufEnter: 1 +#auexists#BufEnter: 0 +#auexists#BufEnter: 1 +#BufEnter#*.test: 0 +#BufEnter#*.test: 1 +#BufEnter#: 0 +#BufEnter#: 1 +#BufEnter#: 0 diff --git a/src/version.c b/src/version.c index 654b350288..f88a757c6b 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 259, /**/ 258, /**/ From baeec8addc9c0afd33744e560b08a41f0a764ef2 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 18 Sep 2009 12:59:26 +0000 Subject: [PATCH 15/22] updated for version 7.2-260 --- src/testdir/Make_amiga.mak | 3 ++- src/testdir/Make_dos.mak | 2 +- src/testdir/Make_ming.mak | 2 +- src/testdir/Make_os2.mak | 2 +- src/testdir/Make_vms.mms | 4 ++-- src/version.c | 2 ++ 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 50f4141cff..a3eb5a6c4a 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test48.out test51.out test53.out test54.out test55.out \ test56.out test57.out test58.out test59.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ - test66.out + test66.out test67.out .SUFFIXES: .in .out @@ -112,3 +112,4 @@ test63.out: test63.in test64.out: test64.in test65.out: test65.in test66.out: test66.in +test67.out: test67.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index efe75685f1..7bc79996f8 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -26,7 +26,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test15.out test17.out test18.out test21.out test26.out \ test30.out test31.out test32.out test33.out test34.out \ test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out + test42.out test52.out test65.out test66.out test67.out SCRIPTS32 = test50.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 3ed77e5744..2d4e6ab242 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -45,7 +45,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test15.out test17.out test18.out test21.out test26.out \ test30.out test31.out test32.out test33.out test34.out \ test37.out test38.out test39.out test40.out test41.out \ - test42.out test52.out test65.out test66.out + test42.out test52.out test65.out test66.out test67.out SCRIPTS32 = test50.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index e6696d87b3..221c287c99 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -26,7 +26,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test48.out test51.out test53.out test54.out test55.out \ test56.out test57.out test58.out test59.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ - test66.out + test66.out test67.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index dfc79dd8db..7733366a54 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2009 Mar 05 +# Last change: 2009 Sep 11 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -69,7 +69,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test48.out test51.out test53.out test54.out test55.out \ test56.out test57.out test60.out \ test61.out test62.out test63.out test64.out test65.out \ - test66.out + test66.out test67.out .IFDEF WANT_GUI SCRIPT_GUI = test16.out diff --git a/src/version.c b/src/version.c index f88a757c6b..ac86367b3a 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 260, /**/ 259, /**/ From 19314f214b64a0a82817cce9b98940b061f67974 Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 18 Sep 2009 13:17:09 +0000 Subject: [PATCH 16/22] updated for version 7.2-261 --- src/fold.c | 12 ++++++++---- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fold.c b/src/fold.c index 6567906be7..a127bf67cc 100644 --- a/src/fold.c +++ b/src/fold.c @@ -1607,11 +1607,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after) } else { - /* 2, 3, or 5: need to correct nested folds too */ - foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, - line2 - fp->fd_top, amount, amount_after); if (fp->fd_top < top) { + /* 2 or 3: need to correct nested folds too */ + foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, + line2 - fp->fd_top, amount, amount_after); if (last <= line2) { /* 2. fold contains line1, line2 is below fold */ @@ -1628,7 +1628,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after) } else { - /* 5. fold is below line1 and contains line2 */ + /* 5. fold is below line1 and contains line2; need to + * correct nested folds too */ + foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top, + line2 - fp->fd_top, amount, + amount_after + (fp->fd_top - top)); if (amount == MAXLNUM) { fp->fd_len -= line2 - fp->fd_top + 1; diff --git a/src/version.c b/src/version.c index ac86367b3a..9ccfc525cc 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 261, /**/ 260, /**/ From a81d84df1ffd0d034abbd417b809630bb49e7f7c Mon Sep 17 00:00:00 2001 From: vimboss Date: Fri, 18 Sep 2009 15:25:52 +0000 Subject: [PATCH 17/22] updated for version 7.2-262 --- src/ex_getln.c | 21 ++++++++++++--------- src/structs.h | 1 + src/version.c | 2 ++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ex_getln.c b/src/ex_getln.c index c9d8c3053a..153712887e 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3266,7 +3266,6 @@ nextwild(xp, type, options) int i, j; char_u *p1; char_u *p2; - int oldlen; int difflen; int v; @@ -3291,7 +3290,7 @@ nextwild(xp, type, options) out_flush(); i = (int)(xp->xp_pattern - ccline.cmdbuff); - oldlen = ccline.cmdpos - i; + xp->xp_pattern_len = ccline.cmdpos - i; if (type == WILD_NEXT || type == WILD_PREV) { @@ -3305,18 +3304,20 @@ nextwild(xp, type, options) /* * Translate string into pattern and expand it. */ - if ((p1 = addstar(&ccline.cmdbuff[i], oldlen, xp->xp_context)) == NULL) + if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, + xp->xp_context)) == NULL) p2 = NULL; else { - p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], oldlen), + p2 = ExpandOne(xp, p1, + vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len), WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE |options, type); vim_free(p1); /* longest match: make sure it is not shorter (happens with :help */ if (p2 != NULL && type == WILD_LONGEST) { - for (j = 0; j < oldlen; ++j) + for (j = 0; j < xp->xp_pattern_len; ++j) if (ccline.cmdbuff[i + j] == '*' || ccline.cmdbuff[i + j] == '?') break; @@ -3331,7 +3332,7 @@ nextwild(xp, type, options) if (p2 != NULL && !got_int) { - difflen = (int)STRLEN(p2) - oldlen; + difflen = (int)STRLEN(p2) - xp->xp_pattern_len; if (ccline.cmdlen + difflen > ccline.cmdbufflen - 4) { v = realloc_cmdbuff(ccline.cmdlen + difflen); @@ -3620,6 +3621,7 @@ ExpandInit(xp) expand_T *xp; { xp->xp_pattern = NULL; + xp->xp_pattern_len = 0; xp->xp_backslash = XP_BS_NONE; #ifndef BACKSLASH_IN_FILENAME xp->xp_shell = FALSE; @@ -4311,8 +4313,8 @@ expand_cmdline(xp, str, col, matchcount, matches) } /* add star to file name, or convert to regexp if not exp. files. */ - file_str = addstar(xp->xp_pattern, - (int)(str + col - xp->xp_pattern), xp->xp_context); + xp->xp_pattern_len = (int)(str + col - xp->xp_pattern); + file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); if (file_str == NULL) return EXPAND_UNSUCCESSFUL; @@ -4781,7 +4783,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file) sprintf((char *)num, "%d", ccline.cmdpos); args[1] = ccline.cmdbuff; } - args[0] = xp->xp_pattern; + args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); args[2] = num; /* Save the cmdline, we don't know what the function may do. */ @@ -4797,6 +4799,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file) if (ccline.cmdbuff != NULL) ccline.cmdbuff[ccline.cmdlen] = keep; + vim_free(args[0]); return ret; } diff --git a/src/structs.h b/src/structs.h index 137352d95d..99afecfcee 100644 --- a/src/structs.h +++ b/src/structs.h @@ -432,6 +432,7 @@ typedef struct expand { int xp_context; /* type of expansion */ char_u *xp_pattern; /* start of item to expand */ + int xp_pattern_len; /* bytes in xp_pattern before cursor */ #if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) char_u *xp_arg; /* completion function */ int xp_scriptID; /* SID for completion function */ diff --git a/src/version.c b/src/version.c index 9ccfc525cc..ae540d7d88 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 262, /**/ 261, /**/ From b07059a739b1642b84e2362c2990f6f506974f3c Mon Sep 17 00:00:00 2001 From: vimboss Date: Wed, 23 Sep 2009 15:35:48 +0000 Subject: [PATCH 18/22] updated for version 7.2-263 --- src/gui_gtk_x11.c | 17 ++++++++++++----- src/version.c | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 5281453d5b..cb50d030f3 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -4066,6 +4066,8 @@ gui_mch_open(void) { guicolor_T fg_pixel = INVALCOLOR; guicolor_T bg_pixel = INVALCOLOR; + guint pixel_width; + guint pixel_height; #ifdef HAVE_GTK2 /* @@ -4106,8 +4108,6 @@ gui_mch_open(void) unsigned int w, h; int x = 0; int y = 0; - guint pixel_width; - guint pixel_height; mask = XParseGeometry((char *)gui.geom, &x, &y, &w, &h); @@ -4160,9 +4160,16 @@ gui_mch_open(void) } } - gtk_form_set_size(GTK_FORM(gui.formwin), - (guint)(gui_get_base_width() + Columns * gui.char_width), - (guint)(gui_get_base_height() + Rows * gui.char_height)); + pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width); + pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height); +#ifdef HAVE_GTK2 + /* For GTK2 changing the size of the form widget doesn't cause window + * resizing. */ + if (gtk_socket_id == 0) + gtk_window_resize(GTK_WINDOW(gui.mainwin), pixel_width, pixel_height); +#else + gtk_form_set_size(GTK_FORM(gui.formwin), pixel_width, pixel_height); +#endif update_window_manager_hints(0, 0); if (foreground_argument != NULL) diff --git a/src/version.c b/src/version.c index ae540d7d88..1f3f201dbc 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 263, /**/ 262, /**/ From ed554372035a6b16a2ed7e46e502248d96105918 Mon Sep 17 00:00:00 2001 From: vimboss Date: Wed, 23 Sep 2009 16:14:49 +0000 Subject: [PATCH 19/22] updated for version 7.2-264 --- src/gui.c | 33 +++++++++++++++++++++++++++++++-- src/gui_gtk_x11.c | 23 +++++++++++++++++++++++ src/proto/gui_gtk_x11.pro | 2 ++ src/version.c | 2 ++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/gui.c b/src/gui.c index c25f760ea7..48e7b0fb08 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1386,6 +1386,10 @@ gui_set_shellsize(mustset, fit_to_display, direction) int min_height; int screen_w; int screen_h; +#ifdef HAVE_GTK2 + int un_maximize = mustset; + int did_adjust = 0; +#endif if (!gui.shell_created) return; @@ -1425,22 +1429,47 @@ gui_set_shellsize(mustset, fit_to_display, direction) if (Columns < MIN_COLUMNS) Columns = MIN_COLUMNS; width = Columns * gui.char_width + base_width; +#ifdef HAVE_GTK2 + ++did_adjust; +#endif } if ((direction & RESIZE_VERT) && height > screen_h) { Rows = (screen_h - base_height) / gui.char_height; check_shellsize(); height = Rows * gui.char_height + base_height; +#ifdef HAVE_GTK2 + ++did_adjust; +#endif } +#ifdef HAVE_GTK2 + if (did_adjust == 2 || (width + gui.char_width >= screen_w + && height + gui.char_height >= screen_h)) + /* don't unmaximize if at maximum size */ + un_maximize = FALSE; +#endif } gui.num_cols = Columns; gui.num_rows = Rows; min_width = base_width + MIN_COLUMNS * gui.char_width; min_height = base_height + MIN_LINES * gui.char_height; -# ifdef FEAT_WINDOWS +#ifdef FEAT_WINDOWS min_height += tabline_height() * gui.char_height; -# endif +#endif + +#ifdef HAVE_GTK2 + if (un_maximize) + { + /* If the window size is smaller than the screen unmaximize the + * window, otherwise resizing won't work. */ + gui_mch_get_screen_dimensions(&screen_w, &screen_h); + if ((width + gui.char_width < screen_w + || height + gui.char_height * 2 < screen_h) + && gui_mch_maximized()) + gui_mch_unmaximize(); + } +#endif gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction); diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index cb50d030f3..ad6fc25e1d 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -4376,6 +4376,29 @@ force_shell_resize_idle(gpointer data) #endif #endif /* HAVE_GTK2 */ +#if defined(HAVE_GTK2) || defined(PROTO) +/* + * Return TRUE if the main window is maximized. + */ + int +gui_mch_maximized() +{ + return (gui.mainwin != NULL && gui.mainwin->window != NULL + && (gdk_window_get_state(gui.mainwin->window) + & GDK_WINDOW_STATE_MAXIMIZED)); +} + +/* + * Unmaximize the main window + */ + void +gui_mch_unmaximize() +{ + if (gui.mainwin != NULL) + gtk_window_unmaximize(GTK_WINDOW(gui.mainwin)); +} +#endif + /* * Set the windows size. */ diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro index 87ff6da407..93b65bf726 100644 --- a/src/proto/gui_gtk_x11.pro +++ b/src/proto/gui_gtk_x11.pro @@ -16,6 +16,8 @@ int gui_mch_open __ARGS((void)); void gui_mch_exit __ARGS((int rc)); int gui_mch_get_winpos __ARGS((int *x, int *y)); void gui_mch_set_winpos __ARGS((int x, int y)); +int gui_mch_maximized __ARGS((void)); +void gui_mch_unmaximize __ARGS((void)); void gui_mch_set_shellsize __ARGS((int width, int height, int min_width, int min_height, int base_width, int base_height, int direction)); void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); void gui_mch_settitle __ARGS((char_u *title, char_u *icon)); diff --git a/src/version.c b/src/version.c index 1f3f201dbc..3633057d3c 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 264, /**/ 263, /**/ From e411119903bc93dfb800d2694748957e036eb984 Mon Sep 17 00:00:00 2001 From: vimboss Date: Wed, 30 Sep 2009 11:24:36 +0000 Subject: [PATCH 20/22] updated for version 7.2-265 --- src/ex_docmd.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 2bdf0c7f7a..8c74dd8322 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2695,7 +2695,7 @@ doend: { /* messages could be enabled for a serious error, need to check if the * counters don't become negative */ - if (!did_emsg) + if (!did_emsg || msg_silent > save_msg_silent) msg_silent = save_msg_silent; emsg_silent -= did_esilent; if (emsg_silent < 0) diff --git a/src/version.c b/src/version.c index 3633057d3c..3102a6fec1 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 265, /**/ 264, /**/ From d5365574cc310fabd24a64e99d6cdfd3413f9b4f Mon Sep 17 00:00:00 2001 From: vimboss Date: Wed, 30 Sep 2009 13:17:02 +0000 Subject: [PATCH 21/22] updated for version 7.2-266 --- runtime/doc/map.txt | 4 ++++ src/eval.c | 25 +++++++++++++++++++++++++ src/getchar.c | 12 +++++++----- src/ops.c | 17 +---------------- src/proto/eval.pro | 1 + src/version.c | 2 ++ 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 607295779e..e7b93787c9 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -224,6 +224,10 @@ expression is evaluated to obtain the {rhs} that is used. Example: > The result of the InsertDot() function will be inserted. It could check the text before the cursor and start omni completion when some condition is met. +For abbreviations |v:char| is set to the character that was typed to trigger +the abbreviation. You can use this to decide how to expand the {lhs}. You +can't change v:char and you should not insert it. + Be very careful about side effects! The expression is evaluated while obtaining characters, you may very well make the command dysfunctional. For this reason the following is blocked: diff --git a/src/eval.c b/src/eval.c index f94178d664..a48e152937 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18100,6 +18100,31 @@ get_vim_var_list(idx) return vimvars[idx].vv_list; } +/* + * Set v:char to character "c". + */ + void +set_vim_var_char(c) + int c; +{ +#ifdef FEAT_MBYTE + char_u buf[MB_MAXBYTES]; +#else + char_u buf[2]; +#endif + +#ifdef FEAT_MBYTE + if (has_mbyte) + buf[(*mb_char2bytes)(c, buf)] = NUL; + else +#endif + { + buf[0] = c; + buf[1] = NUL; + } + set_vim_var_string(VV_CHAR, buf, -1); +} + /* * Set v:count to "count" and v:count1 to "count1". * When "set_prevcount" is TRUE first set v:prevcount from v:count. diff --git a/src/getchar.c b/src/getchar.c index e81f7cb563..b39ff74a36 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -129,7 +129,7 @@ static void map_free __ARGS((mapblock_T **)); static void validate_maphash __ARGS((void)); static void showmap __ARGS((mapblock_T *mp, int local)); #ifdef FEAT_EVAL -static char_u *eval_map_expr __ARGS((char_u *str)); +static char_u *eval_map_expr __ARGS((char_u *str, int c)); #endif /* @@ -2446,7 +2446,7 @@ vgetorpeek(advance) if (tabuf.typebuf_valid) { vgetc_busy = 0; - s = eval_map_expr(mp->m_str); + s = eval_map_expr(mp->m_str, NUL); vgetc_busy = save_vgetc_busy; } else @@ -4367,9 +4367,9 @@ check_abbr(c, ptr, col, mincol) * abbreviation, but is not inserted into the input stream. */ j = 0; - /* special key code, split up */ if (c != Ctrl_RSB) { + /* special key code, split up */ if (IS_SPECIAL(c) || c == K_SPECIAL) { tb[j++] = K_SPECIAL; @@ -4398,7 +4398,7 @@ check_abbr(c, ptr, col, mincol) } #ifdef FEAT_EVAL if (mp->m_expr) - s = eval_map_expr(mp->m_str); + s = eval_map_expr(mp->m_str, c); else #endif s = mp->m_str; @@ -4434,8 +4434,9 @@ check_abbr(c, ptr, col, mincol) * special characters. */ static char_u * -eval_map_expr(str) +eval_map_expr(str, c) char_u *str; + int c; /* NUL or typed character for abbreviation */ { char_u *res; char_u *p; @@ -4452,6 +4453,7 @@ eval_map_expr(str) #ifdef FEAT_EX_EXTRA ++ex_normal_lock; #endif + set_vim_var_char(c); /* set v:char to the typed character */ save_cursor = curwin->w_cursor; p = eval_to_string(str, NULL, FALSE); --textlock; diff --git a/src/ops.c b/src/ops.c index f75613def2..b21f4c2509 100644 --- a/src/ops.c +++ b/src/ops.c @@ -4473,11 +4473,6 @@ fex_format(lnum, count, c) int use_sandbox = was_set_insecurely((char_u *)"formatexpr", OPT_LOCAL); int r; -#ifdef FEAT_MBYTE - char_u buf[MB_MAXBYTES]; -#else - char_u buf[2]; -#endif /* * Set v:lnum to the first line number and v:count to the number of lines. @@ -4485,17 +4480,7 @@ fex_format(lnum, count, c) */ set_vim_var_nr(VV_LNUM, lnum); set_vim_var_nr(VV_COUNT, count); - -#ifdef FEAT_MBYTE - if (has_mbyte) - buf[(*mb_char2bytes)(c, buf)] = NUL; - else -#endif - { - buf[0] = c; - buf[1] = NUL; - } - set_vim_var_string(VV_CHAR, buf, -1); + set_vim_var_char(c); /* * Evaluate the function. diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 362b9d90fe..d520046769 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -61,6 +61,7 @@ void set_vim_var_nr __ARGS((int idx, long val)); long get_vim_var_nr __ARGS((int idx)); char_u *get_vim_var_str __ARGS((int idx)); list_T *get_vim_var_list __ARGS((int idx)); +void set_vim_var_char __ARGS((int c)); void set_vcount __ARGS((long count, long count1, int set_prevcount)); void set_vim_var_string __ARGS((int idx, char_u *val, int len)); void set_vim_var_list __ARGS((int idx, list_T *val)); diff --git a/src/version.c b/src/version.c index 3102a6fec1..1a7e765271 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 266, /**/ 265, /**/ From 9f957bcd6c4b8f03ec9eeda6115ab2ae6ef80926 Mon Sep 17 00:00:00 2001 From: vimboss Date: Wed, 7 Oct 2009 14:20:30 +0000 Subject: [PATCH 22/22] updated for version 7.2-267 --- src/charset.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/charset.c b/src/charset.c index 0535d4cfca..cc02563b29 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1218,6 +1218,8 @@ in_win_border(wp, vcol) if ((int)vcol == width1 - 1) return TRUE; width2 = width1 + win_col_off2(wp); + if (width2 <= 0) + return FALSE; return ((vcol - width1) % width2 == width2 - 1); } #endif /* FEAT_MBYTE */ diff --git a/src/version.c b/src/version.c index 1a7e765271..a1e052c4dd 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 267, /**/ 266, /**/