To: vim_dev@googlegroups.com Subject: Patch 9.0.1115 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1115 Problem: Code is indented more than needed. Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan, closes #11758) Files: src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c *** ../vim-9.0.1114/src/ex_cmds.c 2022-12-23 19:05:54.662600613 +0000 --- src/ex_cmds.c 2022-12-30 18:00:41.799227747 +0000 *************** *** 5413,5468 **** // edited in a window yet. It's like ":tab all" but without closing // windows or tabs. ex_all(eap); } - else - { - // ":drop file ...": Edit the first argument. Jump to an existing - // window if possible, edit in current window if the current buffer - // can be abandoned, otherwise open a new window. - buf = buflist_findnr(ARGLIST[0].ae_fnum); ! FOR_ALL_TAB_WINDOWS(tp, wp) { ! if (wp->w_buffer == buf) { ! goto_tabpage_win(tp, wp); ! curwin->w_arg_idx = 0; ! if (!bufIsChanged(curbuf)) ! { ! int save_ar = curbuf->b_p_ar; ! ! // reload the file if it is newer ! curbuf->b_p_ar = TRUE; ! buf_check_timestamp(curbuf, FALSE); ! curbuf->b_p_ar = save_ar; ! } ! return; } } ! /* ! * Check whether the current buffer is changed. If so, we will need ! * to split the current window or data could be lost. ! * Skip the check if the 'hidden' option is set, as in this case the ! * buffer won't be lost. ! */ ! if (!buf_hide(curbuf)) ! { ! ++emsg_off; ! split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); ! --emsg_off; ! } ! ! // Fake a ":sfirst" or ":first" command edit the first argument. ! if (split) ! { ! eap->cmdidx = CMD_sfirst; ! eap->cmd[0] = 's'; ! } ! else ! eap->cmdidx = CMD_first; ! ex_rewind(eap); } } /* --- 5413,5467 ---- // edited in a window yet. It's like ":tab all" but without closing // windows or tabs. ex_all(eap); + return; } ! // ":drop file ...": Edit the first argument. Jump to an existing ! // window if possible, edit in current window if the current buffer ! // can be abandoned, otherwise open a new window. ! buf = buflist_findnr(ARGLIST[0].ae_fnum); ! ! FOR_ALL_TAB_WINDOWS(tp, wp) ! { ! if (wp->w_buffer == buf) { ! goto_tabpage_win(tp, wp); ! curwin->w_arg_idx = 0; ! if (!bufIsChanged(curbuf)) { ! int save_ar = curbuf->b_p_ar; ! ! // reload the file if it is newer ! curbuf->b_p_ar = TRUE; ! buf_check_timestamp(curbuf, FALSE); ! curbuf->b_p_ar = save_ar; } + return; } + } ! /* ! * Check whether the current buffer is changed. If so, we will need ! * to split the current window or data could be lost. ! * Skip the check if the 'hidden' option is set, as in this case the ! * buffer won't be lost. ! */ ! if (!buf_hide(curbuf)) ! { ! ++emsg_off; ! split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD); ! --emsg_off; ! } ! ! // Fake a ":sfirst" or ":first" command edit the first argument. ! if (split) ! { ! eap->cmdidx = CMD_sfirst; ! eap->cmd[0] = 's'; } + else + eap->cmdidx = CMD_first; + ex_rewind(eap); } /* *************** *** 5556,5608 **** char_u *fname; if (l == NULL) msg(_("No old files")); ! else { ! msg_start(); ! msg_scroll = TRUE; ! for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) ! { ! ++nr; ! fname = tv_get_string(&li->li_tv); ! if (!message_filtered(fname)) ! { ! msg_outnum((long)nr); ! msg_puts(": "); ! msg_outtrans(fname); ! msg_clr_eos(); ! msg_putchar('\n'); ! out_flush(); // output one line at a time ! ui_breakcheck(); ! } } ! // Assume "got_int" was set to truncate the listing. ! got_int = FALSE; # ifdef FEAT_BROWSE_CMD ! if (cmdmod.cmod_flags & CMOD_BROWSE) ! { ! quit_more = FALSE; ! nr = prompt_for_number(FALSE); ! msg_starthere(); ! if (nr > 0) ! { ! char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), ! (long)nr); ! ! if (p != NULL) ! { ! p = expand_env_save(p); ! eap->arg = p; ! eap->cmdidx = CMD_edit; ! cmdmod.cmod_flags &= ~CMOD_BROWSE; ! do_exedit(eap, NULL); ! vim_free(p); ! } } } - # endif } } #endif --- 5555,5608 ---- char_u *fname; if (l == NULL) + { msg(_("No old files")); ! return; ! } ! ! msg_start(); ! msg_scroll = TRUE; ! for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) { ! ++nr; ! fname = tv_get_string(&li->li_tv); ! if (!message_filtered(fname)) ! { ! msg_outnum((long)nr); ! msg_puts(": "); ! msg_outtrans(fname); ! msg_clr_eos(); ! msg_putchar('\n'); ! out_flush(); // output one line at a time ! ui_breakcheck(); } + } ! // Assume "got_int" was set to truncate the listing. ! got_int = FALSE; # ifdef FEAT_BROWSE_CMD ! if (cmdmod.cmod_flags & CMOD_BROWSE) ! { ! quit_more = FALSE; ! nr = prompt_for_number(FALSE); ! msg_starthere(); ! if (nr > 0) ! { ! char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), ! (long)nr); ! ! if (p != NULL) ! { ! p = expand_env_save(p); ! eap->arg = p; ! eap->cmdidx = CMD_edit; ! cmdmod.cmod_flags &= ~CMOD_BROWSE; ! do_exedit(eap, NULL); ! vim_free(p); } } } + # endif } #endif *** ../vim-9.0.1114/src/ex_cmds2.c 2022-12-16 16:41:19.208714806 +0000 --- src/ex_cmds2.c 2022-12-30 18:00:41.799227747 +0000 *************** *** 135,153 **** void browse_save_fname(buf_T *buf) { ! if (buf->b_fname == NULL) ! { ! char_u *fname; ! fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ! NULL, NULL, NULL, NULL, buf); ! if (fname != NULL) ! { ! if (setfname(buf, fname, NULL, TRUE) == OK) ! buf->b_flags |= BF_NOTEDITED; ! vim_free(fname); ! } ! } } #endif --- 135,153 ---- void browse_save_fname(buf_T *buf) { ! if (buf->b_fname != NULL) ! return; ! char_u *fname; ! ! fname = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ! NULL, NULL, NULL, NULL, buf); ! if (fname == NULL) ! return; ! ! if (setfname(buf, fname, NULL, TRUE) == OK) ! buf->b_flags |= BF_NOTEDITED; ! vim_free(fname); } #endif *************** *** 731,790 **** // List all compiler scripts. do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); // ) keep the indenter happy... } - else - { - buf = alloc(STRLEN(eap->arg) + 14); - if (buf != NULL) - { - if (eap->forceit) - { - // ":compiler! {name}" sets global options - do_cmdline_cmd((char_u *) - "command -nargs=* CompilerSet set "); - } - else - { - // ":compiler! {name}" sets local options. - // To remain backwards compatible "current_compiler" is always - // used. A user's compiler plugin may set it, the distributed - // plugin will then skip the settings. Afterwards set - // "b:current_compiler" and restore "current_compiler". - // Explicitly prepend "g:" to make it work in a function. - old_cur_comp = get_var_value((char_u *)"g:current_compiler"); - if (old_cur_comp != NULL) - old_cur_comp = vim_strsave(old_cur_comp); - do_cmdline_cmd((char_u *) - "command -nargs=* -keepscript CompilerSet setlocal "); - } - do_unlet((char_u *)"g:current_compiler", TRUE); - do_unlet((char_u *)"b:current_compiler", TRUE); - - sprintf((char *)buf, "compiler/%s.vim", eap->arg); - if (source_runtime(buf, DIP_ALL) == FAIL) - semsg(_(e_compiler_not_supported_str), eap->arg); - vim_free(buf); - - do_cmdline_cmd((char_u *)":delcommand CompilerSet"); ! // Set "b:current_compiler" from "current_compiler". ! p = get_var_value((char_u *)"g:current_compiler"); ! if (p != NULL) ! set_internal_string_var((char_u *)"b:current_compiler", p); ! // Restore "current_compiler" for ":compiler {name}". ! if (!eap->forceit) ! { ! if (old_cur_comp != NULL) ! { ! set_internal_string_var((char_u *)"g:current_compiler", ! old_cur_comp); ! vim_free(old_cur_comp); ! } ! else ! do_unlet((char_u *)"g:current_compiler", TRUE); ! } } } } #endif --- 731,789 ---- // List all compiler scripts. do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); // ) keep the indenter happy... + return; } ! buf = alloc(STRLEN(eap->arg) + 14); ! if (buf == NULL) ! return; ! if (eap->forceit) ! { ! // ":compiler! {name}" sets global options ! do_cmdline_cmd((char_u *) ! "command -nargs=* CompilerSet set "); ! } ! else ! { ! // ":compiler! {name}" sets local options. ! // To remain backwards compatible "current_compiler" is always ! // used. A user's compiler plugin may set it, the distributed ! // plugin will then skip the settings. Afterwards set ! // "b:current_compiler" and restore "current_compiler". ! // Explicitly prepend "g:" to make it work in a function. ! old_cur_comp = get_var_value((char_u *)"g:current_compiler"); ! if (old_cur_comp != NULL) ! old_cur_comp = vim_strsave(old_cur_comp); ! do_cmdline_cmd((char_u *) ! "command -nargs=* -keepscript CompilerSet setlocal "); ! } ! do_unlet((char_u *)"g:current_compiler", TRUE); ! do_unlet((char_u *)"b:current_compiler", TRUE); ! ! sprintf((char *)buf, "compiler/%s.vim", eap->arg); ! if (source_runtime(buf, DIP_ALL) == FAIL) ! semsg(_(e_compiler_not_supported_str), eap->arg); ! vim_free(buf); ! ! do_cmdline_cmd((char_u *)":delcommand CompilerSet"); ! ! // Set "b:current_compiler" from "current_compiler". ! p = get_var_value((char_u *)"g:current_compiler"); ! if (p != NULL) ! set_internal_string_var((char_u *)"b:current_compiler", p); ! ! // Restore "current_compiler" for ":compiler {name}". ! if (!eap->forceit) ! { ! if (old_cur_comp != NULL) ! { ! set_internal_string_var((char_u *)"g:current_compiler", ! old_cur_comp); ! vim_free(old_cur_comp); } + else + do_unlet((char_u *)"g:current_compiler", TRUE); } } #endif *** ../vim-9.0.1114/src/ex_docmd.c 2022-12-04 20:11:12.791828025 +0000 --- src/ex_docmd.c 2022-12-30 18:06:31.842314355 +0000 *************** *** 1739,1745 **** char_u *cmd; int starts_with_colon = FALSE; int may_have_range; - int vim9script; #ifdef FEAT_EVAL int did_set_expr_line = FALSE; #endif --- 1739,1744 ---- *************** *** 1807,1813 **** // In Vim9 script a colon is required before the range. This may also be // after command modifiers. ! vim9script = in_vim9script(); if (vim9script && (flags & DOCMD_RANGEOK) == 0) { may_have_range = FALSE; --- 1806,1812 ---- // In Vim9 script a colon is required before the range. This may also be // after command modifiers. ! int vim9script = in_vim9script(); if (vim9script && (flags & DOCMD_RANGEOK) == 0) { may_have_range = FALSE; *************** *** 6230,6258 **** int tab_number; if (cmdwin_type != 0) cmdwin_result = K_IGNORE; ! else if (first_tabpage->tp_next == NULL) emsg(_(e_cannot_close_last_tab_page)); ! else if (!window_layout_locked(CMD_tabclose)) { ! tab_number = get_tabpage_arg(eap); ! if (eap->errmsg == NULL) ! { ! tp = find_tabpage(tab_number); ! if (tp == NULL) ! { ! beep_flush(); ! return; ! } ! if (tp != curtab) ! { ! tabpage_close_other(tp, eap->forceit); ! return; ! } ! else if (!text_locked() && !curbuf_locked()) ! tabpage_close(eap->forceit); ! } } } /* --- 6229,6265 ---- int tab_number; if (cmdwin_type != 0) + { cmdwin_result = K_IGNORE; ! return; ! } ! ! if (first_tabpage->tp_next == NULL) ! { emsg(_(e_cannot_close_last_tab_page)); ! return; ! } ! ! if (window_layout_locked(CMD_tabclose)) ! return; ! ! tab_number = get_tabpage_arg(eap); ! if (eap->errmsg != NULL) ! return; ! ! tp = find_tabpage(tab_number); ! if (tp == NULL) { ! beep_flush(); ! return; } + if (tp != curtab) + { + tabpage_close_other(tp, eap->forceit); + return; + } + else if (!text_locked() && !curbuf_locked()) + tabpage_close(eap->forceit); } /* *************** *** 6266,6298 **** int tab_number; if (cmdwin_type != 0) cmdwin_result = K_IGNORE; ! else if (first_tabpage->tp_next == NULL) msg(_("Already only one tab page")); ! else if (!window_layout_locked(CMD_tabonly)) { ! tab_number = get_tabpage_arg(eap); ! if (eap->errmsg == NULL) ! { ! goto_tabpage(tab_number); ! // Repeat this up to a 1000 times, because autocommands may ! // mess up the lists. ! for (done = 0; done < 1000; ++done) { ! FOR_ALL_TABPAGES(tp) ! if (tp->tp_topframe != topframe) ! { ! tabpage_close_other(tp, eap->forceit); ! // if we failed to close it quit ! if (valid_tabpage(tp)) ! done = 1000; ! // start over, "tp" is now invalid ! break; ! } ! if (first_tabpage->tp_next == NULL) ! break; } ! } } } --- 6273,6313 ---- int tab_number; if (cmdwin_type != 0) + { cmdwin_result = K_IGNORE; ! return; ! } ! ! if (first_tabpage->tp_next == NULL) ! { msg(_("Already only one tab page")); ! return; ! } ! ! if (window_layout_locked(CMD_tabonly)) ! return; ! ! tab_number = get_tabpage_arg(eap); ! if (eap->errmsg != NULL) ! return; ! ! goto_tabpage(tab_number); ! // Repeat this up to a 1000 times, because autocommands may ! // mess up the lists. ! for (done = 0; done < 1000; ++done) { ! FOR_ALL_TABPAGES(tp) ! if (tp->tp_topframe != topframe) { ! tabpage_close_other(tp, eap->forceit); ! // if we failed to close it quit ! if (valid_tabpage(tp)) ! done = 1000; ! // start over, "tp" is now invalid ! break; } ! if (first_tabpage->tp_next == NULL) ! break; } } *************** *** 6375,6404 **** ex_hide(exarg_T *eap UNUSED) { // ":hide" or ":hide | cmd": hide current window ! if (!eap->skip) ! { ! if (window_layout_locked(CMD_hide)) ! return; #ifdef FEAT_GUI ! need_mouse_correct = TRUE; #endif ! if (eap->addr_count == 0) ! win_close(curwin, FALSE); // don't free buffer ! else ! { ! int winnr = 0; ! win_T *win; ! FOR_ALL_WINDOWS(win) ! { ! winnr++; ! if (winnr == eap->line2) ! break; ! } ! if (win == NULL) ! win = lastwin; ! win_close(win, FALSE); } } } --- 6390,6419 ---- ex_hide(exarg_T *eap UNUSED) { // ":hide" or ":hide | cmd": hide current window ! if (eap->skip) ! return; ! ! if (window_layout_locked(CMD_hide)) ! return; #ifdef FEAT_GUI ! need_mouse_correct = TRUE; #endif ! if (eap->addr_count == 0) ! win_close(curwin, FALSE); // don't free buffer ! else ! { ! int winnr = 0; ! win_T *win; ! FOR_ALL_WINDOWS(win) ! { ! winnr++; ! if (winnr == eap->line2) ! break; } + if (win == NULL) + win = lastwin; + win_close(win, FALSE); } } *************** *** 6411,6436 **** /* * Disallow suspending for "rvim". */ ! if (!check_restricted()) ! { ! if (!eap->forceit) ! autowrite_all(); ! apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL); ! windgoto((int)Rows - 1, 0); ! out_char('\n'); ! out_flush(); ! stoptermcap(); ! out_flush(); // needed for SUN to restore xterm buffer ! mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles ! ui_suspend(); // call machine specific function ! maketitle(); ! resettitle(); // force updating the title ! starttermcap(); ! scroll_start(); // scroll screen before redrawing ! redraw_later_clear(); ! shell_resized(); // may have resized window ! apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL); ! } } /* --- 6426,6451 ---- /* * Disallow suspending for "rvim". */ ! if (check_restricted()) ! return; ! ! if (!eap->forceit) ! autowrite_all(); ! apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL); ! windgoto((int)Rows - 1, 0); ! out_char('\n'); ! out_flush(); ! stoptermcap(); ! out_flush(); // needed for SUN to restore xterm buffer ! mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles ! ui_suspend(); // call machine specific function ! maketitle(); ! resettitle(); // force updating the title ! starttermcap(); ! scroll_start(); // scroll screen before redrawing ! redraw_later_clear(); ! shell_resized(); // may have resized window ! apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL); } /* *************** *** 7403,7475 **** linenr_T lnum; if (eap->usefilter) // :r!cmd - do_bang(1, eap, FALSE, FALSE, TRUE); - else { ! if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL) ! return; #ifdef FEAT_BROWSE ! if (cmdmod.cmod_flags & CMOD_BROWSE) ! { ! char_u *browseFile; ! browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg, ! NULL, NULL, NULL, curbuf); ! if (browseFile != NULL) ! { ! i = readfile(browseFile, NULL, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); ! vim_free(browseFile); ! } ! else ! i = OK; } else #endif ! if (*eap->arg == NUL) { if (check_fname() == FAIL) // check for no file name return; i = readfile(curbuf->b_ffname, curbuf->b_fname, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } else { if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); i = readfile(eap->arg, NULL, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } ! if (i != OK) ! { #if defined(FEAT_EVAL) ! if (!aborting()) #endif ! semsg(_(e_cant_open_file_str), eap->arg); ! } ! else { ! if (empty && exmode_active) { ! // Delete the empty line that remains. Historically ex does ! // this but vi doesn't. ! if (eap->line2 == 0) ! lnum = curbuf->b_ml.ml_line_count; ! else ! lnum = 1; ! if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK) ! { ! ml_delete(lnum); ! if (curwin->w_cursor.lnum > 1 ! && curwin->w_cursor.lnum >= lnum) ! --curwin->w_cursor.lnum; ! deleted_lines_mark(lnum, 1L); ! } } - redraw_curbuf_later(UPD_VALID); } } } --- 7418,7491 ---- linenr_T lnum; if (eap->usefilter) // :r!cmd { ! do_bang(1, eap, FALSE, FALSE, TRUE); ! return; ! } ! ! if (u_save(eap->line2, (linenr_T)(eap->line2 + 1)) == FAIL) ! return; #ifdef FEAT_BROWSE ! if (cmdmod.cmod_flags & CMOD_BROWSE) ! { ! char_u *browseFile; ! browseFile = do_browse(0, (char_u *)_("Append File"), eap->arg, ! NULL, NULL, NULL, curbuf); ! if (browseFile != NULL) ! { ! i = readfile(browseFile, NULL, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); ! vim_free(browseFile); } else + i = OK; + } + else #endif ! if (*eap->arg == NUL) { if (check_fname() == FAIL) // check for no file name return; i = readfile(curbuf->b_ffname, curbuf->b_fname, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } else { if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); i = readfile(eap->arg, NULL, ! eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); } ! if (i != OK) ! { #if defined(FEAT_EVAL) ! if (!aborting()) #endif ! semsg(_(e_cant_open_file_str), eap->arg); ! } ! else ! { ! if (empty && exmode_active) { ! // Delete the empty line that remains. Historically ex does ! // this but vi doesn't. ! if (eap->line2 == 0) ! lnum = curbuf->b_ml.ml_line_count; ! else ! lnum = 1; ! if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK) { ! ml_delete(lnum); ! if (curwin->w_cursor.lnum > 1 ! && curwin->w_cursor.lnum >= lnum) ! --curwin->w_cursor.lnum; ! deleted_lines_mark(lnum, 1L); } } + redraw_curbuf_later(UPD_VALID); } } *************** *** 7675,7697 **** #if !defined(UNIX) && !defined(VMS) // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set if (*new_dir == NUL && !p_cdh) ex_pwd(NULL); ! else #endif - { - cdscope_T scope = CDSCOPE_GLOBAL; ! if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir) ! scope = CDSCOPE_WINDOW; ! else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir) ! scope = CDSCOPE_TABPAGE; ! ! if (changedir_func(new_dir, eap->forceit, scope)) ! { ! // Echo the new current directory if the command was typed. ! if (KeyTyped || p_verbose >= 5) ! ex_pwd(eap); ! } } } --- 7691,7714 ---- #if !defined(UNIX) && !defined(VMS) // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set if (*new_dir == NUL && !p_cdh) + { ex_pwd(NULL); ! return; ! } #endif ! cdscope_T scope = CDSCOPE_GLOBAL; ! ! if (eap->cmdidx == CMD_lcd || eap->cmdidx == CMD_lchdir) ! scope = CDSCOPE_WINDOW; ! else if (eap->cmdidx == CMD_tcd || eap->cmdidx == CMD_tchdir) ! scope = CDSCOPE_TABPAGE; ! ! if (changedir_func(new_dir, eap->forceit, scope)) ! { ! // Echo the new current directory if the command was typed. ! if (KeyTyped || p_verbose >= 5) ! ex_pwd(eap); } } *************** *** 8155,8177 **** == FAIL) { beep_flush(); } - else - { - int save_efr = exec_from_reg; ! exec_from_reg = TRUE; ! /* ! * Execute from the typeahead buffer. ! * Continue until the stuff buffer is empty and all added characters ! * have been consumed. ! */ ! while (!stuff_empty() || typebuf.tb_len > prev_len) ! (void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE); ! exec_from_reg = save_efr; ! } } /* --- 8172,8193 ---- == FAIL) { beep_flush(); + return; } ! int save_efr = exec_from_reg; ! exec_from_reg = TRUE; ! /* ! * Execute from the typeahead buffer. ! * Continue until the stuff buffer is empty and all added characters ! * have been consumed. ! */ ! while (!stuff_empty() || typebuf.tb_len > prev_len) ! (void)do_cmdline(NULL, getexline, NULL, DOCMD_NOWAIT|DOCMD_VERBOSE); ! ! exec_from_reg = save_efr; } /* *************** *** 8560,8577 **** return; #endif if (*eap->arg == NUL) // No argument? emsg(_(e_argument_required)); ! else if (eap->arg[1] != NUL) // more than one character? ! semsg(_(e_trailing_characters_str), eap->arg); ! else { ! pos = curwin->w_cursor; // save curwin->w_cursor ! curwin->w_cursor.lnum = eap->line2; ! beginline(BL_WHITE | BL_FIX); ! if (setmark(*eap->arg) == FAIL) // set mark ! emsg(_(e_argument_must_be_letter_or_forward_backward_quote)); ! curwin->w_cursor = pos; // restore curwin->w_cursor } } /* --- 8576,8598 ---- return; #endif if (*eap->arg == NUL) // No argument? + { emsg(_(e_argument_required)); ! return; ! } ! ! if (eap->arg[1] != NUL) // more than one character? { ! semsg(_(e_trailing_characters_str), eap->arg); ! return; } + + pos = curwin->w_cursor; // save curwin->w_cursor + curwin->w_cursor.lnum = eap->line2; + beginline(BL_WHITE | BL_FIX); + if (setmark(*eap->arg) == FAIL) // set mark + emsg(_(e_argument_must_be_letter_or_forward_backward_quote)); + curwin->w_cursor = pos; // restore curwin->w_cursor } /* *************** *** 9685,9701 **** static void ex_setfiletype(exarg_T *eap) { ! if (!did_filetype) ! { ! char_u *arg = eap->arg; ! if (STRNCMP(arg, "FALLBACK ", 9) == 0) ! arg += 9; ! set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL); ! if (arg != eap->arg) ! did_filetype = FALSE; ! } } static void --- 9706,9721 ---- static void ex_setfiletype(exarg_T *eap) { ! if (did_filetype) ! return; ! char_u *arg = eap->arg; ! if (STRNCMP(arg, "FALLBACK ", 9) == 0) ! arg += 9; ! set_option_value_give_err((char_u *)"filetype", 0L, arg, OPT_LOCAL); ! if (arg != eap->arg) ! did_filetype = FALSE; } static void *** ../vim-9.0.1114/src/ex_getln.c 2022-12-09 12:41:28.602855482 +0000 --- src/ex_getln.c 2022-12-30 18:00:41.803227745 +0000 *************** *** 368,403 **** incsearch_state_T *is_state, int call_update_screen) { ! if (is_state->did_incsearch) { ! is_state->did_incsearch = FALSE; ! if (gotesc) ! curwin->w_cursor = is_state->save_cursor; ! else { ! if (!EQUAL_POS(is_state->save_cursor, is_state->search_start)) ! { ! // put the '" mark at the original position ! curwin->w_cursor = is_state->save_cursor; ! setpcmark(); ! } ! curwin->w_cursor = is_state->search_start; } ! restore_viewstate(&is_state->old_viewstate); ! highlight_match = FALSE; ! ! // by default search all lines ! search_first_line = 0; ! search_last_line = MAXLNUM; ! ! magic_overruled = is_state->magic_overruled_save; ! ! validate_cursor(); // needed for TAB ! status_redraw_all(); ! redraw_all_later(UPD_SOME_VALID); ! if (call_update_screen) ! update_screen(UPD_SOME_VALID); } } /* --- 368,403 ---- incsearch_state_T *is_state, int call_update_screen) { ! if (!is_state->did_incsearch) ! return; ! ! is_state->did_incsearch = FALSE; ! if (gotesc) ! curwin->w_cursor = is_state->save_cursor; ! else { ! if (!EQUAL_POS(is_state->save_cursor, is_state->search_start)) { ! // put the '" mark at the original position ! curwin->w_cursor = is_state->save_cursor; ! setpcmark(); } ! curwin->w_cursor = is_state->search_start; } + restore_viewstate(&is_state->old_viewstate); + highlight_match = FALSE; + + // by default search all lines + search_first_line = 0; + search_last_line = MAXLNUM; + + magic_overruled = is_state->magic_overruled_save; + + validate_cursor(); // needed for TAB + status_redraw_all(); + redraw_all_later(UPD_SOME_VALID); + if (call_update_screen) + update_screen(UPD_SOME_VALID); } /* *************** *** 4032,4044 **** char_u *p; p = alloc(STRLEN(*pp) + 2); ! if (p != NULL) ! { ! p[0] = '\\'; ! STRCPY(p + 1, *pp); ! vim_free(*pp); ! *pp = p; ! } } /* --- 4032,4044 ---- char_u *p; p = alloc(STRLEN(*pp) + 2); ! if (p == NULL) ! return; ! ! p[0] = '\\'; ! STRCPY(p + 1, *pp); ! vim_free(*pp); ! *pp = p; } /* *** ../vim-9.0.1114/src/version.c 2022-12-30 17:41:12.736064711 +0000 --- src/version.c 2022-12-30 18:02:11.675170574 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1115, /**/ -- Any sufficiently advanced technology is indistinguishable from magic. Arthur C. Clarke Any sufficiently advanced bug is indistinguishable from a feature. Rich Kulawiec /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///