diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-01-19 22:09:32 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-01-19 22:09:32 +0000 |
commit | 05a7bb363b6ae132b7f2550be1a588e481a5dfa3 (patch) | |
tree | 97c44382074f466a7c5a3c31f8debe0127473ade /src | |
parent | c32840f2674d4c6b06cfac8ec32791b5451bf31c (diff) |
updated for version 7.0182
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 7 | ||||
-rw-r--r-- | src/ex_docmd.c | 70 | ||||
-rw-r--r-- | src/normal.c | 21 | ||||
-rw-r--r-- | src/os_unix.c | 2 | ||||
-rw-r--r-- | src/proto/ex_getln.pro | 2 | ||||
-rw-r--r-- | src/vim.h | 1 | ||||
-rw-r--r-- | src/window.c | 6 |
7 files changed, 74 insertions, 35 deletions
diff --git a/src/buffer.c b/src/buffer.c index 1190117915..677215d2d3 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1806,10 +1806,11 @@ buflist_getfile(n, lnum, options, forceit) if (buf == curbuf) return OK; -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) + if (editing_cmdline()) + { + editing_cmdline_msg(); return FAIL; -#endif + } /* altfpos may be changed by getfile(), get it now */ if (lnum == 0) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index e15c6c5d7b..fe9cd6bc15 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2026,7 +2026,17 @@ do_one_cmd(cmdlinep, sourcing, } else if (ea.addr_count != 0) { - if (ea.line2 < 0 || ea.line2 > curbuf->b_ml.ml_line_count) + if (ea.line2 > curbuf->b_ml.ml_line_count) + { + /* With '-' in 'cpoptions' a line number past the file is an + * error, otherwise put it at the end of the file. */ + if (vim_strchr(p_cpo, CPO_MINUS) != NULL) + ea.line2 = -1; + else + ea.line2 = curbuf->b_ml.ml_line_count; + } + + if (ea.line2 < 0) errormsg = (char_u *)_(e_invrange); else { @@ -2126,18 +2136,22 @@ do_one_cmd(cmdlinep, sourcing, errormsg = (char_u *)_(e_modifiable); goto doend; } -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0 && !(ea.argt & CMDWIN) + + if (editing_cmdline() && !(ea.argt & CMDWIN) # ifdef FEAT_USR_CMDS && !USER_CMDIDX(ea.cmdidx) # endif ) { - /* Command not allowed in cmdline window. */ - errormsg = (char_u *)_(e_cmdwin); + /* Command not allowed when editing the command line. */ +#ifdef FEAT_CMDWIN + if (cmdwin_type != 0) + errormsg = (char_u *)_(e_cmdwin); + else +#endif + errormsg = (char_u *)_(e_secure); goto doend; } -#endif if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { @@ -2977,12 +2991,9 @@ set_one_cmd_context(xp, buff) int forceit = FALSE; int usefilter = FALSE; /* filter instead of file name */ + ExpandInit(xp); xp->xp_pattern = buff; xp->xp_context = EXPAND_COMMANDS; /* Default until we get past command */ - xp->xp_backslash = XP_BS_NONE; -#if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) - xp->xp_arg = NULL; -#endif ea.argt = 0; /* @@ -3254,6 +3265,11 @@ set_one_cmd_context(xp, buff) if (bow != NULL && in_quote) xp->xp_pattern = bow; xp->xp_context = EXPAND_FILES; +#ifndef BACKSLASH_IN_FILENAME + /* For a shell command more chars need to be escaped. */ + if (usefilter || ea.cmdidx == CMD_bang) + xp->xp_shell = TRUE; +#endif /* Check for environment variable */ if (*xp->xp_pattern == '$' @@ -4189,16 +4205,16 @@ expand_filename(eap, cmdlinep, errormsgp) /* For a shell command a '!' must be escaped. */ if ((eap->usefilter || eap->cmdidx == CMD_bang) - && vim_strpbrk(repl, (char_u *)"!&;()") != NULL) + && vim_strpbrk(repl, (char_u *)"!&;()<>") != NULL) { char_u *l; - l = vim_strsave_escaped(repl, (char_u *)"!&;()"); + l = vim_strsave_escaped(repl, (char_u *)"!&;()<>"); if (l != NULL) { vim_free(repl); repl = l; - /* For a sh-like shell escape it another time. */ + /* For a sh-like shell escape "!" another time. */ if (strstr((char *)p_sh, "sh") != NULL) { l = vim_strsave_escaped(repl, (char_u *)"!"); @@ -6017,6 +6033,12 @@ ex_quit(eap) return; } #endif + /* Don't quit while editing the command line. */ + if (editing_cmdline()) + { + editing_cmdline_msg(); + return; + } #ifdef FEAT_NETBEANS_INTG netbeansForcedQuit = eap->forceit; @@ -6079,6 +6101,14 @@ ex_quit_all(eap) return; } # endif + + /* Don't quit while editing the command line. */ + if (editing_cmdline()) + { + editing_cmdline_msg(); + return; + } + exiting = TRUE; if (eap->forceit || !check_changed_any(FALSE)) getout(0); @@ -6098,7 +6128,8 @@ ex_close(eap) cmdwin_result = K_IGNORE; else # endif - ex_win_close(eap, curwin); + if (!editing_cmdline()) + ex_win_close(eap, curwin); } static void @@ -6257,6 +6288,12 @@ ex_exit(eap) return; } #endif + /* Don't quit while editing the command line. */ + if (editing_cmdline()) + { + editing_cmdline_msg(); + return; + } /* * if more files or windows we won't exit @@ -6369,10 +6406,9 @@ handle_drop(filec, filev, split) exarg_T ea; int save_msg_scroll = msg_scroll; -# ifdef FEAT_CMDWIN - if (cmdwin_type != 0) + /* Postpone this while editing the command line. */ + if (editing_cmdline()) return; -# endif /* Check whether the current buffer is changed. If so, we will need * to split the current window or data could be lost. diff --git a/src/normal.c b/src/normal.c index b0262b2225..12ede7375a 100644 --- a/src/normal.c +++ b/src/normal.c @@ -788,15 +788,14 @@ getcount: clearopbeep(oap); goto normal_end; } -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0 && (nv_cmds[idx].cmd_flags & NV_NCW)) + + if (editing_cmdline() && (nv_cmds[idx].cmd_flags & NV_NCW)) { - /* This command is not allowed in the cmdline window: beep. */ + /* This command is not allowed wile editing a ccmdline: beep. */ clearopbeep(oap); - EMSG(_(e_cmdwin)); + editing_cmdline_msg(); goto normal_end; } -#endif #ifdef FEAT_VISUAL /* @@ -3640,6 +3639,7 @@ add_to_showcmd(c) K_RIGHTMOUSE, K_RIGHTDRAG, K_RIGHTRELEASE, K_MOUSEDOWN, K_MOUSEUP, K_X1MOUSE, K_X1DRAG, K_X1RELEASE, K_X2MOUSE, K_X2DRAG, K_X2RELEASE, + K_CURSORHOLD, 0 }; #endif @@ -5741,13 +5741,12 @@ nv_gotofile(cap) { char_u *ptr; -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) + if (editing_cmdline()) { clearopbeep(cap->oap); + editing_cmdline_msg(); return; } -#endif ptr = grab_file_name(cap->count1); @@ -7802,13 +7801,13 @@ nv_g_cmd(cap) /* "gQ": improved Ex mode */ case 'Q': -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) + if (editing_cmdline()) { clearopbeep(cap->oap); + editing_cmdline_msg(); break; } -#endif + if (!checkclearopq(oap)) do_exmode(TRUE); break; diff --git a/src/os_unix.c b/src/os_unix.c index faf2847a63..afc68ff841 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4852,7 +4852,7 @@ mch_expandpath(gap, path, flags) # define SEEK_END 2 #endif -#define SHELL_SPECIAL (char_u *)"\t \"&';<>[\\]|" +#define SHELL_SPECIAL (char_u *)"\t \"&';<>\\|" /* ARGSUSED */ int diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro index fe2752b8d9..3b11a38a79 100644 --- a/src/proto/ex_getln.pro +++ b/src/proto/ex_getln.pro @@ -1,6 +1,8 @@ /* ex_getln.c */ char_u *getcmdline __ARGS((int firstc, long count, int indent)); char_u *getcmdline_prompt __ARGS((int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg)); +int editing_cmdline __ARGS((void)); +void editing_cmdline_msg __ARGS((void)); char_u *getexline __ARGS((int c, void *dummy, int indent)); char_u *getexmodeline __ARGS((int promptc, void *dummy, int indent)); int cmdline_overstrike __ARGS((void)); @@ -324,6 +324,7 @@ # else # define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|") # endif +# define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!") #endif #define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */ diff --git a/src/window.c b/src/window.c index 7d50180478..680c320171 100644 --- a/src/window.c +++ b/src/window.c @@ -2717,13 +2717,13 @@ win_alloc_first() win_goto(wp) win_T *wp; { -#ifdef FEAT_CMDWIN - if (cmdwin_type != 0) + if (editing_cmdline()) { beep_flush(); + editing_cmdline_msg(); return; } -#endif + #ifdef FEAT_VISUAL if (wp->w_buffer != curbuf) reset_VIsual_and_resel(); |