diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-07-02 15:38:35 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-07-02 15:38:35 +0000 |
commit | cfbc5ee48e1b582f418f2d92ccbc4c4e84c803e1 (patch) | |
tree | 7586fe6160998a4c76a48dab221e38efe55257ef /src | |
parent | 843ee41eb8258ac50ed81976757d8b228382a880 (diff) |
updated for version 7.0004
Diffstat (limited to 'src')
-rw-r--r-- | src/GvimExt/Make_ming.mak | 4 | ||||
-rw-r--r-- | src/Make_bc5.mak | 33 | ||||
-rw-r--r-- | src/Make_cyg.mak | 35 | ||||
-rw-r--r-- | src/Make_ming.mak | 15 | ||||
-rw-r--r-- | src/Make_mvc.mak | 7 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/buffer.c | 6 | ||||
-rw-r--r-- | src/configure.in | 5 | ||||
-rw-r--r-- | src/edit.c | 147 | ||||
-rw-r--r-- | src/eval.c | 8 | ||||
-rw-r--r-- | src/feature.h | 7 | ||||
-rw-r--r-- | src/fileio.c | 1 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/if_cscope.c | 14 | ||||
-rw-r--r-- | src/normal.c | 6 | ||||
-rw-r--r-- | src/option.c | 45 | ||||
-rw-r--r-- | src/os_unix.c | 29 | ||||
-rw-r--r-- | src/proto/search.pro | 1 | ||||
-rw-r--r-- | src/screen.c | 22 | ||||
-rw-r--r-- | src/search.c | 262 | ||||
-rw-r--r-- | src/structs.h | 6 | ||||
-rw-r--r-- | src/syntax.c | 13 | ||||
-rw-r--r-- | src/testdir/Make_amiga.mak | 3 | ||||
-rw-r--r-- | src/testdir/Make_dos.mak | 2 | ||||
-rw-r--r-- | src/testdir/Make_os2.mak | 2 | ||||
-rw-r--r-- | src/testdir/Make_vms.mms | 4 | ||||
-rw-r--r-- | src/testdir/Makefile | 2 | ||||
-rw-r--r-- | src/testdir/test53.in | 24 | ||||
-rw-r--r-- | src/testdir/test53.ok | 8 | ||||
-rw-r--r-- | src/vim.h | 1 |
30 files changed, 656 insertions, 59 deletions
diff --git a/src/GvimExt/Make_ming.mak b/src/GvimExt/Make_ming.mak index 3456255248..9da5639518 100644 --- a/src/GvimExt/Make_ming.mak +++ b/src/GvimExt/Make_ming.mak @@ -28,8 +28,8 @@ CXXFLAGS := -O2 -mno-cygwin WINDRES = i386-mingw32msvc-windres endif else -CXX := g++.exe -WINDRES := windres.exe +CXX := g++ +WINDRES := windres CXXFLAGS := -O2 -mno-cygwin endif LIBS := -luuid diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 73d9440d83..271820d8e7 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -76,6 +76,7 @@ # CSCOPE no or yes: include support for Cscope interface (yes) # NETBEANS no or yes: include support for Netbeans interface (yes if GUI # is yes) +# NBDEBUG no or yes: include support for debugging Netbeans interface (no) # XPM define to path to XPM dir to get support for loading XPM images. ### BOR: root of the BC installation @@ -397,19 +398,6 @@ MBDEFINES = $(MBDEFINES) -DDYNAMIC_GETTEXT DEFINES = $(DEFINES) -DFEAT_CSCOPE !endif -!if ("$(NETBEANS)"=="yes") -DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG -!if ("$(DEBUG)"=="yes") -DEFINES = $(DEFINES) -DNBDEBUG -NBDEBUG_DEP = nbdebug.h nbdebug.c -!endif -!endif - -!ifdef XPM -DEFINES = $(DEFINES) -DFEAT_XPM_W32 -INCLUDE = $(XPM)\include;$(INCLUDE) -!endif - !if ("$(GUI)"=="yes") DEFINES = $(DEFINES) -DFEAT_GUI_W32 -DFEAT_CLIPBOARD !if ("$(DEBUG)"=="yes") @@ -427,11 +415,13 @@ STARTUPOBJ = c0w32.obj LINK2 = -aa RESFILE = vim.res !else +!undef NETBEANS +!undef XPM +!undef VIMDLL !if ("$(DEBUG)"=="yes") TARGET = vimd.exe !else # for now, anyway: VIMDLL is only for the GUI version -!undef VIMDLL TARGET = vim.exe !endif !if ($(OSTYPE)==DOS16) @@ -447,6 +437,21 @@ LINK2 = -ap -OS -o -P RESFILE = vim.res !endif +!if ("$(NETBEANS)"=="yes") +DEFINES = $(DEFINES) -DFEAT_NETBEANS_INTG +!if ("$(NBDEBUG)"=="yes") +DEFINES = $(DEFINES) -DNBDEBUG +NBDEBUG_DEP = nbdebug.h nbdebug.c +!endif +!endif + +!ifdef XPM +!if ("$(GUI)"=="yes") +DEFINES = $(DEFINES) -DFEAT_XPM_W32 +INCLUDE = $(XPM)\include;$(INCLUDE) +!endif +!endif + !if ("$(USEDLL)"=="yes") DEFINES = $(DEFINES) -D_RTLDLL !endif diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index e58e3d14c5..b8692300aa 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,6 +1,6 @@ # # Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2004 Apr 23 +# Last updated by Dan Sharp. Last Change: 2004 Jul 01 # # This compiles Vim as a Windows application. If you want Vim to run as a # Cygwin application use the Makefile (just like on Unix). @@ -36,6 +36,7 @@ # OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED) # NETBEANS no or yes: to include netbeans interface support (yes when GUI # is yes) +# NBDEBUG no or yes: to include netbeans interface debugging support (no) # XPM define to path to XPM dir to get XPM image support (not defined) #>>>>> choose options: ifndef GUI @@ -62,14 +63,16 @@ ifndef IME IME = yes endif -ifndef CPUNR -CPUNR = i386 -endif - ifndef ARCH ARCH = i386 endif +ifndef CPUNR +# Setting -march implicitly sets -mcpu to the same value, +# so reflect that in the defaults here. +CPUNR = $(ARCH) +endif + ifndef WINVER WINVER = 0x0400 endif @@ -293,12 +296,16 @@ EXTRA_OBJS += $(OUTDIR)/if_cscope.o endif ############################## +ifeq ($(GUI),yes) + +############################## ifeq (yes, $(NETBEANS)) +# Only allow NETBEANS for a GUI build. DEFINES += -DFEAT_NETBEANS_INTG EXTRA_OBJS += $(OUTDIR)/netbeans.o $(OUTDIR)/gui_beval.o EXTRA_LIBS += -lwsock32 -ifeq (yes, $(DEBUG)) +ifeq (yes, $(NBDEBUG)) DEFINES += -DNBDEBUG NBDEBUG_DEP = nbdebug.h nbdebug.c endif @@ -307,6 +314,7 @@ endif ############################## ifdef XPM +# Only allow XPM for a GUI build. DEFINES += -DFEAT_XPM_W32 INCLUDES += -I$(XPM)/include EXTRA_OBJS += $(OUTDIR)/xpm_w32.o @@ -314,14 +322,6 @@ EXTRA_LIBS += -L$(XPM)/lib -lXpm endif ############################## -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -EXTRA_OBJS += $(OUTDIR)/if_ole.o -EXTRA_LIBS += -loleaut32 -lstdc++ -endif - -############################## -ifeq ($(GUI),yes) EXE = gvim$(DEBUG_SUFFIX).exe OUTDIR = gobj$(DEBUG_SUFFIX) DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD @@ -334,6 +334,13 @@ LIBS += -luser32 -lgdi32 -lcomdlg32 endif ############################## +ifeq (yes, $(OLE)) +DEFINES += -DFEAT_OLE +EXTRA_OBJS += $(OUTDIR)/if_ole.o +EXTRA_LIBS += -loleaut32 -lstdc++ +endif + +############################## ifneq (sh.exe, $(SHELL)) DEL = rm DIRSLASH = / diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 06780627be..31cd92c269 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -287,17 +287,24 @@ DEFINES += -DFEAT_CSCOPE endif ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) DEFINES += -DFEAT_NETBEANS_INTG -ifeq ($(DEBUG), yes) + +ifeq ($(NBDEBUG), yes) DEFINES += -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c endif endif +endif ifdef XPM +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include endif +endif ifeq ($(DEBUG),yes) CFLAGS += -g -fstack-check @@ -378,14 +385,20 @@ ifeq ($(CSCOPE),yes) OBJ += $(OUTDIR)/if_cscope.o endif ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/netbeans.o $(OUTDIR)/gui_beval.o LIB += -lwsock32 endif +endif ifdef XPM +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/xpm_w32.o # You'll need libXpm.a from http://gnuwin32.sf.net LIB += -L $(XPM)/lib -lXpm endif +endif ifeq ($(GUI),yes) diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 8ee77b63c1..d4b74a41f7 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -57,6 +57,7 @@ # Processor Version: CPUNR=[i386, i486, i586, i686] (default is i386) # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) # Netbeans Support: NETBEANS=[yes or no] (default is yes if GUI is yes) +# Netbeans Debugging Support: NBDEBUG=[yes or no] (default is no) # XPM Image Support: XPM=[path to XPM directory] # # You can combine any of these interfaces @@ -189,12 +190,15 @@ CSCOPE_DEFS = -DFEAT_CSCOPE NETBEANS = $(GUI) !endif +# Only allow NETBEANS and XPM for a GUI build. +!if "$(GUI)" == "yes" !if "$(NETBEANS)" == "yes" # NETBEANS - Include support for Netbeans integration NETBEANS_PRO = proto/netbeans.pro NETBEANS_OBJ = $(OBJDIR)/netbeans.obj $(OBJDIR)/gui_beval.obj NETBEANS_DEFS = -DFEAT_NETBEANS_INTG -!if "$(DEBUG)" == "yes" + +!if "$(NBDEBUG)" == "yes" NBDEBUG_DEFS = -DNBDEBUG NBDEBUG_INCL = nbdebug.h NBDEBUG_SRC = nbdebug.c @@ -210,6 +214,7 @@ XPM_DEFS = -DFEAT_XPM_W32 XPM_LIB = $(XPM)\lib\libXpm.lib XPM_INC = -I $(XPM)\include !endif +!endif !if defined(USE_MSVCRT) CVARS = $(cvarsdll) diff --git a/src/Makefile b/src/Makefile index 7e4c385b01..e19dabc5b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -336,7 +336,6 @@ CClink = $(CC) # use it (e.g., want a GTK-only version), then use --enable-gui=gtk. # # If the selected GUI isn't found, the GUI is disabled automatically -#CONF_OPT_GUI = --enable-gui=kde #CONF_OPT_GUI = --enable-gui=gtk #CONF_OPT_GUI = --enable-gui=gtk --disable-gtktest #CONF_OPT_GUI = --enable-gui=gtk2 @@ -344,6 +343,7 @@ CClink = $(CC) #CONF_OPT_GUI = --enable-gui=gnome #CONF_OPT_GUI = --enable-gui=gnome2 #CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest +#CONF_OPT_GUI = --enable-gui=kde #CONF_OPT_GUI = --enable-gui=motif #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared" #CONF_OPT_GUI = --enable-gui=athena diff --git a/src/buffer.c b/src/buffer.c index 27f64bd5f8..6249005ac7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1668,6 +1668,9 @@ free_buf_options(buf, free_p_ff) #ifdef FEAT_INS_EXPAND clear_string_option(&buf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + clear_string_option(&buf->b_p_cfu); +#endif #ifdef FEAT_QUICKFIX clear_string_option(&buf->b_p_gp); clear_string_option(&buf->b_p_mp); @@ -1680,6 +1683,9 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_dict); clear_string_option(&buf->b_p_tsr); #endif +#ifdef FEAT_TEXTOBJ + clear_string_option(&buf->b_p_qe); +#endif buf->b_p_ar = -1; } diff --git a/src/configure.in b/src/configure.in index 1ebf82c187..42d6bfadb6 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1251,7 +1251,10 @@ AC_DEFUN(AM_PATH_KDE, KDE_LIBS="$KDE_PREFIX/lib" fi if test "x$KDE_INCLUDES" = "x"; then - KDE_INCLUDES="$KDE_PREFIX/include" + KDE_INCLUDES="$KDE_PREFIX/include" + if test -d "$KDE_INCLUDES/kde"; then + KDE_INCLUDES="$KDE_INCLUDES/kde" + fi fi kde_major_version=`$KDE_CONFIG --version | grep KDE | \ sed 's/KDE:\ //' | sed 's/\([[0-9]]*\).\([[0-9]]*.*\)/\1/'` diff --git a/src/edit.c b/src/edit.c index 1adcda414c..0ca698c3f9 100644 --- a/src/edit.c +++ b/src/edit.c @@ -30,6 +30,7 @@ #define CTRL_X_DICTIONARY (9 + CTRL_X_WANT_IDENT) #define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT) #define CTRL_X_CMDLINE 11 +#define CTRL_X_FUNCTION 12 #define CHECK_KEYS_TIME 30 @@ -38,7 +39,7 @@ static char *ctrl_x_msgs[] = { N_(" Keyword completion (^N^P)"), /* ctrl_x_mode == 0, ^P/^N compl. */ - N_(" ^X mode (^E^Y^L^]^F^I^K^D^V^N^P)"), + N_(" ^X mode (^E^Y^L^]^F^I^K^D^U^V^N^P)"), /* Scroll has it's own msgs, in it's place there is the msg for local * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo */ N_(" Keyword Local completion (^N^P)"), @@ -50,7 +51,8 @@ static char *ctrl_x_msgs[] = NULL, N_(" Dictionary completion (^K^N^P)"), N_(" Thesaurus completion (^T^N^P)"), - N_(" Command-line completion (^V^N^P)") + N_(" Command-line completion (^V^N^P)"), + N_(" User defined completion (^U^N^P)"), }; static char_u e_hitend[] = N_("Hit end of paragraph"); @@ -762,7 +764,7 @@ edit(cmdchar, startln, count) #ifdef FEAT_INS_EXPAND /* Enter CTRL-X mode */ case Ctrl_X: - /* CTRL-X after CTRL-V CTRL-X doesn't do anything, so that CTRL-X + /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X * CTRL-V works like CTRL-N */ if (ctrl_x_mode != CTRL_X_CMDLINE) { @@ -1030,6 +1032,12 @@ doESCkey: /* delete all inserted text in current line */ case Ctrl_U: +# ifdef FEAT_COMPL_FUNC + /* CTRL-X CTRL-U completes with 'completefunc'. */ + if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET + || ctrl_x_mode == CTRL_X_FUNCTION) + goto docomplete; +# endif did_backspace = ins_bs(c, BACKSPACE_LINE, &inserted_space); auto_format(FALSE, TRUE); inserted_space = FALSE; @@ -1914,6 +1922,10 @@ vim_is_ctrl_x_key(c) case CTRL_X_CMDLINE: return (c == Ctrl_V || c == Ctrl_Q || c == Ctrl_P || c == Ctrl_N || c == Ctrl_X); +#ifdef FEAT_COMPL_FUNC + case CTRL_X_FUNCTION: + return (c == Ctrl_U || c == Ctrl_P || c == Ctrl_N || c == Ctrl_X); +#endif } EMSG(_(e_internal)); return FALSE; @@ -2416,6 +2428,11 @@ ins_compl_prep(c) case Ctrl_T: ctrl_x_mode = CTRL_X_THESAURUS; break; +#ifdef FEAT_COMPL_FUNC + case Ctrl_U: + ctrl_x_mode = CTRL_X_FUNCTION; + break; +#endif case Ctrl_RSB: ctrl_x_mode = CTRL_X_TAGS; break; @@ -2622,6 +2639,88 @@ ins_compl_next_buf(buf, flag) return buf; } +#ifdef FEAT_COMPL_FUNC +static char_u *call_completefunc __ARGS((char_u *line, char_u *base, int col, int preproc)); +static int expand_by_function __ARGS((int lnum, int col, char_u *base, char_u ***matches)); + +/* + * Execute user defined complete function 'completefunc'. + * Return NULL if some error occurs. + */ + static char_u * +call_completefunc(line, base, col, preproc) + char_u *line; + char_u *base; + int col; + int preproc; +{ + char_u colbuf[30]; + char_u *args[4]; + + /* Return NULL when 'completefunc' isn't set. */ + if (*curbuf->b_p_cfu == NUL) + return NULL; + + sprintf((char *)colbuf, "%d", col + (base ? (int)STRLEN(base) : 0)); + args[0] = line; + args[1] = base; + args[2] = colbuf; + args[3] = preproc ? "1" : "0"; + return call_vim_function(curbuf->b_p_cfu, 4, args, FALSE); +} + +/* + * Execute user defined complete function 'completefunc', and get candidates + * are separeted with "\n". Return value is number of candidates and array + * of candidates as "matches". + */ + static int +expand_by_function(lnum, col, base, matches) + int lnum; + int col; + char_u *base; + char_u ***matches; +{ + char_u *matchstr = NULL; + + /* Execute 'completefunc' and get the result */ + matchstr = call_completefunc(ml_get_buf(curbuf, lnum, FALSE), base, col, 0); + + /* Parse returned string */ + if (matchstr != NULL) + { + garray_T ga; + char_u *p, *pnext; + + ga_init2(&ga, (int)sizeof(char*), 8); + for (p = matchstr; *p != NUL; p = pnext) + { + int len; + + pnext = vim_strchr(p, '\n'); + if (pnext == NULL) + pnext = p + STRLEN(p); + len = pnext - p; + if (len > 0) + { + if (ga_grow(&ga, 1) == FAIL) + break; + ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(p, len); + ++ga.ga_len; + --ga.ga_room; + } + if (*pnext != NUL) + ++pnext; + } + vim_free(matchstr); + if (ga.ga_len > 0) + *matches = (char_u**)ga.ga_data; + return ga.ga_len; + } + return 0; +} +#endif /* FEAT_COMPL_FUNC */ + /* * Get the next expansion(s) for the text starting at the initial curbuf * position "ini" and in the direction dir. @@ -2660,7 +2759,8 @@ ins_compl_get_exp(ini, dir) ins_buf->b_scanned = 0; found_all = FALSE; ins_buf = curbuf; - e_cpt = continue_status & CONT_LOCAL ? (char_u *)"." : curbuf->b_p_cpt; + e_cpt = (continue_status & CONT_LOCAL) + ? (char_u *)"." : curbuf->b_p_cpt; last_match_pos = first_match_pos = *ini; } @@ -2828,6 +2928,15 @@ ins_compl_get_exp(ini, dir) ins_compl_add_matches(num_matches, matches, dir); break; +#ifdef FEAT_COMPL_FUNC + case CTRL_X_FUNCTION: + num_matches = expand_by_function(first_match_pos.lnum, + first_match_pos.col, complete_pat, &matches); + if (num_matches > 0) + ins_compl_add_matches(num_matches, matches, dir); + break; +#endif + default: /* normal ^P/^N and ^X^L */ /* * If 'infercase' is set, don't use 'smartcase' here @@ -3404,6 +3513,36 @@ ins_complete(c) tmp_ptr = line + temp; temp = complete_col - temp; } +#ifdef FEAT_COMPL_FUNC + else if (ctrl_x_mode == CTRL_X_FUNCTION) + { + /* + * Call user defined function 'completefunc' with line content, + * cursor column number and preproc is 1. Obtain length of text + * to use for completion. + */ + char_u *lenstr; + int keeplen = 0; + + /* Call 'completefunc' and get pattern length as a string */ + lenstr = call_completefunc(line, NULL, complete_col, 1); + if (lenstr == NULL) + return FAIL; + keeplen = atoi(lenstr); + vim_free(lenstr); + if (keeplen < 0) + return FAIL; + if ((colnr_T)keeplen > complete_col) + keeplen = complete_col; + + /* Setup variables for completion */ + tmp_ptr = line + keeplen; + temp = complete_col - keeplen; + complete_pat = vim_strnsave(tmp_ptr, temp); + if (complete_pat == NULL) + return FAIL; + } +#endif complete_col = (colnr_T) (tmp_ptr - line); if (continue_status & CONT_ADDING) diff --git a/src/eval.c b/src/eval.c index 5e405157f9..7ef1398d7c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -741,6 +741,14 @@ call_vim_function(func, argc, argv, safe) for (i = 0; i < argc; i++) { + /* Pass a NULL or empty argument as an empty string */ + if (argv[i] == NULL || *argv[i] == NUL) + { + argvars[i].var_type = VAR_STRING; + argvars[i].var_val.var_string = ""; + continue; + } + /* Recognize a number argument, the others must be strings. */ vim_str2nr(argv[i], NULL, &len, TRUE, TRUE, &n, NULL); if (len != 0 && len == (int)STRLEN(argv[i])) diff --git a/src/feature.h b/src/feature.h index 8ebe94fd34..7bd73e7c21 100644 --- a/src/feature.h +++ b/src/feature.h @@ -379,6 +379,13 @@ #endif /* + * Insert mode completion with 'completefunc'. + */ +#if defined(FEAT_INS_EXPAND) && defined(FEAT_EVAL) +# define FEAT_COMPL_FUNC +#endif + +/* * +user_commands Allow the user to define his own commands. */ #ifdef FEAT_NORMAL diff --git a/src/fileio.c b/src/fileio.c index 92c1e98bbe..240c7e9d0a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -6628,6 +6628,7 @@ static struct event_name {"BufWriteCmd", EVENT_BUFWRITECMD}, {"CmdwinEnter", EVENT_CMDWINENTER}, {"CmdwinLeave", EVENT_CMDWINLEAVE}, + {"ColorScheme", EVENT_COLORSCHEME}, {"EncodingChanged", EVENT_ENCODINGCHANGED}, {"FileEncoding", EVENT_ENCODINGCHANGED}, {"CursorHold", EVENT_CURSORHOLD}, diff --git a/src/globals.h b/src/globals.h index 8a59f1ccbf..026a3fe796 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1004,6 +1004,7 @@ EXTERN char_u *globaldir INIT(= NULL); EXTERN int lcs_eol INIT(= '$'); EXTERN int lcs_ext INIT(= NUL); EXTERN int lcs_prec INIT(= NUL); +EXTERN int lcs_nbsp INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); diff --git a/src/if_cscope.c b/src/if_cscope.c index eec3de8de6..012e86c76f 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -434,14 +434,14 @@ cs_add_common(arg1, arg2, flags) char *flags; { struct stat statbuf; - int ret; - char *fname = NULL; - char *fname2 = NULL; - char *ppath = NULL; - int i; + int ret; + char *fname = NULL; + char *fname2 = NULL; + char *ppath = NULL; + int i; /* get the filename (arg1), expand it, and try to stat it */ - if ((fname = (char *)alloc(MAXPATHL+1)) == NULL) + if ((fname = (char *)alloc(MAXPATHL + 1)) == NULL) goto add_err; expand_env((char_u *)arg1, (char_u *)fname, MAXPATHL); @@ -459,7 +459,7 @@ staterr: { struct stat statbuf2; - if ((ppath = (char *)alloc(MAXPATHL+1)) == NULL) + if ((ppath = (char *)alloc(MAXPATHL + 1)) == NULL) goto add_err; expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL); diff --git a/src/normal.c b/src/normal.c index 8fb8c028db..330356ce9e 100644 --- a/src/normal.c +++ b/src/normal.c @@ -8257,6 +8257,12 @@ nv_object(cap) case 's': /* "as" = a sentence */ flag = current_sent(cap->oap, cap->count1, include); break; + case '"': /* "a"" = a double quoted string */ + case '\'': /* "a'" = a single quoted string */ + case '`': /* "a`" = a backtick quoted string */ + flag = current_quote(cap->oap, cap->count1, include, + cap->nchar); + break; #if 0 /* TODO */ case 'S': /* "aS" = a section */ case 'f': /* "af" = a filename */ diff --git a/src/option.c b/src/option.c index 948018d3bc..d48c84095a 100644 --- a/src/option.c +++ b/src/option.c @@ -62,6 +62,7 @@ typedef enum , PV_CMS , PV_COM , PV_CPT + , PV_CFU , PV_DEF , PV_DICT , PV_DIFF @@ -109,6 +110,7 @@ typedef enum , PV_PATH , PV_PI , PV_PVW + , PV_QE , PV_RL , PV_RLC , PV_RO @@ -169,6 +171,9 @@ static char_u *p_cms; #ifdef FEAT_INS_EXPAND static char_u *p_cpt; #endif +#ifdef FEAT_COMPL_FUNC +static char_u *p_cfu; +#endif static int p_eol; static int p_et; #ifdef FEAT_MBYTE @@ -205,6 +210,9 @@ static char_u *p_nf; static char_u *p_oft; #endif static int p_pi; +#ifdef FEAT_TEXTOBJ +static char_u *p_qe; +#endif static int p_ro; #ifdef FEAT_SMARTINDENT static int p_si; @@ -624,6 +632,15 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif }, + {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, +#ifdef FEAT_COMPL_FUNC + (char_u *)&p_cfu, PV_CFU, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + }, {"confirm", "cf", P_BOOL|P_VI_DEF, #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) (char_u *)&p_confirm, PV_NONE, @@ -1658,6 +1675,15 @@ static struct vimoption {"prompt", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L}}, + {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, +#ifdef FEAT_TEXTOBJ + (char_u *)&p_qe, PV_QE, + {(char_u *)"\\", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + }, {"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, (char_u *)&p_ro, PV_RO, {(char_u *)FALSE, (char_u *)0L}}, @@ -4375,6 +4401,9 @@ check_buf_options(buf) check_string_option(&buf->b_p_cms); #endif check_string_option(&buf->b_p_nf); +#ifdef FEAT_TEXTOBJ + check_string_option(&buf->b_p_qe); +#endif #ifdef FEAT_SYN_HL check_string_option(&buf->b_p_syn); #endif @@ -4397,6 +4426,9 @@ check_buf_options(buf) #ifdef FEAT_INS_EXPAND check_string_option(&buf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + check_string_option(&buf->b_p_cfu); +#endif #ifdef FEAT_KEYMAP check_string_option(&buf->b_p_keymap); #endif @@ -5793,6 +5825,7 @@ set_chars_option(varp) { {&lcs_eol, "eol"}, {&lcs_ext, "extends"}, + {&lcs_nbsp, "nbsp"}, {&lcs_prec, "precedes"}, {&lcs_tab2, "tab"}, {&lcs_trail, "trail"}, @@ -7871,6 +7904,9 @@ get_varp(p) #ifdef FEAT_INS_EXPAND case PV_CPT: return (char_u *)&(curbuf->b_p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + case PV_CFU: return (char_u *)&(curbuf->b_p_cfu); +#endif case PV_EOL: return (char_u *)&(curbuf->b_p_eol); case PV_ET: return (char_u *)&(curbuf->b_p_et); #ifdef FEAT_MBYTE @@ -7909,6 +7945,9 @@ get_varp(p) case PV_OFT: return (char_u *)&(curbuf->b_p_oft); #endif case PV_PI: return (char_u *)&(curbuf->b_p_pi); +#ifdef FEAT_TEXTOBJ + case PV_QE: return (char_u *)&(curbuf->b_p_qe); +#endif case PV_RO: return (char_u *)&(curbuf->b_p_ro); #ifdef FEAT_SMARTINDENT case PV_SI: return (char_u *)&(curbuf->b_p_si); @@ -8173,6 +8212,9 @@ buf_copy_options(buf, flags) #ifdef FEAT_INS_EXPAND buf->b_p_cpt = vim_strsave(p_cpt); #endif +#ifdef FEAT_COMPL_FUNC + buf->b_p_cfu = vim_strsave(p_cfu); +#endif buf->b_p_sts = p_sts; buf->b_p_sts_nopaste = p_sts_nopaste; #ifndef SHORT_FNAME @@ -8256,6 +8298,9 @@ buf_copy_options(buf, flags) buf->b_p_dict = empty_option; buf->b_p_tsr = empty_option; #endif +#ifdef FEAT_TEXTOBJ + buf->b_p_qe = vim_strsave(p_qe); +#endif /* * Don't copy the options set by ex_help(), use the saved values, diff --git a/src/os_unix.c b/src/os_unix.c index 597ca3d341..7b9d328f0f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5391,6 +5391,7 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) { # if defined(USE_DLOPEN) void *hinstLib; + char *dlerr = NULL; # else shl_t hinstLib; # endif @@ -5407,6 +5408,13 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) | RTLD_LOCAL # endif ); + if (hinstLib == NULL) + { + /* "dlerr" must be used before dlclose() */ + dlerr = (char *)dlerror(); + if (dlerr != NULL) + EMSG2(_("dlerror = \"%s\""), dlerr); + } # else hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L); # endif @@ -5423,6 +5431,7 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) if (SETJMP(lc_jump_env) != 0) { success = FALSE; + dlerr = NULL; mch_didjmp(); } else @@ -5435,12 +5444,17 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) { # if defined(USE_DLOPEN) ProcAdd = (STRPROCSTR)dlsym(hinstLib, (const char *)funcname); + dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, TYPE_PROCEDURE, (void *)&ProcAdd) < 0) ProcAdd = NULL; # endif - if ((success = (ProcAdd != NULL))) + if ((success = (ProcAdd != NULL +# if defined(USE_DLOPEN) + && dlerr == NULL +# endif + ))) { if (string_result == NULL) retval_int = ((STRPROCINT)ProcAdd)(argstring); @@ -5452,12 +5466,17 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) { # if defined(USE_DLOPEN) ProcAddI = (INTPROCSTR)dlsym(hinstLib, (const char *)funcname); + dlerr = (char *)dlerror(); # else if (shl_findsym(&hinstLib, (const char *)funcname, TYPE_PROCEDURE, (void *)&ProcAddI) < 0) ProcAddI = NULL; # endif - if ((success = (ProcAddI != NULL))) + if ((success = (ProcAddI != NULL +# if defined(USE_DLOPEN) + && dlerr == NULL +# endif + ))) { if (string_result == NULL) retval_int = ((INTPROCINT)ProcAddI)(argint); @@ -5492,8 +5511,12 @@ mch_libcall(libname, funcname, argstring, argint, string_result, number_result) # endif # endif - /* Free the DLL module. */ # if defined(USE_DLOPEN) + /* "dlerr" must be used before dlclose() */ + if (dlerr != NULL) + |