diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_ming.mak | 4 | ||||
-rw-r--r-- | src/buffer.c | 88 | ||||
-rw-r--r-- | src/eval.c | 59 | ||||
-rw-r--r-- | src/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/ex_docmd.c | 14 | ||||
-rw-r--r-- | src/ex_eval.c | 145 | ||||
-rw-r--r-- | src/fileio.c | 4 | ||||
-rw-r--r-- | src/gui_kde_wid.cc | 53 | ||||
-rw-r--r-- | src/mark.c | 85 | ||||
-rw-r--r-- | src/misc1.c | 8 | ||||
-rw-r--r-- | src/normal.c | 7 | ||||
-rw-r--r-- | src/option.c | 20 | ||||
-rw-r--r-- | src/os_riscos.c | 2 | ||||
-rw-r--r-- | src/os_win32.c | 6 | ||||
-rw-r--r-- | src/po/sv.po | 12 | ||||
-rw-r--r-- | src/proto/ex_eval.pro | 2 | ||||
-rw-r--r-- | src/proto/mark.pro | 1 | ||||
-rw-r--r-- | src/proto/misc1.pro | 2 | ||||
-rw-r--r-- | src/regexp.c | 186 | ||||
-rw-r--r-- | src/structs.h | 11 | ||||
-rw-r--r-- | src/syntax.c | 13 | ||||
-rw-r--r-- | src/testdir/test.ok | 92 | ||||
-rw-r--r-- | src/testdir/test24.in | bin | 330 -> 890 bytes | |||
-rw-r--r-- | src/testdir/test24.ok | 12 | ||||
-rw-r--r-- | src/testdir/test44.in | 11 | ||||
-rw-r--r-- | src/testdir/test44.ok | 5 | ||||
-rw-r--r-- | src/vim.h | 1 |
27 files changed, 746 insertions, 99 deletions
diff --git a/src/Make_ming.mak b/src/Make_ming.mak index e292817c0f..2c8755cac8 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -117,7 +117,7 @@ endif # c:/windows/system32 isn't a good idea, use some other dir; # to build you can put them in temp dir) ifndef MZSCHEME_LIBDIR -MZSCHEME_LIBDIR=$(MZSCHEME) +MZSCHEME_LIBDIR=-L$(MZSCHEME) endif endif @@ -510,7 +510,7 @@ uninstal.exe: uninstal.c $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) $(TARGET): $(OUTDIR) $(OBJ) - $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -L $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB) + $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(RUBYLIB) upx: exes upx gvim.exe diff --git a/src/buffer.c b/src/buffer.c index 9f29b27510..cfca9394e1 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -565,6 +565,7 @@ buf_freeall(buf, del_buf, wipe_buf) #ifdef FEAT_SYN_HL syntax_clear(buf); /* reset syntax info */ #endif + buf->b_flags &= ~BF_READERR; /* a read error is no longer relevant */ } /* @@ -670,17 +671,23 @@ goto_buffer(eap, start, dir, count) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { - int old_got_int = got_int; +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + cleanup_T cs; - /* Quitting means closing the split window, nothing else. - * Reset got_int here, because it causes aborting() to return TRUE - * which breaks closing a window. */ - got_int = FALSE; + /* Reset the error/interrupt/exception state here so that + * aborting() returns FALSE when closing a window. */ + enter_cleanup(&cs); +# endif + /* Quitting means closing the split window, nothing else. */ win_close(curwin, TRUE); - - got_int |= old_got_int; swap_exists_action = SEA_NONE; + +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not discarded by a + * new aborting error, interrupt, or uncaught exception. */ + leave_cleanup(&cs); +# endif } else handle_swap_exists(old_curbuf); @@ -697,37 +704,58 @@ goto_buffer(eap, start, dir, count) handle_swap_exists(old_curbuf) buf_T *old_curbuf; { - int old_got_int = got_int; - - /* Reset got_int here, because it causes aborting() to return TRUE which - * breaks closing a buffer. */ - got_int = FALSE; +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + cleanup_T cs; +# endif if (swap_exists_action == SEA_QUIT) { +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Reset the error/interrupt/exception state here so that + * aborting() returns FALSE when closing a buffer. */ + enter_cleanup(&cs); +# endif + /* User selected Quit at ATTENTION prompt. Go back to previous * buffer. If that buffer is gone or the same as the current one, * open a new, empty buffer. */ swap_exists_action = SEA_NONE; /* don't want it again */ close_buffer(curwin, curbuf, DOBUF_UNLOAD); if (!buf_valid(old_curbuf) || old_curbuf == curbuf) - old_curbuf = buflist_new(NULL, NULL, 1L, - BLN_CURBUF | BLN_LISTED | BLN_FORCE); + old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED); if (old_curbuf != NULL) enter_buffer(old_curbuf); /* If "old_curbuf" is NULL we are in big trouble here... */ + +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not discarded by a + * new aborting error, interrupt, or uncaught exception. */ + leave_cleanup(&cs); +# endif } else if (swap_exists_action == SEA_RECOVER) { +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Reset the error/interrupt/exception state here so that + * aborting() returns FALSE when closing a buffer. */ + enter_cleanup(&cs); +# endif + /* User selected Recover at ATTENTION prompt. */ msg_scroll = TRUE; ml_recover(); MSG_PUTS("\n"); /* don't overwrite the last message */ cmdline_row = msg_row; do_modelines(FALSE); + +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not discarded by a + * new aborting error, interrupt, or uncaught exception. */ + leave_cleanup(&cs); +# endif } swap_exists_action = SEA_NONE; - got_int |= old_got_int; + } #endif @@ -1347,11 +1375,13 @@ enter_buffer(buf) /* Make sure the buffer is loaded. */ if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */ { +#ifdef FEAT_AUTOCMD /* If there is no filetype, allow for detecting one. Esp. useful for * ":ball" used in a autocommand. If there already is a filetype we * might prefer to keep it. */ if (*curbuf->b_p_ft == NUL) did_filetype = FALSE; +#endif open_buffer(FALSE, NULL); } @@ -1408,7 +1438,6 @@ enter_buffer(buf) * If (flags & BLN_CURBUF) is TRUE, may use current buffer. * If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list. * If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer. - * If (flags & BLN_FORCE) is TRUE, don't abort on an error. * This is the ONLY way to create a new buffer. */ static int top_file_num = 1; /* highest file number */ @@ -1484,7 +1513,7 @@ buflist_new(ffname, sfname, lnum, flags) apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf); # ifdef FEAT_EVAL /* autocmds may abort script processing */ - if (!(flags & BLN_FORCE) && aborting()) + if (aborting()) return NULL; # endif #endif @@ -1538,7 +1567,7 @@ buflist_new(ffname, sfname, lnum, flags) return NULL; #if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) /* autocmds may abort script processing */ - if (!(flags & BLN_FORCE) && aborting()) + if (aborting()) return NULL; #endif /* buf->b_nwindows = 0; why was this here? */ @@ -1615,7 +1644,7 @@ buflist_new(ffname, sfname, lnum, flags) apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf); # ifdef FEAT_EVAL /* autocmds may abort script processing */ - if (!(flags & BLN_FORCE) && aborting()) + if (aborting()) return NULL; # endif } @@ -4262,18 +4291,25 @@ ex_buffer_all(eap) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (swap_exists_action == SEA_QUIT) { - int old_got_int = got_int; +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + cleanup_T cs; - /* User selected Quit at ATTENTION prompt; close this window. - * Reset got_int here, because it causes aborting() to return - * TRUE which breaks closing a window. */ - got_int = FALSE; + /* Reset the error/interrupt/exception state here so that + * aborting() returns FALSE when closing a window. */ + enter_cleanup(&cs); +# endif + /* User selected Quit at ATTENTION prompt; close this window. */ win_close(curwin, TRUE); --open_wins; - - got_int |= old_got_int; swap_exists_action = SEA_NONE; + +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not + * discarded by a new aborting error, interrupt, or uncaught + * exception. */ + leave_cleanup(&cs); +# endif } else handle_swap_exists(NULL); diff --git a/src/eval.c b/src/eval.c index 756c5fe75a..df83da5a8a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2933,7 +2933,7 @@ static struct fst {"synID", 3, 3, f_synID}, {"synIDattr", 2, 3, f_synIDattr}, {"synIDtrans", 1, 1, f_synIDtrans}, - {"system", 1, 1, f_system}, + {"system", 1, 2, f_system}, {"tempname", 0, 0, f_tempname}, {"tolower", 1, 1, f_tolower}, {"toupper", 1, 1, f_toupper}, @@ -7570,16 +7570,52 @@ f_system(argvars, retvar) VAR argvars; VAR retvar; { + char_u *res = NULL; char_u *p; + char_u *infile = NULL; + char_u buf[NUMBUFLEN]; + int err = FALSE; + FILE *fd; + + if (argvars[1].var_type != VAR_UNKNOWN) + { + /* + * Write the string to a temp file, to be used for input of the shell + * command. + */ + if ((infile = vim_tempname('i')) == NULL) + { + EMSG(_(e_notmp)); + return; + } + + fd = mch_fopen((char *)infile, WRITEBIN); + if (fd == NULL) + { + EMSG2(_(e_notopen), infile); + goto done; + } + p = get_var_string_buf(&argvars[1], buf); + if (fwrite(p, STRLEN(p), 1, fd) != 1) + err = TRUE; + if (fclose(fd) != 0) + err = TRUE; + if (err) + { + EMSG(_("E677: Error writing temp file")); + goto done; + } + } + + res = get_cmd_output(get_var_string(&argvars[0]), infile, SHELL_SILENT); - p = get_cmd_output(get_var_string(&argvars[0]), SHELL_SILENT); #ifdef USE_CR /* translate <CR> into <NL> */ - if (p != NULL) + if (res != NULL) { char_u *s; - for (s = p; *s; ++s) + for (s = res; *s; ++s) { if (*s == CAR) *s = NL; @@ -7588,12 +7624,12 @@ f_system(argvars, retvar) #else # ifdef USE_CRNL /* translate <CR><NL> into <NL> */ - if (p != NULL) + if (res != NULL) { char_u *s, *d; - d = p; - for (s = p; *s; ++s) + d = res; + for (s = res; *s; ++s) { if (s[0] == CAR && s[1] == NL) ++s; @@ -7603,8 +7639,15 @@ f_system(argvars, retvar) } # endif #endif + +done: + if (infile != NULL) + { + mch_remove(infile); + vim_free(infile); + } retvar->var_type = VAR_STRING; - retvar->var_val.var_string = p; + retvar->var_val.var_string = res; } /* diff --git a/src/ex_cmds.h b/src/ex_cmds.h index d687d8992c..7a3f4acf6b 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -276,6 +276,8 @@ EX(CMD_cwindow, "cwindow", ex_cwindow, RANGE|NOTADR|COUNT|TRLBAR), EX(CMD_delete, "delete", ex_operators, RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY), +EX(CMD_delmarks, "delmarks", ex_delmarks, + BANG|EXTRA|TRLBAR|CMDWIN), EX(CMD_debug, "debug", ex_debug, NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), EX(CMD_debuggreedy, "debuggreedy", ex_debuggreedy, diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a0c07201d2..418de48e25 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -6679,10 +6679,24 @@ do_exedit(eap, old_curwin) need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1); if (!need_hide || P_HID(curbuf)) { +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + cleanup_T cs; + + /* Reset the error/interrupt/exception state here so that + * aborting() returns FALSE when closing a window. */ + enter_cleanup(&cs); +# endif # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif win_close(curwin, !need_hide && !P_HID(curbuf)); + +# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) + /* Restore the error/interrupt/exception state if not + * discarded by a new aborting error, interrupt, or + * uncaught exception. */ + leave_cleanup(&cs); +# endif } } #endif diff --git a/src/ex_eval.c b/src/ex_eval.c index 284ae3f884..8be11e13b0 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1820,6 +1820,151 @@ ex_endtry(eap) } /* + * Function to be called before a failed command invokes a sequence of + * autocommands for cleanup. (Failure means here that a call to emsg() has + * been made, an interrupt occurred, or there is an uncaught exception from a + * previous autocommand execution of the same command.) This function works a + * bit like ex_finally() except that there was not actually an extra try block + * around the part that failed and an error or interrupt has not (yet) been + * converted to an exception. This function saves the + * error/interrupt/exception state and prepares for the call to do_cmdline() + * that is going to be made for the cleanup autocommand execution. + * + * Stores the pending error/interrupt/exception state in the cleanup_T + * structure pointed to by "csp", which has to be passed as an argument to + * leave_cleanup() after the autocommand execution has finished. + */ + void +enter_cleanup(csp) + cleanup_T *csp; +{ + int pending = CSTP_NONE; + + /* + * Postpone did_emsg, got_int, did_throw. The pending values will be + * restored by leave_cleanup() except if there was an aborting error, + * interrupt, or uncaught exception after this function ends. + */ + if (did_emsg || got_int || did_throw || need_rethrow) + { + csp->pending = (did_emsg ? CSTP_ERROR : 0) + | (got_int ? CSTP_INTERRUPT : 0) + | (did_throw ? CSTP_THROW : 0) + | (need_rethrow ? CSTP_THROW : 0); + + /* If we are currently throwing an exception (did_throw), save it as + * well. On an error not yet converted to an exception, update + * "force_abort" and reset "cause_abort" (as do_errthrow() would do). + * This is needed for the do_cmdline() call that is going to be made + * for autocommand execution. We need not save *msg_list because + * there is an extra instance for every call of do_cmdline(), anyway. + */ + if (did_throw || need_rethrow) + csp->exception = current_exception; + else + { + csp->exception = NULL; + if (did_emsg) + { + force_abort |= cause_abort; + cause_abort = FALSE; + } + } + did_emsg = got_int = did_throw = need_rethrow = FALSE; + + /* Report if required by the 'verbose' option or when debugging. */ + report_make_pending(pending, csp->exception); + } + else + { + csp->pending = CSTP_NONE; + csp->exception = NULL; + } +} + +/* + * Function to be called after a failed command invoked a sequence of + * autocommands for cleanup. It is a bit like ex_endtry() except that there + * was not actually an extra try block around the part that failed and an + * error or interrupt had not (yet) been converted to an exception when the + * cleanup autocommand sequence was invoked. This function has to be called + * with the address of the cleanup_T structure filled by enter_cleanup() as an + * argument; it restores the error/interrupt/exception state saved by that + * function - except there was an aborting error, an interrupt or an uncaught + * exception during execution of the cleanup autocommands. In the latter + * case, the saved error/interrupt/ exception state is discarded. + */ + void +leave_cleanup(csp) + cleanup_T *csp; +{ + int pending = csp->pending; + + if (pending == CSTP_NONE) /* nothing to do */ + return; + + /* If there was an aborting error, an interrupt, or an uncaught exception + * after the corresponding call to enter_cleanup(), discard what has been + * made pending by it. Report this to the user if required by the + * 'verbose' option or when debugging. */ + if (aborting() || need_rethrow) + { + if (pending & CSTP_THROW) + /* Cancel the pending exception (includes report). */ + discard_exception((except_T *)csp->exception, FALSE); + else + report_discard_pending(pending, NULL); + + /* If an error was about to be converted to an exception when + * enter_cleanup() was called, free the message list. */ + free_msglist(*msg_list); + *msg_list = NULL; + } + + /* + * If there was no new error, interrupt, or throw between the calls + * to enter_cleanup() and leave_cleanup(), restore the pending + * error/interrupt/exception state. + */ + else + { + /* + * If there was an exception being thrown when enter_cleanup() was + * called, we need to rethrow it. Make it the exception currently + * being thrown. + */ + if (pending & CSTP_THROW) + current_exception = csp->exception; + + /* + * If an error was about to be converted to an exception when + * enter_cleanup() was called, let "cause_abort" take the part of + * "force_abort" (as done by cause_errthrow()). + */ + else if (pending & CSTP_ERROR) + { + cause_abort = force_abort; + force_abort = FALSE; + } + + /* + * Restore the pending values of did_emsg, got_int, and did_throw. + */ + if (pending & CSTP_ERROR) + did_emsg = TRUE; + if (pending & CSTP_INTERRUPT) + got_int = TRUE; + if (pending & CSTP_THROW) + need_rethrow = TRUE; /* did_throw will be set by do_one_cmd() */ + + /* Report if required by the 'verbose' option or when debugging. */ + report_resume_pending(pending, + (pending & CSTP_THROW) ? (void *)current_exception : NULL); + } +} + + +/* * Make conditionals inactive and discard what's pending in finally clauses * until the conditional type searched for or a try conditional not in its * finally clause is reached. If this is in an active catch clause, finish the diff --git a/src/fileio.c b/src/fileio.c index b82cd4a6e7..c925775a9b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3832,8 +3832,10 @@ restore_backup: #ifdef FEAT_MBYTE /* * The BOM is written just after the encryption magic number. + * Skip it when appending and the file already existed, the BOM only makes + * sense at the start of the file. */ - if (buf->b_p_bomb && !write_bin) + if (buf->b_p_bomb && !write_bin && (!append || perm < 0)) { write_info.bw_len = make_bom(buffer, fenc); if (write_info.bw_len > 0) diff --git a/src/gui_kde_wid.cc b/src/gui_kde_wid.cc index 91ea10be12..fefbe9a4b9 100644 --- a/src/gui_kde_wid.cc +++ b/src/gui_kde_wid.cc @@ -154,9 +154,9 @@ void gui_keypress(QKeyEvent *e); int gui_mch_haskey(char_u * name)//{{{ { - for (int i=0; special_keys[i].qtkey != 0; i++) - if (name[0] == special_keys[i].code0 && - name[1] == special_keys[i].code1) + for (int i = 0; special_keys[i].qtkey != 0; i++) + if (name[0] == special_keys[i].code0 + && name[1] == special_keys[i].code1) return OK; return FAIL; }//}}} @@ -164,20 +164,20 @@ gui_mch_haskey(char_u * name)//{{{ /* * custom Frame for drawing ... */ -void VimWidget::paintEvent( QPaintEvent *e)//{{{ +void VimWidget::paintEvent(QPaintEvent *e)//{{{ { QRect r = e->rect(); - gui_redraw(r.x(), r.y(), r.width(), r.height() ); + gui_redraw(r.x(), r.y(), r.width(), r.height()); }//}}} void VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{ { - gui.current_font->setBold( flags & DRAW_BOLD ); - gui.current_font->setUnderline( flags & DRAW_UNDERL ); + gui.current_font->setBold(flags & DRAW_BOLD); + gui.current_font->setUnderline(flags & DRAW_UNDERL); gui.current_font->setItalic(flags & DRAW_ITALIC); - painter->setBackgroundMode( flags & DRAW_TRANSP ? Qt::TransparentMode : Qt::OpaqueMode); - painter->setFont( *(gui.current_font) ); - painter->drawText( x, y, s, len); + painter->setBackgroundMode(flags & DRAW_TRANSP ? Qt::TransparentMode : Qt::OpaqueMode); + painter->setFont(*(gui.current_font)); + painter->drawText(x, y, s, len); }//}}} void VimWidget::mousePressEvent(QMouseEvent *event)//{{{ @@ -1165,36 +1165,9 @@ void VimMainWindow::showAboutApplication()//{{{ I18N_NOOP("NetBSD configure/compilation fixes") ); aboutData->setLicenseText( -"KVim as an extension of Vim follows Vim license : \n\ -Vim is Charityware. You can use and copy it as much as you like, but you are\n\ -encouraged to make a donation to orphans in Uganda. Please read the file\n\ -runtime/doc/uganda.txt for details.\n\ -\n\ -There are no restrictions on distributing an unmodified copy of Vim. Parts of\n\ -Vim may also be distributed, but this text must always be included. You are\n\ -allowed to include executables that you made from the unmodified Vim sources,\n\ -your own usage examples and Vim scripts.\n\ -\n\ -If you distribute a modified version of Vim, you are encouraged to send the\n\ -maintainer a copy, including the source code. Or make it available to the\n\ -maintainer through ftp; let him know where it can be found. If the number of\n\ -changes is small (e.g., a modified Makefile) e-mailing the diffs will do.\n\ -When the maintainer asks for it (in any way) you must make your changes,\n\ -including source code, available to him.\n\ -\n\ -The maintainer reserves the right to include any changes in the official\n\ -version of Vim. This is negotiable. You are not allowed to distribute a\n\ -modified version of Vim when you are not willing to make the source code\n\ -available to the maintainer.\n\ -\n\ -The current maintainer is Bram Moolenaar <Bram@vim.org>. If this changes, it\n\ -will be announced in appropriate places (most likely www.vim.org and\n\ -comp.editors). When it is completely impossible to contact the maintainer,\n\ -the obligation to send him modified source code ceases.\n\ -\n\ -It is not allowed to remove these restrictions from the distribution of the\n\ -Vim sources or parts of it. These restrictions may also be used for previous\n\ -Vim releases instead of the text that was included with it."); +"KVim as an extension of Vim follows Vim license.\n\ +You can read it with \":help license\"\n\ +Or read the file $VIMRUNTIME/doc/uganda.txt."); KAboutApplication *about = new KAboutApplication(aboutData); about->show(); diff --git a/src/mark.c b/src/mark.c index e1b800eb18..ea941e59bc 100644 --- a/src/mark.c +++ b/src/mark.c @@ -743,6 +743,91 @@ show_one_mark(c, arg, p, name, current) } } +/* + * ":delmarks[!] [marks]" + */ + void +ex_delmarks(eap) + exarg_T *eap; +{ + char_u *p; + int from, to; + int i; + int lower; + int digit; + int n; + + if (*eap->arg == NUL && eap->forceit) + /* clear all marks */ + clrallmarks(curbuf); + else if (eap->forceit) + EMSG(_(e_invarg)); + else if (*eap->arg == NUL) + EMSG(_(e_argreq)); + else + { + /* clear specified marks only */ + for (p = eap->arg; *p != NUL; ++p) + { + lower = ASCII_ISLOWER(*p); + digit = VIM_ISDIGIT(*p); + if (lower || digit || ASCII_ISUPPER(*p)) + { + if (p[1] == '-') + { + /* clear range of marks */ + from = *p; + to = p[2]; + if (!(lower ? ASCII_ISLOWER(p[2]) + : (digit ? VIM_ISDIGIT(p[2]) + : ASCII_ISUPPER(p[2]))) + || to < from) + { + EMSG2(_(e_invarg2), p); + return; + } + p += 2; + } + else + /* clear one lower case mark */ + from = to = *p; + + for (i = from; i <= to; ++i) + { + if (lower) + curbuf->b_namedm[i - 'a'].lnum = 0; + else + { + if (digit) + n = i - '0' + NMARKS; + else + n = i - 'A'; + namedfm[n].fmark.mark.lnum = 0; + vim_free(namedfm[n].fname); + namedfm[n].fname = NULL; + } + } + } + else + switch (*p) + { + case '"': curbuf->b_last_cursor.lnum = 0; break; + case '^': curbuf->b_last_insert.lnum = 0; break; + case '.': curbuf->b_last_change.lnum = 0; break; + case '[': curbuf->b_op_start.lnum = 0; break; + case ']': curbuf->b_op_end.lnum = 0; break; +#ifdef FEAT_VISUAL + case '<': curbuf->b_visual_start.lnum = 0; break; + case '>': curbuf->b_visual_end.lnum = 0; break; +#endif + case ' ': break; + default: EMSG2(_(e_invarg2), p); + return; + } + } + } +} + #if defined(FEAT_JUMPLIST) || defined(PROTO) /* * print the jumplist diff --git a/src/misc1.c b/src/misc1.c index 9558cc5ff8..ec744861e1 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -8352,7 +8352,8 @@ expand_backtick(gap, pat, flags) buffer = eval_to_string(cmd + 1, &p); else #endif - buffer = get_cmd_output(cmd, (flags & EW_SILENT) ? SHELL_SILENT : 0); + buffer = get_cmd_output(cmd, NULL, + (flags & EW_SILENT) ? SHELL_SILENT : 0); vim_free(cmd); if (buffer == NULL) return 0; @@ -8451,8 +8452,9 @@ addfile(gap, f, flags) * Returns an allocated string, or NULL for error. */ char_u * -get_cmd_output(cmd, flags) +get_cmd_output(cmd, infile, flags) char_u *cmd; + char_u *infile; /* optional input file name */ int flags; /* can be SHELL_SILENT */ { char_u *tempname; @@ -8473,7 +8475,7 @@ get_cmd_output(cmd, flags) } /* Add the redirection stuff */ - command = make_filter_cmd(cmd, NULL, tempname); + command = make_filter_cmd(cmd, infile, tempname); if (command == NULL) goto done; diff --git a/src/normal.c b/src/normal.c index 8ea4ba64ce..633f2093fa 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1078,8 +1078,11 @@ getcount: goto normal_end; } - msg_didout = FALSE; /* don't scroll screen up for normal command */ - msg_col = 0; + if (ca.cmdchar != K_IGNORE) + { + msg_didout = FALSE; /* don't scroll screen up for normal command */ + msg_col = 0; + } #ifdef FEAT_VISUAL old_pos = curwin->w_cursor; /* remember where cursor was */ diff --git a/src/option.c b/src/option.c index 0b36dfef12..9ab334457a 100644 --- a/src/option.c +++ b/src/option.c @@ -2868,6 +2868,21 @@ set_init_1() options[opt_idx].def_val[VI_DEFAULT] = p_enc; options[opt_idx].flags |= P_DEF_ALLOCED; +#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) \ + || defined(VMS) + if (STRCMP(p_enc, "latin1") == 0 +# ifdef FEAT_MBYTE + || enc_utf8 +# endif + ) + { + /* Adjust the default for 'isprint' to match latin1. */ + set_string_option_direct((char_u *)"isp", -1, + (char_u *)"@,161-255", OPT_FREE); + (void)init_chartab(); + } +#endif + # if defined(WIN3264) && !defined(FEAT_GUI) /* Win32 console: When GetACP() returns a different value from * GetConsoleCP() set 'termencoding'. */ @@ -4673,6 +4688,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, char_u *s, *p; int did_chartab = FALSE; char_u **gvarp; + int free_oldval = (options[opt_idx].flags & P_ALLOCED); /* Get the global option to compare with, otherwise we would have to check * two values for all local options. */ @@ -5818,8 +5834,10 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #endif /* * Free string options that are in allocated memory. + * Use "free_oldval", because recursiveness may change the flags under + * our fingers (esp. init_highlight()). */ - if (options[opt_idx].flags & P_ALLOCED) + if (free_oldval) free_string_option(oldval); if (new_value_alloced) options[opt_idx].flags |= P_ALLOCED; diff --git a/src/os_riscos.c b/src/os_riscos.c index a1cdab4035..7c6758b9f7 100644 --- a/src/os_riscos.c +++ b/src/os_riscos.c @@ -654,7 +654,7 @@ mch_can_exe(name) if (buf == NULL) return -1; sprintf((char *)buf, "which %s", name); - p = get_cmd_output(buf, SHELL_SILENT); + p = get_cmd_output(buf, NULL, SHELL_SILENT); vim_free(buf); if (p == NULL) return -1; diff --git a/src/os_win32.c b/src/os_win32.c index a39e00508c..bc6c7d4fd7 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -3926,10 +3926,10 @@ mch_write( else if (s[0] == ESC && len >= 3-1 && s[1] == '|') { #ifdef MCH_WRITE_DUMP - char_u* old_s = s; + char_u *old_s = s; #endif - char_u* p; - int arg1 = 0, arg2 = 0; + char_u *p; + int arg1 = 0, arg2 = 0; switch (s[2]) { diff --git a/src/po/sv.po b/src/po/sv.po index 4f84b2173e..2fe361e65a 100644 --- a/src/po/sv.po +++ b/src/po/sv.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Vim 6.2\n" "POT-Creation-Date: 2004-01-30 11:57+0100\n" -"PO-Revision-Date: 2004-04-24 21:54+0200\n" +"PO-Revision-Date: 2004-09-07 17:10%z\n" "Last-Translator: Johan Svedberg <johan@svedberg.pp.se>\n" "Language-Team: Swedish <sv@li.org>\n" "MIME-Version: 1.0\n" @@ -1357,7 +1357,7 @@ msgstr "E192: Rekursiv användning av :normal för djup" #: ex_docmd.c:8033 msgid "E194: No alternate file name to substitute for '#'" -msgstr "E194: Inget alternativt filnamn att byta ut '#' med" +msgstr "E194: Inget alternativt filnamn att ersätta '#' med" #: ex_docmd.c:8064 msgid "E495: no autocommand file name to substitute for \"<afile>\"" @@ -1369,11 +1369,11 @@ msgstr "E496: inget autokommando-buffernummer att ersätta \"<abuf>\" med" #: ex_docmd.c:8083 msgid "E497: no autocommand match name to substitute for \"<amatch>\"" -msgstr "E497: inget autokommando-träffnamn att byta ut \"<amatch>\" med" +msgstr "E497: inget autokommando-träffnamn att ersätta \"<amatch>\" med" #: ex_docmd.c:8093 msgid "E498: no :source file name to substitute for \"<sfile>\"" -msgstr "E498: inget :source-filnamn att byta ut \"<sfile>\" med" +msgstr "E498: inget :source-filnamn att ersätta \"<sfile>\" med" |