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/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/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/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/auto/configure b/src/auto/configure index 976dfe2019..30d40415a7 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -744,6 +744,7 @@ INSTALL_LANGS INSTALL_TOOL_LANGS MSGFMT MAKEMO +XCODEFLAGS DEPEND_CFLAGS_FILTER LIBOBJS LTLIBOBJS' @@ -1355,7 +1356,7 @@ Optional Features: --enable-athena-check If auto-select GUI, check for Athena default=yes --enable-nextaw-check If auto-select GUI, check for neXtaw default=yes --enable-carbon-check If auto-select GUI, check for Carbon default=yes - --enable-macvim-check If auto-select GUI, check for MacVim default=yes + --enable-macvim-check If auto-select GUI, check for MacVim default=yes --disable-gtktest Do not try to compile and run a test GTK program --disable-acl Don't check for ACL support. --disable-gpm Don't use gpm (Linux mouse daemon). @@ -1365,7 +1366,8 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-mac-arch=ARCH current, intel, ppc or both + --with-macsdk=SDK SDK version (10.4, 10.5, 10.6, ...) + --with-macarchs=ARCHS space separated list of archs (i386 x86_64 ppc ...) --with-local-dir=PATH search PATH instead of /usr/local for local libraries. --without-local-dir do not search /usr/local for local libraries. --with-vim-name=NAME what to call the Vim executable @@ -1386,6 +1388,7 @@ Optional Packages: --with-gnome Specify prefix for GNOME files --with-motif-lib=STRING Library for Motif --with-tlib=library terminal library to be used + --with-xcodecfg=CFG Debug, Release (default: Release) Some influential environment variables: CC C compiler command @@ -3674,26 +3677,32 @@ echo "${ECHO_T}no, Darwin support disabled" >&6; } echo "${ECHO_T}yes, Darwin support excluded" >&6; } fi - { echo "$as_me:$LINENO: checking --with-mac-arch argument" >&5 -echo $ECHO_N "checking --with-mac-arch argument... $ECHO_C" >&6; } -# Check whether --with-mac-arch was given. -if test "${with_mac_arch+set}" = set; then - withval=$with_mac_arch; MACARCH="$withval"; { echo "$as_me:$LINENO: result: $MACARCH" >&5 -echo "${ECHO_T}$MACARCH" >&6; } + { echo "$as_me:$LINENO: checking --with-macsdk argument" >&5 +echo $ECHO_N "checking --with-macsdk argument... $ECHO_C" >&6; } + +# Check whether --with-macsdk was given. +if test "${with_macsdk+set}" = set; then + withval=$with_macsdk; MACSDK="$withval"; { echo "$as_me:$LINENO: result: $MACSDK" >&5 +echo "${ECHO_T}$MACSDK" >&6; } else - MACARCH="current"; { echo "$as_me:$LINENO: result: defaulting to $MACARCH" >&5 -echo "${ECHO_T}defaulting to $MACARCH" >&6; } + MACSDK=""; { echo "$as_me:$LINENO: result: using default" >&5 +echo "${ECHO_T}using default" >&6; } fi - if test "x$MACARCH" = "xboth"; then - { echo "$as_me:$LINENO: checking for 10.4 universal SDK" >&5 -echo $ECHO_N "checking for 10.4 universal SDK... $ECHO_C" >&6; } - save_cppflags="$CPPFLAGS" + if test -n "$MACSDK"; then + { echo "$as_me:$LINENO: checking if SDK is supported" >&5 +echo $ECHO_N "checking if SDK is supported... $ECHO_C" >&6; } save_cflags="$CFLAGS" save_ldflags="$LDFLAGS" - CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" + sdkflags="/Developer/SDKs/MacOSX$MACSDK" + if test "x$MACSDK" = "x10.4"; then + sdkflags="$sdkflags""u" + fi + sdkflags="$sdkflags.sdk -mmacosx-version-min=$MACSDK" + CFLAGS="$CFLAGS -isysroot $sdkflags" + LDFLAGS="$LDFLAGS -Wl,-syslibroot,$sdkflags" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -3727,20 +3736,47 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - { echo "$as_me:$LINENO: result: found" >&5 -echo "${ECHO_T}found" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + XCODEFLAGS="$XCODEFLAGS -sdk macosx$MACSDK MACOSX_DEPLOYMENT_TARGET=$MACSDK" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: result: not found" >&5 -echo "${ECHO_T}not found" >&6; } - CFLAGS="$save_cflags" - { echo "$as_me:$LINENO: checking if Intel architecture is supported" >&5 -echo $ECHO_N "checking if Intel architecture is supported... $ECHO_C" >&6; } - CPPFLAGS="$CPPFLAGS -arch i386" - LDFLAGS="$save_ldflags -arch i386" - cat >conftest.$ac_ext <<_ACEOF + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + MACSDK="" + CFLAGS="$save_cflags" + LDFLAGS="$save_ldflags" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + fi + + + { echo "$as_me:$LINENO: checking --with-macarchs argument" >&5 +echo $ECHO_N "checking --with-macarchs argument... $ECHO_C" >&6; } + +# Check whether --with-macarchs was given. +if test "${with_macarchs+set}" = set; then + withval=$with_macarchs; ARCHS="$withval"; { echo "$as_me:$LINENO: result: $ARCHS" >&5 +echo "${ECHO_T}$ARCHS" >&6; } +else + ARCHS=""; { echo "$as_me:$LINENO: result: defaulting to native arch" >&5 +echo "${ECHO_T}defaulting to native arch" >&6; } +fi + + + if test -n "$ARCHS"; then + { echo "$as_me:$LINENO: checking if architectures are supported" >&5 +echo $ECHO_N "checking if architectures are supported... $ECHO_C" >&6; } + save_cflags="$CFLAGS" + save_ldflags="$LDFLAGS" + archflags=`echo "$ARCHS" | sed -e 's/[[:<:]]/-arch /g'` + CFLAGS="$CFLAGS $archflags" + LDFLAGS="$LDFLAGS $archflags" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3773,43 +3809,30 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; }; MACARCH="intel" + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + XCODEFLAGS="$XCODEFLAGS ARCHS=\"$ARCHS\" ONLY_ACTIVE_ARCH=\"NO\"" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - MACARCH="ppc" - CPPFLAGS="$save_cppflags -arch ppc" - LDFLAGS="$save_ldflags -arch ppc" + { echo "$as_me:$LINENO: result: no, will build for native arch only" >&5 +echo "${ECHO_T}no, will build for native arch only" >&6; } + ARCHS="" + CFLAGS="$save_cflags" + LDFLAGS="$save_ldflags" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - elif test "x$MACARCH" = "xintel"; then - CPPFLAGS="$CPPFLAGS -arch intel" - LDFLAGS="$LDFLAGS -arch intel" - elif test "x$MACARCH" = "xppc"; then - CPPFLAGS="$CPPFLAGS -arch ppc" - LDFLAGS="$LDFLAGS -arch ppc" fi + if test "$enable_darwin" = "yes"; then MACOSX=yes OS_EXTRA_SRC="os_macosx.c os_mac_conv.c"; OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o" CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp" - if test "x$MACARCH" = "xboth"; then - CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon" - else - CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon" - fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. @@ -4154,11 +4177,6 @@ fi fi fi fi - - if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then - CFLAGS=`echo "$CFLAGS" | sed 's/-O[23456789]/-Oz/'` - fi - else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } @@ -4866,6 +4884,11 @@ echo "${ECHO_T}OK" >&6; } perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \ -e 'ccdlflags' | sed -e 's/-bE:perl.exp//'` + if test "x$MACOSX" = "xyes"; then + perllibs=`echo "$perllibs" | sed -e 's/-arch[^-]*//g'` + perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[^-]*//g'` + fi + { echo "$as_me:$LINENO: checking if compile and link flags for Perl are sane" >&5 echo $ECHO_N "checking if compile and link flags for Perl are sane... $ECHO_C" >&6; } cflags_save=$CFLAGS @@ -5232,6 +5255,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ echo "${ECHO_T}no" >&6; } fi + if test -n "$MACSDK"; then + PYTHON_CFLAGS= + PYTHON_LIBS=-framework Python + PYTHON_CONFDIR= + PYTHON_GETPATH_CFLAGS= + fi + { echo "$as_me:$LINENO: checking if compile and link flags for Python are sane" >&5 echo $ECHO_N "checking if compile and link flags for Python are sane... $ECHO_C" >&6; } cflags_save=$CFLAGS @@ -5729,7 +5759,10 @@ echo "${ECHO_T}$rubyhdrdir" >&6; } librubyarg="$rubyhdrdir/$librubyarg" else rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG["libdir"])'` - if test -f "$rubylibdir/$librubyarg"; then + if test -d "/System/Library/Frameworks/Ruby.framework"; then + RUBY_LIBS="-framework Ruby" + librubyarg= + elif test -f "$rubylibdir/$librubyarg"; then librubyarg="$rubylibdir/$librubyarg" elif test "$librubyarg" = "libruby.a"; then librubyarg="-lruby" @@ -5742,15 +5775,21 @@ echo "${ECHO_T}$rubyhdrdir" >&6; } RUBY_LIBS="$librubyarg $RUBY_LIBS" fi rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG["LDFLAGS"]'` - if test "X$rubyldflags" != "X"; then - rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch\ ppc//' -e 's/-arch\ i386//' -e 's/-arch\ x86_64//'` - if test "X$rubyldflags" != "X"; then - LDFLAGS="$rubyldflags $LDFLAGS" - fi + if test "x$MACOSX" = "xyes"; then + rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[^-]*//g'` fi + if test "X$rubyldflags" != "X"; then + LDFLAGS="$rubyldflags $LDFLAGS" + fi RUBY_SRC="if_ruby.c" RUBY_OBJ="objects/if_ruby.o" RUBY_PRO="if_ruby.pro" + + if test -n "$MACSDK"; then + RUBY_CFLAGS= + RUBY_LIBS="-framework Ruby" + fi + cat >>confdefs.h <<\_ACEOF #define FEAT_RUBY 1 _ACEOF @@ -8212,23 +8251,22 @@ if test "x$MACOSX" = "xyes"; then prefix=/Applications fi - if test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then - { echo "$as_me:$LINENO: checking for Carbon GUI" >&5 -echo $ECHO_N "checking for Carbon GUI... $ECHO_C" >&6; } - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; }; - GUITYPE=CARBONGUI - datadir='${prefix}/Vim.app/Contents/Resources' - elif test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then + if test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then { echo "$as_me:$LINENO: checking for MacVim GUI" >&5 echo $ECHO_N "checking for MacVim GUI... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; }; GUITYPE=MACVIMGUI datadir='${prefix}/MacVim.app/Contents/Resources' + elif test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then + { echo "$as_me:$LINENO: checking for Carbon GUI" >&5 +echo $ECHO_N "checking for Carbon GUI... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; + GUITYPE=CARBONGUI + datadir='${prefix}/Vim.app/Contents/Resources' - CFLAGS="$CFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" + CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon" fi if test "$VIMNAME" = "vim"; then @@ -16478,10 +16516,26 @@ echo "${ECHO_T}yes" >&6; } echo "${ECHO_T}no" >&6; } fi fi -if test "x$MACARCH" = "xboth"; then - LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" + +if test "x$MACOSX" = "xyes"; then + { echo "$as_me:$LINENO: checking --with-xcodecfg argument" >&5 +echo $ECHO_N "checking --with-xcodecfg argument... $ECHO_C" >&6; } + +# Check whether --with-xcodecfg was given. +if test "${with_xcodecfg+set}" = set; then + withval=$with_xcodecfg; XCODEFLAGS="$XCODEFLAGS -configuration $withval" + { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } +else + { echo "$as_me:$LINENO: result: using default" >&5 +echo "${ECHO_T}using default" >&6; } fi + + +fi + + DEPEND_CFLAGS_FILTER= if test "$GCC" = yes; then { echo "$as_me:$LINENO: checking for GCC 3 or later" >&5 @@ -16498,7 +16552,7 @@ echo "${ECHO_T}no" >&6; } { echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5 echo $ECHO_N "checking whether we need -D_FORTIFY_SOURCE=1... $ECHO_C" >&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'` { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } else @@ -17297,12 +17351,13 @@ INSTALL_LANGS!$INSTALL_LANGS$ac_delim INSTALL_TOOL_LANGS!$INSTALL_TOOL_LANGS$ac_delim MSGFMT!$MSGFMT$ac_delim MAKEMO!$MAKEMO$ac_delim +XCODEFLAGS!$XCODEFLAGS$ac_delim DEPEND_CFLAGS_FILTER!$DEPEND_CFLAGS_FILTER$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 38; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/src/charset.c b/src/charset.c index bac1a20ffe..cc02563b29 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) @@ -1213,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/configure.in b/src/configure.in index 1c744fd96f..e1b44b0db1 100644 --- a/src/configure.in +++ b/src/configure.in @@ -3313,7 +3313,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/eval.c b/src/eval.c index 171188275c..72ced8a855 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18121,6 +18121,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/ex_docmd.c b/src/ex_docmd.c index 066c6e8e40..620bcf57d1 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2702,7 +2702,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/ex_getln.c b/src/ex_getln.c index 7e7b19238f..107ba60b5b 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3269,7 +3269,6 @@ nextwild(xp, type, options) int i, j; char_u *p1; char_u *p2; - int oldlen; int difflen; int v; @@ -3294,7 +3293,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) { @@ -3308,18 +3307,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; @@ -3334,7 +3335,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); @@ -3623,6 +3624,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; @@ -4314,8 +4316,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; @@ -4787,7 +4789,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. */ @@ -4803,6 +4805,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/fileio.c b/src/fileio.c index 43df094db9..0023284185 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); } @@ -9536,15 +9536,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. */ @@ -9553,9 +9548,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/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/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/gui.c b/src/gui.c index 1eb0e4230d..f69184404f 100644 --- a/src/gui.c +++ b/src/gui.c @@ -1404,6 +1404,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; @@ -1443,22 +1447,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_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/gui_gtk_x11.c b/src/gui_gtk_x11.c index 33fdaed485..ad6fc25e1d 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) @@ -4369,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. */ @@ -4729,6 +4759,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 +4849,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/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/netbeans.c b/src/netbeans.c index 030044b642..9ffa74d209 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -1557,7 +1557,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) { @@ -1568,7 +1569,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; @@ -1579,7 +1581,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)) @@ -1642,7 +1645,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 @@ -1651,7 +1655,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); @@ -3576,7 +3581,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/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/option.c b/src/option.c index 8bc2544f8f..a693c1cab4 100644 --- a/src/option.c +++ b/src/option.c @@ -7546,6 +7546,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 @@ -7783,6 +7785,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/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/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/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/structs.h b/src/structs.h index 79bf020028..cf9f69e544 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/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/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/ui.c b/src/ui.c index 8e3c7aeae4..662266b396 100644 --- a/src/ui.c +++ b/src/ui.c @@ -3070,18 +3070,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 5eb236ab94..a052773c95 100644 --- a/src/version.c +++ b/src/version.c @@ -691,6 +691,50 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 267, +/**/ + 266, +/**/ + 265, +/**/ + 264, +/**/ + 263, +/**/ + 262, +/**/ + 261, +/**/ + 260, +/**/ + 259, +/**/ + 258, +/**/ + 257, +/**/ + 256, +/**/ + 255, +/**/ + 254, +/**/ + 253, +/**/ + 252, +/**/ + 251, +/**/ + 250, +/**/ + 249, +/**/ + 248, +/**/ + 247, +/**/ + 246, /**/ 245, /**/