Patch 8.2.1898

4 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 24, 2020, 2:51:10 PM10/24/20
to vim...@googlegroups.com

Patch 8.2.1898
Problem: Command modifier parsing always uses global cmdmod.
Solution: Pass in cmdmod_T to use. Rename struct fields consistently.
Files: src/structs.h, src/arglist.c src/buffer.c, src/bufwrite.c,
src/diff.c, src/change.c, src/cmdhist.c, src/edit.c,
src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_getln.c,
src/fileio.c, src/filepath.c, src/gui.c, src/gui_gtk_x11.c,
src/help.c, src/if_cscope.c, src/indent.c, src/mark.c,
src/memline.c, src/message.c, src/option.c, src/ops.c,
src/os_unix.c, src/quickfix.c, src/register.c, src/scriptfile.c,
src/search.c, src/session.c, src/tag.c, src/terminal.c,
src/textformat.c, src/usercmd.c, src/vim9compile.c, src/window.c,
src/proto/ex_docmd.pro


*** ../vim-8.2.1897/src/structs.h 2020-10-24 17:19:12.135743402 +0200
--- src/structs.h 2020-10-24 20:19:08.416401166 +0200
***************
*** 625,648 ****
*/
typedef struct
{
! int cmod_flags; // CMOD_ flags, see below
! int hide; // TRUE when ":hide" was used
! # ifdef FEAT_BROWSE_CMD
! int browse; // TRUE to invoke file dialog
! # endif
! int split; // flags for win_split()
! int tab; // > 0 when ":tab" was used
! # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! int confirm; // TRUE to invoke yes/no dialog
! # endif
! int keepalt; // TRUE when ":keepalt" was used
! int keepmarks; // TRUE when ":keepmarks" was used
! int keepjumps; // TRUE when ":keepjumps" was used
! int lockmarks; // TRUE when ":lockmarks" was used
! int keeppatterns; // TRUE when ":keeppatterns" was used
! int noswapfile; // TRUE when ":noswapfile" was used
! regmatch_T filter_regmatch; // set by :filter /pat/
! int filter_force; // set for :filter!

int cmod_verbose; // non-zero to set 'verbose'

--- 625,650 ----
*/
typedef struct
{
! int cmod_flags; // CMOD_ flags
! #define CMOD_SANDBOX 0x0001 // ":sandbox"
! #define CMOD_SILENT 0x0002 // ":silent"
! #define CMOD_ERRSILENT 0x0004 // ":silent!"
! #define CMOD_UNSILENT 0x0008 // ":unsilent"
! #define CMOD_NOAUTOCMD 0x0010 // ":noautocmd"
! #define CMOD_HIDE 0x0020 // ":hide"
! #define CMOD_BROWSE 0x0040 // ":browse" - invoke file dialog
! #define CMOD_CONFIRM 0x0080 // ":confirm" - invoke yes/no dialog
! #define CMOD_KEEPALT 0x0100 // ":keepalt"
! #define CMOD_KEEPMARKS 0x0200 // ":keepmarks"
! #define CMOD_KEEPJUMPS 0x0400 // ":keepjumps"
! #define CMOD_LOCKMARKS 0x0800 // ":lockmarks"
! #define CMOD_KEEPPATTERNS 0x1000 // ":keeppatterns"
! #define CMOD_NOSWAPFILE 0x2000 // ":noswapfile"
!
! int cmod_split; // flags for win_split()
! int cmod_tab; // > 0 when ":tab" was used
! regmatch_T cmod_filter_regmatch; // set by :filter /pat/
! int cmod_filter_force; // set for :filter!

int cmod_verbose; // non-zero to set 'verbose'

***************
*** 655,669 ****
// p_verbose plus one
int cmod_save_msg_silent; // if non-zero: saved value of
// msg_silent + 1
int cmod_did_esilent; // incremented when emsg_silent is
} cmdmod_T;

- #define CMOD_SANDBOX 0x01
- #define CMOD_SILENT 0x02
- #define CMOD_ERRSILENT 0x04
- #define CMOD_UNSILENT 0x08
- #define CMOD_NOAUTOCMD 0x10
-
#define MF_SEED_LEN 8

struct memfile
--- 657,666 ----
// p_verbose plus one
int cmod_save_msg_silent; // if non-zero: saved value of
// msg_silent + 1
+ int cmod_save_msg_scroll; // for restoring msg_scroll
int cmod_did_esilent; // incremented when emsg_silent is
} cmdmod_T;

#define MF_SEED_LEN 8

struct memfile
*** ../vim-8.2.1897/src/arglist.c 2020-08-30 19:26:40.736556825 +0200
--- src/arglist.c 2020-10-24 18:05:47.876210088 +0200
***************
*** 657,663 ****
#endif

// split window or create new tab page first
! if (*eap->cmd == 's' || cmdmod.tab != 0)
{
if (win_split(0, 0) == FAIL)
return;
--- 657,663 ----
#endif

// split window or create new tab page first
! if (*eap->cmd == 's' || cmdmod.cmod_tab != 0)
{
if (win_split(0, 0) == FAIL)
return;
***************
*** 878,884 ****
alist_T *alist; // argument list to be used
buf_T *buf;
tabpage_T *tpnext;
! int had_tab = cmdmod.tab;
win_T *old_curwin, *last_curwin;
tabpage_T *old_curtab, *last_curtab;
win_T *new_curwin = NULL;
--- 878,884 ----
alist_T *alist; // argument list to be used
buf_T *buf;
tabpage_T *tpnext;
! int had_tab = cmdmod.cmod_tab;
win_T *old_curwin, *last_curwin;
tabpage_T *old_curtab, *last_curtab;
win_T *new_curwin = NULL;
***************
*** 1116,1122 ****

// When ":tab" was used open a new tab for a new window repeatedly.
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
! cmdmod.tab = 9999;
}

// Remove the "lock" on the argument list.
--- 1116,1122 ----

// When ":tab" was used open a new tab for a new window repeatedly.
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
! cmdmod.cmod_tab = 9999;
}

// Remove the "lock" on the argument list.
*** ../vim-8.2.1897/src/buffer.c 2020-07-23 16:36:59.828375424 +0200
--- src/buffer.c 2020-10-24 19:47:52.523484266 +0200
***************
*** 1444,1450 ****
if (!forceit && bufIsChanged(buf))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && p_write)
{
dialog_changed(buf, FALSE);
if (!bufref_valid(&bufref))
--- 1444,1450 ----
if (!forceit && bufIsChanged(buf))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write)
{
dialog_changed(buf, FALSE);
if (!bufref_valid(&bufref))
***************
*** 1634,1640 ****
if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && p_write)
{
bufref_T bufref;

--- 1634,1640 ----
if (action == DOBUF_GOTO && !can_abandon(curbuf, forceit))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write)
{
bufref_T bufref;

***************
*** 1689,1695 ****
bufref_T prevbufref;

setpcmark();
! if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file
buflist_altfpos(curwin); // remember curpos

--- 1689,1695 ----
bufref_T prevbufref;

setpcmark();
! if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = curbuf->b_fnum; // remember alternate file
buflist_altfpos(curwin); // remember curpos

***************
*** 3435,3441 ****

// Create a buffer. 'buflisted' is not set if it's a new buffer
buf = buflist_new(ffname, sfname, lnum, 0);
! if (buf != NULL && !cmdmod.keepalt)
curwin->w_alt_fnum = buf->b_fnum;
return buf;
}
--- 3435,3441 ----

// Create a buffer. 'buflisted' is not set if it's a new buffer
buf = buflist_new(ffname, sfname, lnum, 0);
! if (buf != NULL && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = buf->b_fnum;
return buf;
}
***************
*** 5068,5074 ****
int r;
int count; // Maximum number of windows to open.
int all; // When TRUE also load inactive buffers.
! int had_tab = cmdmod.tab;
tabpage_T *tpnext;

if (eap->addr_count == 0) // make as many windows as possible
--- 5068,5074 ----
int r;
int count; // Maximum number of windows to open.
int all; // When TRUE also load inactive buffers.
! int had_tab = cmdmod.cmod_tab;
tabpage_T *tpnext;

if (eap->addr_count == 0) // make as many windows as possible
***************
*** 5099,5105 ****
{
wpnext = wp->w_next;
if ((wp->w_buffer->b_nwindows > 1
! || ((cmdmod.split & WSP_VERT)
? wp->w_height + wp->w_status_height < Rows - p_ch
- tabline_height()
: wp->w_width != Columns)
--- 5099,5105 ----
{
wpnext = wp->w_next;
if ((wp->w_buffer->b_nwindows > 1
! || ((cmdmod.cmod_split & WSP_VERT)
? wp->w_height + wp->w_status_height < Rows - p_ch
- tabline_height()
: wp->w_width != Columns)
***************
*** 5220,5226 ****
#endif
// When ":tab" was used open a new tab for a new window repeatedly.
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
! cmdmod.tab = 9999;
}
--autocmd_no_enter;
win_enter(firstwin, FALSE); // back to first window
--- 5220,5226 ----
#endif
// When ":tab" was used open a new tab for a new window repeatedly.
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
! cmdmod.cmod_tab = 9999;
}
--autocmd_no_enter;
win_enter(firstwin, FALSE); // back to first window
***************
*** 5547,5553 ****
case 'd': return FALSE; // "delete"
case 'h': return TRUE; // "hide"
}
! return (p_hid || cmdmod.hide);
}

/*
--- 5547,5553 ----
case 'd': return FALSE; // "delete"
case 'h': return TRUE; // "hide"
}
! return (p_hid || (cmdmod.cmod_flags & CMOD_HIDE));
}

/*
*** ../vim-8.2.1897/src/bufwrite.c 2020-06-12 22:30:57.629228449 +0200
--- src/bufwrite.c 2020-10-24 20:06:32.610970527 +0200
***************
*** 883,889 ****
#endif
)
{
! if (buf != NULL && cmdmod.lockmarks)
{
// restore the original '[ and '] positions
buf->b_op_start = orig_start;
--- 883,889 ----
#endif
)
{
! if (buf != NULL && (cmdmod.cmod_flags & CMOD_LOCKMARKS))
{
// restore the original '[ and '] positions
buf->b_op_start = orig_start;
***************
*** 967,973 ****
fname = buf->b_sfname;
}

! if (cmdmod.lockmarks)
{
// restore the original '[ and '] positions
buf->b_op_start = orig_start;
--- 967,973 ----
fname = buf->b_sfname;
}

! if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
// restore the original '[ and '] positions
buf->b_op_start = orig_start;
*** ../vim-8.2.1897/src/diff.c 2020-06-09 19:34:51.485836791 +0200
--- src/diff.c 2020-10-24 20:07:19.618798604 +0200
***************
*** 775,781 ****
{
int r;
char_u *save_ff;
! int save_lockmarks;

if (din->din_fname == NULL)
return diff_write_buffer(buf, din);
--- 775,781 ----
{
int r;
char_u *save_ff;
! int save_cmod_flags;

if (din->din_fname == NULL)
return diff_write_buffer(buf, din);
***************
*** 783,796 ****
// Always use 'fileformat' set to "unix".
save_ff = buf->b_p_ff;
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX);
! save_lockmarks = cmdmod.lockmarks;
// Writing the buffer is an implementation detail of performing the diff,
// so it shouldn't update the '[ and '] marks.
! cmdmod.lockmarks = TRUE;
r = buf_write(buf, din->din_fname, NULL,
(linenr_T)1, buf->b_ml.ml_line_count,
NULL, FALSE, FALSE, FALSE, TRUE);
! cmdmod.lockmarks = save_lockmarks;
free_string_option(buf->b_p_ff);
buf->b_p_ff = save_ff;
return r;
--- 783,796 ----
// Always use 'fileformat' set to "unix".
save_ff = buf->b_p_ff;
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX);
! save_cmod_flags = cmdmod.cmod_flags;
// Writing the buffer is an implementation detail of performing the diff,
// so it shouldn't update the '[ and '] marks.
! cmdmod.cmod_flags |= CMOD_LOCKMARKS;
r = buf_write(buf, din->din_fname, NULL,
(linenr_T)1, buf->b_ml.ml_line_count,
NULL, FALSE, FALSE, FALSE, TRUE);
! cmdmod.cmod_flags = save_cmod_flags;
free_string_option(buf->b_p_ff);
buf->b_p_ff = save_ff;
return r;
***************
*** 1187,1199 ****
#endif
#ifdef FEAT_BROWSE
char_u *browseFile = NULL;
! int browse_flag = cmdmod.browse;
#endif
stat_T st;
char_u *esc_name = NULL;

#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
browseFile = do_browse(0, (char_u *)_("Patch file"),
eap->arg, NULL, NULL,
--- 1187,1199 ----
#endif
#ifdef FEAT_BROWSE
char_u *browseFile = NULL;
! int save_cmod_flags = cmdmod.cmod_flags;
#endif
stat_T st;
char_u *esc_name = NULL;

#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
browseFile = do_browse(0, (char_u *)_("Patch file"),
eap->arg, NULL, NULL,
***************
*** 1201,1207 ****
if (browseFile == NULL)
return; // operation cancelled
eap->arg = browseFile;
! cmdmod.browse = FALSE; // don't let do_ecmd() browse again
}
#endif

--- 1201,1207 ----
if (browseFile == NULL)
return; // operation cancelled
eap->arg = browseFile;
! cmdmod.cmod_flags &= ~CMOD_BROWSE; // don't let do_ecmd() browse again
}
#endif

***************
*** 1310,1316 ****
need_mouse_correct = TRUE;
#endif
// don't use a new tab page, each tab page has its own diffs
! cmdmod.tab = 0;

if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
--- 1310,1316 ----
need_mouse_correct = TRUE;
#endif
// don't use a new tab page, each tab page has its own diffs
! cmdmod.cmod_tab = 0;

if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
***************
*** 1355,1361 ****
vim_free(esc_name);
#ifdef FEAT_BROWSE
vim_free(browseFile);
! cmdmod.browse = browse_flag;
#endif
}

--- 1355,1361 ----
vim_free(esc_name);
#ifdef FEAT_BROWSE
vim_free(browseFile);
! cmdmod.cmod_flags = save_cmod_flags;
#endif
}

***************
*** 1377,1383 ****
set_fraction(curwin);

// don't use a new tab page, each tab page has its own diffs
! cmdmod.tab = 0;

if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
--- 1377,1383 ----
set_fraction(curwin);

// don't use a new tab page, each tab page has its own diffs
! cmdmod.cmod_tab = 0;

if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
*** ../vim-8.2.1897/src/change.c 2020-09-15 21:34:14.998383526 +0200
--- src/change.c 2020-10-24 20:19:30.476330080 +0200
***************
*** 453,459 ****
#endif

// set the '. mark
! if (!cmdmod.keepjumps)
{
curbuf->b_last_change.lnum = lnum;
curbuf->b_last_change.col = col;
--- 453,459 ----
#endif

// set the '. mark
! if ((cmdmod.cmod_flags & CMOD_KEEPJUMPS) == 0)
{
curbuf->b_last_change.lnum = lnum;
curbuf->b_last_change.col = col;
*** ../vim-8.2.1897/src/cmdhist.c 2020-07-23 17:16:15.046100627 +0200
--- src/cmdhist.c 2020-10-24 20:13:48.725449038 +0200
***************
*** 304,310 ****
if (hislen == 0) // no history
return;

! if (cmdmod.keeppatterns && histype == HIST_SEARCH)
return;

// Searches inside the same mapping overwrite each other, so that only
--- 304,310 ----
if (hislen == 0) // no history
return;

! if ((cmdmod.cmod_flags & CMOD_KEEPPATTERNS) && histype == HIST_SEARCH)
return;

// Searches inside the same mapping overwrite each other, so that only
*** ../vim-8.2.1897/src/edit.c 2020-10-21 12:19:50.080854732 +0200
--- src/edit.c 2020-10-24 20:19:51.276263153 +0200
***************
*** 3616,3622 ****
curwin->w_set_curswant = TRUE;

// Remember the last Insert position in the '^ mark.
! if (!cmdmod.keepjumps)
curbuf->b_last_insert = curwin->w_cursor;

/*
--- 3616,3622 ----
curwin->w_set_curswant = TRUE;

// Remember the last Insert position in the '^ mark.
! if ((cmdmod.cmod_flags & CMOD_KEEPJUMPS) == 0)
curbuf->b_last_insert = curwin->w_cursor;

/*
*** ../vim-8.2.1897/src/ex_cmds.c 2020-10-13 19:08:20.267560498 +0200
--- src/ex_cmds.c 2020-10-24 20:14:04.097397745 +0200
***************
*** 744,750 ****
foldMoveRange(&win->w_folds, line1, line2, dest);
}
#endif
! if (!cmdmod.lockmarks)
{
curbuf->b_op_start.lnum = dest - num_lines + 1;
curbuf->b_op_end.lnum = dest;
--- 744,750 ----
foldMoveRange(&win->w_folds, line1, line2, dest);
}
#endif
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
curbuf->b_op_start.lnum = dest - num_lines + 1;
curbuf->b_op_end.lnum = dest;
***************
*** 759,771 ****
foldMoveRange(&win->w_folds, dest + 1, line1 - 1, line2);
}
#endif
! if (!cmdmod.lockmarks)
{
curbuf->b_op_start.lnum = dest + 1;
curbuf->b_op_end.lnum = dest + num_lines;
}
}
! if (!cmdmod.lockmarks)
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
mark_adjust_nofold(last_line - num_lines + 1, last_line,
-(last_line - dest - extra), 0L);
--- 759,771 ----
foldMoveRange(&win->w_folds, dest + 1, line1 - 1, line2);
}
#endif
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
curbuf->b_op_start.lnum = dest + 1;
curbuf->b_op_end.lnum = dest + num_lines;
}
}
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
mark_adjust_nofold(last_line - num_lines + 1, last_line,
-(last_line - dest - extra), 0L);
***************
*** 815,821 ****
char_u *p;

count = line2 - line1 + 1;
! if (!cmdmod.lockmarks)
{
curbuf->b_op_start.lnum = n + 1;
curbuf->b_op_end.lnum = n + count;
--- 815,821 ----
char_u *p;

count = line2 - line1 + 1;
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
curbuf->b_op_start.lnum = n + 1;
curbuf->b_op_end.lnum = n + count;
***************
*** 1062,1068 ****
int shell_flags = 0;
pos_T orig_start = curbuf->b_op_start;
pos_T orig_end = curbuf->b_op_end;
! int save_lockmarks = cmdmod.lockmarks;
#ifdef FEAT_FILTERPIPE
int stmp = p_stmp;
#endif
--- 1062,1068 ----
int shell_flags = 0;
pos_T orig_start = curbuf->b_op_start;
pos_T orig_end = curbuf->b_op_end;
! int save_cmod_flags = cmdmod.cmod_flags;
#ifdef FEAT_FILTERPIPE
int stmp = p_stmp;
#endif
***************
*** 1072,1078 ****

// Temporarily disable lockmarks since that's needed to propagate changed
// regions of the buffer for foldUpdate(), linecount, etc.
! cmdmod.lockmarks = 0;

cursor_save = curwin->w_cursor;
linecount = line2 - line1 + 1;
--- 1072,1078 ----

// Temporarily disable lockmarks since that's needed to propagate changed
// regions of the buffer for foldUpdate(), linecount, etc.
! cmdmod.cmod_flags &= ~CMOD_LOCKMARKS;

cursor_save = curwin->w_cursor;
linecount = line2 - line1 + 1;
***************
*** 1241,1247 ****

if (do_in)
{
! if (cmdmod.keepmarks || vim_strchr(p_cpo, CPO_REMMARK) == NULL)
{
if (read_linecount >= linecount)
// move all marks from old lines to new lines
--- 1241,1248 ----

if (do_in)
{
! if ((cmdmod.cmod_flags & CMOD_KEEPMARKS)
! || vim_strchr(p_cpo, CPO_REMMARK) == NULL)
{
if (read_linecount >= linecount)
// move all marks from old lines to new lines
***************
*** 1307,1319 ****

filterend:

! cmdmod.lockmarks = save_lockmarks;
if (curbuf != old_curbuf)
{
--no_wait_return;
emsg(_("E135: *Filter* Autocommands must not change current buffer"));
}
! else if (cmdmod.lockmarks)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
--- 1308,1320 ----

filterend:

! cmdmod.cmod_flags = save_cmod_flags;
if (curbuf != old_curbuf)
{
--no_wait_return;
emsg(_("E135: *Filter* Autocommands must not change current buffer"));
}
! else if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
***************
*** 1769,1775 ****
if (xfname != NULL && *xfname != NUL)
{
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
! if (buf != NULL && !cmdmod.keepalt)
curwin->w_alt_fnum = buf->b_fnum;
}
vim_free(fname);
--- 1770,1776 ----
if (xfname != NULL && *xfname != NUL)
{
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0);
! if (buf != NULL && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = buf->b_fnum;
}
vim_free(fname);
***************
*** 1866,1872 ****

ffname = eap->arg;
#ifdef FEAT_BROWSE
! if (cmdmod.browse && !exiting)
{
browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname,
NULL, NULL, NULL, curbuf);
--- 1867,1873 ----

ffname = eap->arg;
#ifdef FEAT_BROWSE
! if ((cmdmod.cmod_flags & CMOD_BROWSE) && !exiting)
{
browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname,
NULL, NULL, NULL, curbuf);
***************
*** 1942,1948 ****
&& !p_wa)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || cmdmod.confirm)
{
if (vim_dialog_yesno(VIM_QUESTION, NULL,
(char_u *)_("Write partial file?"), 2) != VIM_YES)
--- 1943,1949 ----
&& !p_wa)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))
{
if (vim_dialog_yesno(VIM_QUESTION, NULL,
(char_u *)_("Write partial file?"), 2) != VIM_YES)
***************
*** 2091,2097 ****
}
#endif
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || cmdmod.confirm)
{
char_u buff[DIALOG_MSG_SIZE];

--- 2092,2098 ----
}
#endif
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))
{
char_u buff[DIALOG_MSG_SIZE];

***************
*** 2142,2148 ****
if (r)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || cmdmod.confirm)
{
char_u buff[DIALOG_MSG_SIZE];

--- 2143,2149 ----
if (r)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))
{
char_u buff[DIALOG_MSG_SIZE];

***************
*** 2229,2240 ****
}
#ifdef FEAT_BROWSE
// ":browse wall": ask for file name if there isn't one
! if (buf->b_ffname == NULL && cmdmod.browse)
browse_save_fname(buf);
#endif
if (buf->b_ffname == NULL)
{
! semsg(_("E141: No file name for buffer %ld"), (long)buf->b_fnum);
++error;
}
else if (check_readonly(&eap->forceit, buf)
--- 2230,2242 ----
}
#ifdef FEAT_BROWSE
// ":browse wall": ask for file name if there isn't one
! if (buf->b_ffname == NULL && (cmdmod.cmod_flags & CMOD_BROWSE))
browse_save_fname(buf);
#endif
if (buf->b_ffname == NULL)
{
! semsg(_("E141: No file name for buffer %ld"),
! (long)buf->b_fnum);
++error;
}
else if (check_readonly(&eap->forceit, buf)
***************
*** 2297,2303 ****
&& check_file_readonly(buf->b_ffname, 0777))))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL)
{
char_u buff[DIALOG_MSG_SIZE];

--- 2299,2306 ----
&& check_file_readonly(buf->b_ffname, 0777))))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))
! && buf->b_fname != NULL)
{
char_u buff[DIALOG_MSG_SIZE];

***************
*** 2501,2507 ****
else
{
#ifdef FEAT_BROWSE
! if (cmdmod.browse && !exiting)
{
if (
# ifdef FEAT_GUI
--- 2504,2510 ----
else
{
#ifdef FEAT_BROWSE
! if ((cmdmod.cmod_flags & CMOD_BROWSE) && !exiting)
{
if (
# ifdef FEAT_GUI
***************
*** 2612,2618 ****
{
if (!(flags & ECMD_ADDBUF))
{
! if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum;
if (oldwin != NULL)
buflist_altfpos(oldwin);
--- 2615,2621 ----
{
if (!(flags & ECMD_ADDBUF))
{
! if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = curbuf->b_fnum;
if (oldwin != NULL)
buflist_altfpos(oldwin);
***************
*** 3299,3312 ****
// eap->line2 pointed to the end of the buffer and nothing was appended)
// "end" is set to lnum when something has been appended, otherwise
// it is the same than "start" -- Acevedo
! if (!cmdmod.lockmarks)
{
curbuf->b_op_start.lnum = (eap->line2 < curbuf->b_ml.ml_line_count) ?
eap->line2 + 1 : curbuf->b_ml.ml_line_count;
if (eap->cmdidx != CMD_append)
--curbuf->b_op_start.lnum;
curbuf->b_op_end.lnum = (eap->line2 < lnum)
! ? lnum : curbuf->b_op_start.lnum;
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
}
curwin->w_cursor.lnum = lnum;
--- 3302,3315 ----
// eap->line2 pointed to the end of the buffer and nothing was appended)
// "end" is set to lnum when something has been appended, otherwise
// it is the same than "start" -- Acevedo
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
curbuf->b_op_start.lnum = (eap->line2 < curbuf->b_ml.ml_line_count) ?
eap->line2 + 1 : curbuf->b_ml.ml_line_count;
if (eap->cmdidx != CMD_append)
--curbuf->b_op_start.lnum;
curbuf->b_op_end.lnum = (eap->line2 < lnum)
! ? lnum : curbuf->b_op_start.lnum;
curbuf->b_op_start.col = curbuf->b_op_end.col = 0;
}
curwin->w_cursor.lnum = lnum;
***************
*** 3729,3735 ****
ex_may_print(eap);
}

! if (!cmdmod.keeppatterns)
save_re_pat(RE_SUBST, pat, p_magic);
// put pattern in history
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
--- 3732,3738 ----
ex_may_print(eap);
}

! if ((cmdmod.cmod_flags & CMOD_KEEPPATTERNS) == 0)
save_re_pat(RE_SUBST, pat, p_magic);
// put pattern in history
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
***************
*** 4619,4625 ****

if (sub_nsubs > start_nsubs)
{
! if (!cmdmod.lockmarks)
{
// Set the '[ and '] marks.
curbuf->b_op_start.lnum = eap->line1;
--- 4622,4628 ----

if (sub_nsubs > start_nsubs)
{
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set the '[ and '] marks.
curbuf->b_op_start.lnum = eap->line1;
***************
*** 5108,5114 ****
if (ARGCOUNT == 0)
return;

! if (cmdmod.tab)
{
// ":tab drop file ...": open a tab for each argument that isn't
// edited in a window yet. It's like ":tab all" but without closing
--- 5111,5117 ----
if (ARGCOUNT == 0)
return;

! if (cmdmod.cmod_tab)
{
// ":tab drop file ...": open a tab for each argument that isn't
// edited in a window yet. It's like ":tab all" but without closing
***************
*** 5247,5253 ****
got_int = FALSE;

# ifdef FEAT_BROWSE_CMD
! if (cmdmod.browse)
{
quit_more = FALSE;
nr = prompt_for_number(FALSE);
--- 5250,5256 ----
got_int = FALSE;

# ifdef FEAT_BROWSE_CMD
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
quit_more = FALSE;
nr = prompt_for_number(FALSE);
***************
*** 5262,5268 ****
p = expand_env_save(p);
eap->arg = p;
eap->cmdidx = CMD_edit;
! cmdmod.browse = FALSE;
do_exedit(eap, NULL);
vim_free(p);
}
--- 5265,5271 ----
p = expand_env_save(p);
eap->arg = p;
eap->cmdidx = CMD_edit;
! cmdmod.cmod_flags &= ~CMOD_BROWSE;
do_exedit(eap, NULL);
vim_free(p);
}
*** ../vim-8.2.1897/src/ex_cmds2.c 2020-07-22 19:10:59.877072059 +0200
--- src/ex_cmds2.c 2020-10-24 19:40:10.356745236 +0200
***************
*** 86,92 ****
&& (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && p_write)
{
buf_T *buf2;
int count = 0;
--- 86,92 ----
&& (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL))
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write)
{
buf_T *buf2;
int count = 0;
***************
*** 96,102 ****
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
# ifdef FEAT_BROWSE
! || cmdmod.browse
# endif
))
++count;
--- 96,102 ----
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
# ifdef FEAT_BROWSE
! || (cmdmod.cmod_flags & CMOD_BROWSE)
# endif
))
++count;
***************
*** 197,203 ****
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
#ifdef FEAT_BROWSE
! || cmdmod.browse
#endif
)
&& !buf2->b_p_ro)
--- 197,203 ----
if (bufIsChanged(buf2)
&& (buf2->b_ffname != NULL
#ifdef FEAT_BROWSE
! || (cmdmod.cmod_flags & CMOD_BROWSE)
#endif
)
&& !buf2->b_p_ro)
***************
*** 347,353 ****
/*
* When ":confirm" used, don't give an error message.
*/
! if (!(p_confirm || cmdmod.confirm))
#endif
{
// There must be a wait_return for this message, do_buffer()
--- 347,353 ----
/*
* When ":confirm" used, don't give an error message.
*/
! if (!(p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
#endif
{
// There must be a wait_return for this message, do_buffer()
*** ../vim-8.2.1897/src/ex_docmd.c 2020-10-24 17:19:12.135743402 +0200
--- src/ex_docmd.c 2020-10-24 20:20:04.996219077 +0200
***************
*** 1711,1717 ****
char *errormsg = NULL; // error message
char_u *after_modifier = NULL;
exarg_T ea; // Ex command arguments
- int save_msg_scroll = msg_scroll;
cmdmod_T save_cmdmod;
int save_reg_executing = reg_executing;
int ni; // set when Not Implemented
--- 1711,1716 ----
***************
*** 1762,1768 ****
ea.cstack = cstack;
starts_with_colon = *skipwhite(ea.cmd) == ':';
#endif
! if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL)
goto doend;
apply_cmdmod(&cmdmod);

--- 1761,1767 ----
ea.cstack = cstack;
starts_with_colon = *skipwhite(ea.cmd) == ':';
#endif
! if (parse_command_modifiers(&ea, &errormsg, &cmdmod, FALSE) == FAIL)
goto doend;
apply_cmdmod(&cmdmod);

***************
*** 2598,2604 ****
? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
#endif

! undo_cmdmod(save_msg_scroll);
cmdmod = save_cmdmod;
reg_executing = save_reg_executing;

--- 2597,2603 ----
? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
#endif

! undo_cmdmod(&cmdmod);
cmdmod = save_cmdmod;
reg_executing = save_reg_executing;

***************
*** 2633,2657 ****
/*
* Parse and skip over command modifiers:
* - update eap->cmd
! * - store flags in "cmdmod".
* - Set ex_pressedreturn for an empty command line.
- * - set msg_silent for ":silent"
- * - set 'eventignore' to "all" for ":noautocmd"
* When "skip_only" is TRUE the global variables are not changed, except for
* "cmdmod".
* Call apply_cmdmod() to get the side effects of the modifiers:
* - Increment "sandbox" for ":sandbox"
* - set p_verbose for ":verbose"
* Return FAIL when the command is not to be executed.
* May set "errormsg" to an error message.
*/
int
! parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only)
{
char_u *p;
int starts_with_colon = FALSE;

! CLEAR_FIELD(cmdmod);

// Repeat until no more command modifiers are found.
for (;;)
--- 2632,2662 ----
/*
* Parse and skip over command modifiers:
* - update eap->cmd
! * - store flags in "cmod".
* - Set ex_pressedreturn for an empty command line.
* When "skip_only" is TRUE the global variables are not changed, except for
* "cmdmod".
+ * When "skip_only" is FALSE then undo_cmdmod() must be called later to free
+ * any cmod_filter_regmatch.regprog.
* Call apply_cmdmod() to get the side effects of the modifiers:
* - Increment "sandbox" for ":sandbox"
* - set p_verbose for ":verbose"
+ * - set msg_silent for ":silent"
+ * - set 'eventignore' to "all" for ":noautocmd"
* Return FAIL when the command is not to be executed.
* May set "errormsg" to an error message.
*/
int
! parse_command_modifiers(
! exarg_T *eap,
! char **errormsg,
! cmdmod_T *cmod,
! int skip_only)
{
char_u *p;
int starts_with_colon = FALSE;

! CLEAR_POINTER(cmod);

// Repeat until no more command modifiers are found.
for (;;)
***************
*** 2690,2740 ****
// When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd(&eap->cmd, "aboveleft", 3))
break;
! cmdmod.split |= WSP_ABOVE;
continue;

case 'b': if (checkforcmd(&eap->cmd, "belowright", 3))
{
! cmdmod.split |= WSP_BELOW;
continue;
}
if (checkforcmd(&eap->cmd, "browse", 3))
{
#ifdef FEAT_BROWSE_CMD
! cmdmod.browse = TRUE;
#endif
continue;
}
if (!checkforcmd(&eap->cmd, "botright", 2))
break;
! cmdmod.split |= WSP_BOT;
continue;

case 'c': if (!checkforcmd(&eap->cmd, "confirm", 4))
break;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmdmod.confirm = TRUE;
#endif
continue;

case 'k': if (checkforcmd(&eap->cmd, "keepmarks", 3))
{
! cmdmod.keepmarks = TRUE;
continue;
}
if (checkforcmd(&eap->cmd, "keepalt", 5))
{
! cmdmod.keepalt = TRUE;
continue;
}
if (checkforcmd(&eap->cmd, "keeppatterns", 5))
{
! cmdmod.keeppatterns = TRUE;
continue;
}
if (!checkforcmd(&eap->cmd, "keepjumps", 5))
break;
! cmdmod.keepjumps = TRUE;
continue;

case 'f': // only accept ":filter {pat} cmd"
--- 2695,2745 ----
// When adding an entry, also modify cmd_exists().
case 'a': if (!checkforcmd(&eap->cmd, "aboveleft", 3))
break;
! cmod->cmod_split |= WSP_ABOVE;
continue;

case 'b': if (checkforcmd(&eap->cmd, "belowright", 3))
{
! cmod->cmod_split |= WSP_BELOW;
continue;
}
if (checkforcmd(&eap->cmd, "browse", 3))
{
#ifdef FEAT_BROWSE_CMD
! cmod->cmod_flags |= CMOD_BROWSE;
#endif
continue;
}
if (!checkforcmd(&eap->cmd, "botright", 2))
break;
! cmod->cmod_split |= WSP_BOT;
continue;

case 'c': if (!checkforcmd(&eap->cmd, "confirm", 4))
break;
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmod->cmod_flags |= CMOD_CONFIRM;
#endif
continue;

case 'k': if (checkforcmd(&eap->cmd, "keepmarks", 3))
{
! cmod->cmod_flags |= CMOD_KEEPMARKS;
continue;
}
if (checkforcmd(&eap->cmd, "keepalt", 5))
{
! cmod->cmod_flags |= CMOD_KEEPALT;
continue;
}
if (checkforcmd(&eap->cmd, "keeppatterns", 5))
{
! cmod->cmod_flags |= CMOD_KEEPPATTERNS;
continue;
}
if (!checkforcmd(&eap->cmd, "keepjumps", 5))
break;
! cmod->cmod_flags |= CMOD_KEEPJUMPS;
continue;

case 'f': // only accept ":filter {pat} cmd"
***************
*** 2746,2752 ****
break;
if (*p == '!')
{
! cmdmod.filter_force = TRUE;
p = skipwhite(p + 1);
if (*p == NUL || ends_excmd(*p))
break;
--- 2751,2757 ----
break;
if (*p == '!')
{
! cmod->cmod_filter_force = TRUE;
p = skipwhite(p + 1);
if (*p == NUL || ends_excmd(*p))
break;
***************
*** 2765,2773 ****
break;
if (!skip_only)
{
! cmdmod.filter_regmatch.regprog =
vim_regcomp(reg_pat, RE_MAGIC);
! if (cmdmod.filter_regmatch.regprog == NULL)
break;
}
eap->cmd = p;
--- 2770,2778 ----
break;
if (!skip_only)
{
! cmod->cmod_filter_regmatch.regprog =
vim_regcomp(reg_pat, RE_MAGIC);
! if (cmod->cmod_filter_regmatch.regprog == NULL)
break;
}
eap->cmd = p;
***************
*** 2779,2826 ****
|| *p == NUL || ends_excmd(*p))
break;
eap->cmd = p;
! cmdmod.hide = TRUE;
continue;

case 'l': if (checkforcmd(&eap->cmd, "lockmarks", 3))
{
! cmdmod.lockmarks = TRUE;
continue;
}

if (!checkforcmd(&eap->cmd, "leftabove", 5))
break;
! cmdmod.split |= WSP_ABOVE;
continue;

case 'n': if (checkforcmd(&eap->cmd, "noautocmd", 3))
{
! cmdmod.cmod_flags |= CMOD_NOAUTOCMD;
continue;
}
if (!checkforcmd(&eap->cmd, "noswapfile", 3))
break;
! cmdmod.noswapfile = TRUE;
continue;

case 'r': if (!checkforcmd(&eap->cmd, "rightbelow", 6))
break;
! cmdmod.split |= WSP_BELOW;
continue;

case 's': if (checkforcmd(&eap->cmd, "sandbox", 3))
{
! cmdmod.cmod_flags |= CMOD_SANDBOX;
continue;
}
if (!checkforcmd(&eap->cmd, "silent", 3))
break;
! cmdmod.cmod_flags |= CMOD_SILENT;
if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1]))
{
// ":silent!", but not "silent !cmd"
eap->cmd = skipwhite(eap->cmd + 1);
! cmdmod.cmod_flags |= CMOD_ERRSILENT;
}
continue;

--- 2784,2831 ----
|| *p == NUL || ends_excmd(*p))
break;
eap->cmd = p;
! cmod->cmod_flags |= CMOD_HIDE;
continue;

case 'l': if (checkforcmd(&eap->cmd, "lockmarks", 3))
{
! cmod->cmod_flags |= CMOD_LOCKMARKS;
continue;
}

if (!checkforcmd(&eap->cmd, "leftabove", 5))
break;
! cmod->cmod_split |= WSP_ABOVE;
continue;

case 'n': if (checkforcmd(&eap->cmd, "noautocmd", 3))
{
! cmod->cmod_flags |= CMOD_NOAUTOCMD;
continue;
}
if (!checkforcmd(&eap->cmd, "noswapfile", 3))
break;
! cmod->cmod_flags |= CMOD_NOSWAPFILE;
continue;

case 'r': if (!checkforcmd(&eap->cmd, "rightbelow", 6))
break;
! cmod->cmod_split |= WSP_BELOW;
continue;

case 's': if (checkforcmd(&eap->cmd, "sandbox", 3))
{
! cmod->cmod_flags |= CMOD_SANDBOX;
continue;
}
if (!checkforcmd(&eap->cmd, "silent", 3))
break;
! cmod->cmod_flags |= CMOD_SILENT;
if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1]))
{
// ":silent!", but not "silent !cmd"
eap->cmd = skipwhite(eap->cmd + 1);
! cmod->cmod_flags |= CMOD_ERRSILENT;
}
continue;

***************
*** 2832,2838 ****
ADDR_TABS, eap->skip,
skip_only, FALSE, 1);
if (tabnr == MAXLNUM)
! cmdmod.tab = tabpage_index(curtab) + 1;
else
{
if (tabnr < 0 || tabnr > LAST_TAB_NR)
--- 2837,2843 ----
ADDR_TABS, eap->skip,
skip_only, FALSE, 1);
if (tabnr == MAXLNUM)
! cmod->cmod_tab = tabpage_index(curtab) + 1;
else
{
if (tabnr < 0 || tabnr > LAST_TAB_NR)
***************
*** 2840,2846 ****
*errormsg = _(e_invrange);
return FAIL;
}
! cmdmod.tab = tabnr + 1;
}
}
eap->cmd = p;
--- 2845,2851 ----
*errormsg = _(e_invrange);
return FAIL;
}
! cmod->cmod_tab = tabnr + 1;
}
}
eap->cmd = p;
***************
*** 2848,2872 ****
}
if (!checkforcmd(&eap->cmd, "topleft", 2))
break;
! cmdmod.split |= WSP_TOP;
continue;

case 'u': if (!checkforcmd(&eap->cmd, "unsilent", 3))
break;
! cmdmod.cmod_flags |= CMOD_UNSILENT;
continue;

case 'v': if (checkforcmd(&eap->cmd, "vertical", 4))
{
! cmdmod.split |= WSP_VERT;
continue;
}
if (!checkforcmd(&p, "verbose", 4))
break;
if (vim_isdigit(*eap->cmd))
! cmdmod.cmod_verbose = atoi((char *)eap->cmd);
else
! cmdmod.cmod_verbose = 1;
eap->cmd = p;
continue;
}
--- 2853,2877 ----
}
if (!checkforcmd(&eap->cmd, "topleft", 2))
break;
! cmod->cmod_split |= WSP_TOP;
continue;

case 'u': if (!checkforcmd(&eap->cmd, "unsilent", 3))
break;
! cmod->cmod_flags |= CMOD_UNSILENT;
continue;

case 'v': if (checkforcmd(&eap->cmd, "vertical", 4))
{
! cmod->cmod_split |= WSP_VERT;
continue;
}
if (!checkforcmd(&p, "verbose", 4))
break;
if (vim_isdigit(*eap->cmd))
! cmod->cmod_verbose = atoi((char *)eap->cmd);
else
! cmod->cmod_verbose = 1;
eap->cmd = p;
continue;
}
***************
*** 2899,2905 ****
--- 2904,2913 ----

if ((cmod->cmod_flags & (CMOD_SILENT | CMOD_UNSILENT))
&& cmod->cmod_save_msg_silent == 0)
+ {
cmod->cmod_save_msg_silent = msg_silent + 1;
+ cmod->cmod_save_msg_scroll = msg_scroll;
+ }
if (cmod->cmod_flags & CMOD_SILENT)
++msg_silent;
if (cmod->cmod_flags & CMOD_UNSILENT)
***************
*** 2911,2978 ****
++cmod->cmod_did_esilent;
}

! if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmdmod.cmod_save_ei == NULL)
{
// Set 'eventignore' to "all".
// First save the existing option value for restoring it later.
! cmdmod.cmod_save_ei = vim_strsave(p_ei);
set_string_option_direct((char_u *)"ei", -1,
(char_u *)"all", OPT_FREE, SID_NONE);
}
}

/*
! * Undo and free contents of "cmdmod".
*/
void
! undo_cmdmod(int save_msg_scroll)
{
! if (cmdmod.cmod_verbose_save > 0)
{
! p_verbose = cmdmod.cmod_verbose_save - 1;
! cmdmod.cmod_verbose_save = 0;
}

#ifdef HAVE_SANDBOX
! if (cmdmod.cmod_did_sandbox)
{
--sandbox;
! cmdmod.cmod_did_sandbox = FALSE;
}
#endif

! if (cmdmod.cmod_save_ei != NULL)
{
// Restore 'eventignore' to the value before ":noautocmd".
! set_string_option_direct((char_u *)"ei", -1, cmdmod.cmod_save_ei,
! OPT_FREE, SID_NONE);
! free_string_option(cmdmod.cmod_save_ei);
! cmdmod.cmod_save_ei = NULL;
}

! if (cmdmod.filter_regmatch.regprog != NULL)
! vim_regfree(cmdmod.filter_regmatch.regprog);

! if (cmdmod.cmod_save_msg_silent > 0)
{
// messages could be enabled for a serious error, need to check if the
// counters don't become negative
! if (!did_emsg || msg_silent > cmdmod.cmod_save_msg_silent - 1)
! msg_silent = cmdmod.cmod_save_msg_silent - 1;
! emsg_silent -= cmdmod.cmod_did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
// Restore msg_scroll, it's set by file I/O commands, even when no
// message is actually displayed.
! msg_scroll = save_msg_scroll;

// "silent reg" or "silent echo x" inside "redir" leaves msg_col
// somewhere in the line. Put it back in the first column.
if (redirecting())
msg_col = 0;

! cmdmod.cmod_save_msg_silent = 0;
! cmdmod.cmod_did_esilent = 0;
}
}

--- 2919,2986 ----
++cmod->cmod_did_esilent;
}

! if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL)
{
// Set 'eventignore' to "all".
// First save the existing option value for restoring it later.
! cmod->cmod_save_ei = vim_strsave(p_ei);
set_string_option_direct((char_u *)"ei", -1,
(char_u *)"all", OPT_FREE, SID_NONE);
}
}

/*
! * Undo and free contents of "cmod".
*/
void
! undo_cmdmod(cmdmod_T *cmod)
{
! if (cmod->cmod_verbose_save > 0)
{
! p_verbose = cmod->cmod_verbose_save - 1;
! cmod->cmod_verbose_save = 0;
}

#ifdef HAVE_SANDBOX
! if (cmod->cmod_did_sandbox)
{
--sandbox;
! cmod->cmod_did_sandbox = FALSE;
}
#endif

! if (cmod->cmod_save_ei != NULL)
{
// Restore 'eventignore' to the value before ":noautocmd".
! set_string_option_direct((char_u *)"ei", -1, cmod->cmod_save_ei,
! OPT_FREE, SID_NONE);
! free_string_option(cmod->cmod_save_ei);
! cmod->cmod_save_ei = NULL;
}

! if (cmod->cmod_filter_regmatch.regprog != NULL)
! vim_regfree(cmod->cmod_filter_regmatch.regprog);

! if (cmod->cmod_save_msg_silent > 0)
{
// messages could be enabled for a serious error, need to check if the
// counters don't become negative
! if (!did_emsg || msg_silent > cmod->cmod_save_msg_silent - 1)
! msg_silent = cmod->cmod_save_msg_silent - 1;
! emsg_silent -= cmod->cmod_did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
// Restore msg_scroll, it's set by file I/O commands, even when no
// message is actually displayed.
! msg_scroll = cmod->cmod_save_msg_scroll;

// "silent reg" or "silent echo x" inside "redir" leaves msg_col
// somewhere in the line. Put it back in the first column.
if (redirecting())
msg_col = 0;

! cmod->cmod_save_msg_silent = 0;
! cmod->cmod_did_esilent = 0;
}
}

***************
*** 5130,5136 ****
if (message)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && curbuf->b_fname != NULL)
{
char_u buff[DIALOG_MSG_SIZE];

--- 5138,5145 ----
if (message)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))
! && curbuf->b_fname != NULL)
{
char_u buff[DIALOG_MSG_SIZE];

***************
*** 5450,5456 ****
if (need_hide && !buf_hide(buf) && !forceit)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || cmdmod.confirm) && p_write)
{
bufref_T bufref;

--- 5459,5465 ----
if (need_hide && !buf_hide(buf) && !forceit)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write)
{
bufref_T bufref;

***************
*** 6106,6112 ****
#endif
#ifdef FEAT_BROWSE
char_u dot_path[] = ".";
! int browse_flag = cmdmod.browse;
#endif
int use_tab = eap->cmdidx == CMD_tabedit
|| eap->cmdidx == CMD_tabfind
--- 6115,6121 ----
#endif
#ifdef FEAT_BROWSE
char_u dot_path[] = ".";
! int save_cmod_flags = cmdmod.cmod_flags;
#endif
int use_tab = eap->cmdidx == CMD_tabedit
|| eap->cmdidx == CMD_tabfind
***************
*** 6122,6128 ****
#ifdef FEAT_QUICKFIX
// A ":split" in the quickfix window works like ":new". Don't want two
// quickfix windows. But it's OK when doing ":tab split".
! if (bt_quickfix(curbuf) && cmdmod.tab == 0)
{
if (eap->cmdidx == CMD_split)
eap->cmdidx = CMD_new;
--- 6131,6137 ----
#ifdef FEAT_QUICKFIX
// A ":split" in the quickfix window works like ":new". Don't want two
// quickfix windows. But it's OK when doing ":tab split".
! if (bt_quickfix(curbuf) && cmdmod.cmod_tab == 0)
{
if (eap->cmdidx == CMD_split)
eap->cmdidx = CMD_new;
***************
*** 6145,6151 ****
# endif
#endif
#ifdef FEAT_BROWSE
! if (cmdmod.browse
&& eap->cmdidx != CMD_vnew
&& eap->cmdidx != CMD_new)
{
--- 6154,6160 ----
# endif
#endif
#ifdef FEAT_BROWSE
! if ((cmdmod.cmod_flags & CMOD_BROWSE)
&& eap->cmdidx != CMD_vnew
&& eap->cmdidx != CMD_new)
{
***************
*** 6171,6177 ****
eap->arg = fname;
}
}
! cmdmod.browse = FALSE; // Don't browse again in do_ecmd().
#endif

/*
--- 6180,6186 ----
eap->arg = fname;
}
}
! cmdmod.cmod_flags &= ~CMOD_BROWSE; // Don't browse again in do_ecmd().
#endif

/*
***************
*** 6179,6185 ****
*/
if (use_tab)
{
! if (win_new_tabpage(cmdmod.tab != 0 ? cmdmod.tab
: eap->addr_count == 0 ? 0
: (int)eap->line2 + 1) != FAIL)
{
--- 6188,6194 ----
*/
if (use_tab)
{
! if (win_new_tabpage(cmdmod.cmod_tab != 0 ? cmdmod.cmod_tab
: eap->addr_count == 0 ? 0
: (int)eap->line2 + 1) != FAIL)
{
***************
*** 6189,6195 ****
if (curwin != old_curwin
&& win_valid(old_curwin)
&& old_curwin->w_buffer != curbuf
! && !cmdmod.keepalt)
old_curwin->w_alt_fnum = curbuf->b_fnum;
}
}
--- 6198,6204 ----
if (curwin != old_curwin
&& win_valid(old_curwin)
&& old_curwin->w_buffer != curbuf
! && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
old_curwin->w_alt_fnum = curbuf->b_fnum;
}
}
***************
*** 6198,6208 ****
{
// Reset 'scrollbind' when editing another file, but keep it when
// doing ":split" without arguments.
! if (*eap->arg != NUL
! # ifdef FEAT_BROWSE
! || cmdmod.browse
! # endif
! )
RESET_BINDING(curwin);
else
do_check_scrollbind(FALSE);
--- 6207,6213 ----
{
// Reset 'scrollbind' when editing another file, but keep it when
// doing ":split" without arguments.
! if (*eap->arg != NUL)
RESET_BINDING(curwin);
else
do_check_scrollbind(FALSE);
***************
*** 6210,6216 ****
}

# ifdef FEAT_BROWSE
! cmdmod.browse = browse_flag;
# endif

# if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE)
--- 6215,6221 ----
}

# ifdef FEAT_BROWSE
! cmdmod.cmod_flags = save_cmod_flags;
# endif

# if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE)
***************
*** 6383,6389 ****
need_mouse_correct = TRUE;
# endif
n = atol((char *)eap->arg);
! if (cmdmod.split & WSP_VERT)
{
if (*eap->arg == '-' || *eap->arg == '+')
n += wp->w_width;
--- 6388,6394 ----
need_mouse_correct = TRUE;
# endif
n = atol((char *)eap->arg);
! if (cmdmod.cmod_split & WSP_VERT)
{
if (*eap->arg == '-' || *eap->arg == '+')
n += wp->w_width;
***************
*** 6564,6570 ****
else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit)
|| *eap->arg != NUL
#ifdef FEAT_BROWSE
! || cmdmod.browse
#endif
)
{
--- 6569,6575 ----
else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit)
|| *eap->arg != NUL
#ifdef FEAT_BROWSE
! || (cmdmod.cmod_flags & CMOD_BROWSE)
#endif
)
{
***************
*** 6653,6659 ****
&& curwin != old_curwin
&& win_valid(old_curwin)
&& old_curwin->w_buffer != curbuf
! && !cmdmod.keepalt)
old_curwin->w_alt_fnum = curbuf->b_fnum;

ex_no_reprint = TRUE;
--- 6658,6664 ----
&& curwin != old_curwin
&& win_valid(old_curwin)
&& old_curwin->w_buffer != curbuf
! && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
old_curwin->w_alt_fnum = curbuf->b_fnum;

ex_no_reprint = TRUE;
***************
*** 6798,6804 ****
return;

#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
char_u *browseFile;

--- 6803,6809 ----
return;

#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
char_u *browseFile;

***************
*** 7238,7245 ****
else if (!eap->skip)
{
// Pass flags on for ":vertical wincmd ]".
! postponed_split_flags = cmdmod.split;
! postponed_split_tab = cmdmod.tab;
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0L, xchar);
postponed_split_flags = 0;
postponed_split_tab = 0;
--- 7243,7250 ----
else if (!eap->skip)
{
// Pass flags on for ":vertical wincmd ]".
! postponed_split_flags = cmdmod.cmod_split;
! postponed_split_tab = cmdmod.cmod_tab;
do_window(*eap->arg, eap->addr_count > 0 ? eap->line2 : 0L, xchar);
postponed_split_flags = 0;
postponed_split_tab = 0;
***************
*** 7642,7648 ****
if (fname == NULL)
return;
#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
char_u *browseFile;

--- 7647,7653 ----
if (fname == NULL)
return;
#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
char_u *browseFile;

***************
*** 8314,8321 ****
ex_stag(exarg_T *eap)
{
postponed_split = -1;
! postponed_split_flags = cmdmod.split;
! postponed_split_tab = cmdmod.tab;
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
postponed_split_flags = 0;
postponed_split_tab = 0;
--- 8319,8326 ----
ex_stag(exarg_T *eap)
{
postponed_split = -1;
! postponed_split_flags = cmdmod.cmod_split;
! postponed_split_tab = cmdmod.cmod_tab;
ex_tag_cmd(eap, cmdnames[eap->cmdidx].cmd_name + 1);
postponed_split_flags = 0;
postponed_split_tab = 0;
*** ../vim-8.2.1897/src/ex_getln.c 2020-09-14 16:37:30.906845912 +0200
--- src/ex_getln.c 2020-10-24 20:15:38.017086531 +0200
***************
*** 195,201 ****
int *patlen)
{
char_u *cmd;
! cmdmod_T save_cmdmod = cmdmod;
char_u *p;
int delim_optional = FALSE;
int delim;
--- 195,201 ----
int *patlen)
{
char_u *cmd;
! cmdmod_T dummy_cmdmod;
char_u *p;
int delim_optional = FALSE;
int delim;
***************
*** 231,238 ****
ea.cmd = ccline.cmdbuff;
ea.addr_type = ADDR_LINES;

! parse_command_modifiers(&ea, &dummy, TRUE);
! cmdmod = save_cmdmod;

cmd = skip_range(ea.cmd, TRUE, NULL);
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL)
--- 231,238 ----
ea.cmd = ccline.cmdbuff;
ea.addr_type = ADDR_LINES;

! CLEAR_FIELD(dummy_cmdmod);
! parse_command_modifiers(&ea, &dummy, &dummy_cmdmod, TRUE);

cmd = skip_range(ea.cmd, TRUE, NULL);
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL)
***************
*** 4163,4170 ****
pum_undisplay();

// don't use a new tab page
! cmdmod.tab = 0;
! cmdmod.noswapfile = 1;

// Create a window for the command-line buffer.
if (win_split((int)p_cwh, WSP_BOT) == FAIL)
--- 4163,4170 ----
pum_undisplay();

// don't use a new tab page
! cmdmod.cmod_tab = 0;
! cmdmod.cmod_flags |= CMOD_NOSWAPFILE;

// Create a window for the command-line buffer.
if (win_split((int)p_cwh, WSP_BOT) == FAIL)
*** ../vim-8.2.1897/src/fileio.c 2020-10-11 14:28:07.074402602 +0200
--- src/fileio.c 2020-10-24 20:40:07.524447846 +0200
***************
*** 2501,2507 ****
check_cursor_lnum();
beginline(BL_WHITE | BL_FIX); // on first non-blank

! if (!cmdmod.lockmarks)
{
// Set '[ and '] marks to the newly read lines.
curbuf->b_op_start.lnum = from + 1;
--- 2501,2507 ----
check_cursor_lnum();
beginline(BL_WHITE | BL_FIX); // on first non-blank

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set '[ and '] marks to the newly read lines.
curbuf->b_op_start.lnum = from + 1;
*** ../vim-8.2.1897/src/filepath.c 2020-10-05 20:38:02.469117560 +0200
--- src/filepath.c 2020-10-24 19:31:59.506081728 +0200
***************
*** 2213,2223 ****
char_u *fname;
static char_u *last_dir = NULL; // last used directory
char_u *tofree = NULL;
! int save_browse = cmdmod.browse;

// Must turn off browse to avoid that autocommands will get the
// flag too!
! cmdmod.browse = FALSE;

if (title == NULL || *title == NUL)
{
--- 2213,2223 ----
char_u *fname;
static char_u *last_dir = NULL; // last used directory
char_u *tofree = NULL;
! int save_cmod_flags = cmdmod.cmod_flags;

// Must turn off browse to avoid that autocommands will get the
// flag too!
! cmdmod.cmod_flags &= ~CMOD_BROWSE;

if (title == NULL || *title == NUL)
{
***************
*** 2350,2356 ****
}

vim_free(tofree);
! cmdmod.browse = save_browse;

return fname;
}
--- 2350,2356 ----
}

vim_free(tofree);
! cmdmod.cmod_flags = save_cmod_flags;

return fname;
}
*** ../vim-8.2.1897/src/gui.c 2020-08-11 21:58:12.581968226 +0200
--- src/gui.c 2020-10-24 19:41:02.764602351 +0200
***************
*** 864,873 ****
// Only exit when there are no changed files
exiting = TRUE;
# ifdef FEAT_BROWSE
! cmdmod.browse = TRUE;
# endif
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmdmod.confirm = TRUE;
# endif
// If there are changed buffers, present the user with a dialog if
// possible, otherwise give an error message.
--- 864,873 ----
// Only exit when there are no changed files
exiting = TRUE;
# ifdef FEAT_BROWSE
! cmdmod.cmod_flags |= CMOD_BROWSE;
# endif
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmdmod.cmod_flags |= CMOD_CONFIRM;
# endif
// If there are changed buffers, present the user with a dialog if
// possible, otherwise give an error message.
*** ../vim-8.2.1897/src/gui_gtk_x11.c 2020-10-21 16:10:16.382485983 +0200
--- src/gui_gtk_x11.c 2020-10-24 19:43:15.440240485 +0200
***************
*** 2226,2235 ****
save_cmdmod = cmdmod;

# ifdef FEAT_BROWSE
! cmdmod.browse = TRUE;
# endif
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmdmod.confirm = TRUE;
# endif
/*
* If there are changed buffers, present the user with
--- 2226,2235 ----
save_cmdmod = cmdmod;

# ifdef FEAT_BROWSE
! cmdmod.cmod_flags |= CMOD_BROWSE;
# endif
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! cmdmod.cmod_flags |= CMOD_CONFIRM;
# endif
/*
* If there are changed buffers, present the user with
*** ../vim-8.2.1897/src/help.c 2020-10-11 19:08:30.096946822 +0200
--- src/help.c 2020-10-24 19:49:34.783205092 +0200
***************
*** 123,131 ****

// Re-use an existing help window or open a new one.
// Always open a new one for ":tab help".
! if (!bt_help(curwin->w_buffer) || cmdmod.tab != 0)
{
! if (cmdmod.tab != 0)
wp = NULL;
else
FOR_ALL_WINDOWS(wp)
--- 123,131 ----

// Re-use an existing help window or open a new one.
// Always open a new one for ":tab help".
! if (!bt_help(curwin->w_buffer) || cmdmod.cmod_tab != 0)
{
! if (cmdmod.cmod_tab != 0)
wp = NULL;
else
FOR_ALL_WINDOWS(wp)
***************
*** 148,154 ****
// specified, the current window is vertically split and
// narrow.
n = WSP_HELP;
! if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
n |= WSP_TOP;
if (win_split(0, n) == FAIL)
--- 148,154 ----
// specified, the current window is vertically split and
// narrow.
n = WSP_HELP;
! if (cmdmod.cmod_split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
n |= WSP_TOP;
if (win_split(0, n) == FAIL)
***************
*** 164,170 ****
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
ECMD_HIDE + ECMD_SET_HELP,
NULL); // buffer is still open, don't store info
! if (!cmdmod.keepalt)
curwin->w_alt_fnum = alt_fnum;
empty_fnum = curbuf->b_fnum;
}
--- 164,170 ----
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
ECMD_HIDE + ECMD_SET_HELP,
NULL); // buffer is still open, don't store info
! if ((cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = alt_fnum;
empty_fnum = curbuf->b_fnum;
}
***************
*** 193,199 ****
}

// keep the previous alternate file
! if (alt_fnum != 0 && curwin->w_alt_fnum == empty_fnum && !cmdmod.keepalt)
curwin->w_alt_fnum = alt_fnum;

erret:
--- 193,200 ----
}

// keep the previous alternate file
! if (alt_fnum != 0 && curwin->w_alt_fnum == empty_fnum
! && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0)
curwin->w_alt_fnum = alt_fnum;

erret:
*** ../vim-8.2.1897/src/if_cscope.c 2020-08-23 14:28:24.111838486 +0200
--- src/if_cscope.c 2020-10-24 18:08:00.667848691 +0200
***************
*** 212,219 ****
return;
}
postponed_split = -1;
! postponed_split_flags = cmdmod.split;
! postponed_split_tab = cmdmod.tab;
}

cmdp->func(eap);
--- 212,219 ----
return;
}
postponed_split = -1;
! postponed_split_flags = cmdmod.cmod_split;
! postponed_split_tab = cmdmod.cmod_tab;
}

cmdp->func(eap);
*** ../vim-8.2.1897/src/indent.c 2020-06-29 20:40:34.022867216 +0200
--- src/indent.c 2020-10-24 20:10:10.482192017 +0200
***************
*** 1049,1055 ****
smsg(NGETTEXT("%ld line indented ",
"%ld lines indented ", i), i);
}
! if (!cmdmod.lockmarks)
{
// set '[ and '] marks
curbuf->b_op_start = oap->start;
--- 1049,1055 ----
smsg(NGETTEXT("%ld line indented ",
"%ld lines indented ", i), i);
}
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// set '[ and '] marks
curbuf->b_op_start = oap->start;
*** ../vim-8.2.1897/src/mark.c 2020-07-19 22:09:02.655572869 +0200
--- src/mark.c 2020-10-24 20:20:12.608194637 +0200
***************
*** 145,151 ****
#endif

// for :global the mark is set only once
! if (global_busy || listcmd_busy || cmdmod.keepjumps)
return;

curwin->w_prev_pcmark = curwin->w_pcmark;
--- 145,151 ----
#endif

// for :global the mark is set only once
! if (global_busy || listcmd_busy || (cmdmod.cmod_flags & CMOD_KEEPJUMPS))
return;

curwin->w_prev_pcmark = curwin->w_pcmark;
***************
*** 1068,1074 ****
if (line2 < line1 && amount_after == 0L) // nothing to do
return;

! if (!cmdmod.lockmarks)
{
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
--- 1068,1074 ----
if (line2 < line1 && amount_after == 0L) // nothing to do
return;

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// named marks, lower case and upper case
for (i = 0; i < NMARKS; i++)
***************
*** 1133,1139 ****
FOR_ALL_TAB_WINDOWS(tab, win)
{
#ifdef FEAT_JUMPLIST
! if (!cmdmod.lockmarks)
// Marks in the jumplist. When deleting lines, this may create
// duplicate marks in the jumplist, they will be removed later.
for (i = 0; i < win->w_jumplistlen; ++i)
--- 1133,1139 ----
FOR_ALL_TAB_WINDOWS(tab, win)
{
#ifdef FEAT_JUMPLIST
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
// Marks in the jumplist. When deleting lines, this may create
// duplicate marks in the jumplist, they will be removed later.
for (i = 0; i < win->w_jumplistlen; ++i)
***************
*** 1143,1149 ****

if (win->w_buffer == curbuf)
{
! if (!cmdmod.lockmarks)
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
--- 1143,1149 ----

if (win->w_buffer == curbuf)
{
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
// marks in the tag stack
for (i = 0; i < win->w_tagstacklen; i++)
if (win->w_tagstack[i].fmark.fnum == fnum)
***************
*** 1249,1255 ****
win_T *win;
pos_T *posp;

! if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks)
return; // nothing to do

// named marks, lower case and upper case
--- 1249,1256 ----
win_T *win;
pos_T *posp;

! if ((col_amount == 0L && lnum_amount == 0L)
! || (cmdmod.cmod_flags & CMOD_LOCKMARKS))
return; // nothing to do

// named marks, lower case and upper case
*** ../vim-8.2.1897/src/memline.c 2020-09-12 21:04:18.518231440 +0200
--- src/memline.c 2020-10-24 20:16:30.928912799 +0200
***************
*** 289,295 ****
buf->b_ml.ml_chunksize = NULL;
#endif

! if (cmdmod.noswapfile)
buf->b_p_swf = FALSE;

/*
--- 289,295 ----
buf->b_ml.ml_chunksize = NULL;
#endif

! if (cmdmod.cmod_flags & CMOD_NOSWAPFILE)
buf->b_p_swf = FALSE;

/*
***************
*** 635,641 ****
* When 'updatecount' is 0 and 'noswapfile' there is no swap file.
* For help files we will make a swap file now.
*/
! if (p_uc != 0 && !cmdmod.noswapfile)
ml_open_file(buf); // create a swap file
return;
}
--- 635,641 ----
* When 'updatecount' is 0 and 'noswapfile' there is no swap file.
* For help files we will make a swap file now.
*/
! if (p_uc != 0 && (cmdmod.cmod_flags & CMOD_NOSWAPFILE) == 0)
ml_open_file(buf); // create a swap file
return;
}
***************
*** 747,753 ****
char_u *dirp;

mfp = buf->b_ml.ml_mfp;
! if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf || cmdmod.noswapfile)
return; // nothing to do

#ifdef FEAT_SPELL
--- 747,754 ----
char_u *dirp;

mfp = buf->b_ml.ml_mfp;
! if (mfp == NULL || mfp->mf_fd >= 0 || !buf->b_p_swf
! || (cmdmod.cmod_flags & CMOD_NOSWAPFILE))
return; // nothing to do

#ifdef FEAT_SPELL
*** ../vim-8.2.1897/src/message.c 2020-10-13 22:15:37.482726643 +0200
--- src/message.c 2020-10-24 18:18:28.310162325 +0200
***************
*** 2319,2328 ****
{
int match;

! if (cmdmod.filter_regmatch.regprog == NULL)
return FALSE;
! match = vim_regexec(&cmdmod.filter_regmatch, msg, (colnr_T)0);
! return cmdmod.filter_force ? match : !match;
}

/*
--- 2319,2328 ----
{
int match;

! if (cmdmod.cmod_filter_regmatch.regprog == NULL)
return FALSE;
! match = vim_regexec(&cmdmod.cmod_filter_regmatch, msg, (colnr_T)0);
! return cmdmod.cmod_filter_force ? match : !match;
}

/*
*** ../vim-8.2.1897/src/option.c 2020-09-12 21:04:18.518231440 +0200
--- src/option.c 2020-10-24 20:16:44.660867872 +0200
***************
*** 1125,1131 ****
else if (eap->cmdidx == CMD_setglobal)
flags = OPT_GLOBAL;
#if defined(FEAT_EVAL) && defined(FEAT_BROWSE)
! if (cmdmod.browse && flags == 0)
ex_options(eap);
else
#endif
--- 1125,1131 ----
else if (eap->cmdidx == CMD_setglobal)
flags = OPT_GLOBAL;
#if defined(FEAT_EVAL) && defined(FEAT_BROWSE)
! if ((cmdmod.cmod_flags & CMOD_BROWSE) && flags == 0)
ex_options(eap);
else
#endif
***************
*** 5774,5780 ****
buf->b_p_ml_nobin = p_ml_nobin;
buf->b_p_inf = p_inf;
COPY_OPT_SCTX(buf, BV_INF);
! if (cmdmod.noswapfile)
buf->b_p_swf = FALSE;
else
{
--- 5774,5780 ----
buf->b_p_ml_nobin = p_ml_nobin;
buf->b_p_inf = p_inf;
COPY_OPT_SCTX(buf, BV_INF);
! if (cmdmod.cmod_flags & CMOD_NOSWAPFILE)
buf->b_p_swf = FALSE;
else
{
*** ../vim-8.2.1897/src/ops.c 2020-09-16 15:46:04.881061899 +0200
--- src/ops.c 2020-10-24 20:12:01.373810823 +0200
***************
*** 204,210 ****
msg_attr_keep((char *)IObuff, 0, TRUE);
}

! if (!cmdmod.lockmarks)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
--- 204,210 ----
msg_attr_keep((char *)IObuff, 0, TRUE);
}

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
***************
*** 943,949 ****
msgmore(curbuf->b_ml.ml_line_count - old_lcount);

setmarks:
! if (!cmdmod.lockmarks)
{
if (oap->block_mode)
{
--- 943,949 ----
msgmore(curbuf->b_ml.ml_line_count - old_lcount);

setmarks:
! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
if (oap->block_mode)
{
***************
*** 1216,1222 ****
check_cursor();
changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L);

! if (!cmdmod.lockmarks)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
--- 1216,1222 ----
check_cursor();
changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, 0L);

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
***************
*** 1329,1335 ****
// No change: need to remove the Visual selection
redraw_curbuf_later(INVERTED);

! if (!cmdmod.lockmarks)
{
// Set '[ and '] marks.
curbuf->b_op_start = oap->start;
--- 1329,1335 ----
// No change: need to remove the Visual selection
redraw_curbuf_later(INVERTED);

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set '[ and '] marks.
curbuf->b_op_start = oap->start;
***************
*** 1942,1948 ****
#ifdef FEAT_PROP_POPUP
propcount += count_props((linenr_T) (curwin->w_cursor.lnum + t), t > 0);
#endif
! if (t == 0 && setmark && !cmdmod.lockmarks)
{
// Set the '[ mark.
curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
--- 1942,1948 ----
#ifdef FEAT_PROP_POPUP
propcount += count_props((linenr_T) (curwin->w_cursor.lnum + t), t > 0);
#endif
! if (t == 0 && setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set the '[ mark.
curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
***************
*** 2088,2094 ****

ml_replace_len(curwin->w_cursor.lnum, newp, (colnr_T)newp_len, TRUE, FALSE);

! if (setmark && !cmdmod.lockmarks)
{
// Set the '] mark.
curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
--- 2088,2094 ----

ml_replace_len(curwin->w_cursor.lnum, newp, (colnr_T)newp_len, TRUE, FALSE);

! if (setmark && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set the '] mark.
curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
***************
*** 2405,2411 ****

// Set '[ mark if something changed. Keep the last end
// position from do_addsub().
! if (change_cnt > 0 && !cmdmod.lockmarks)
curbuf->b_op_start = startpos;

if (change_cnt > p_report)
--- 2405,2411 ----

// Set '[ mark if something changed. Keep the last end
// position from do_addsub().
! if (change_cnt > 0 && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
curbuf->b_op_start = startpos;

if (change_cnt > p_report)
***************
*** 2852,2858 ****
--curwin->w_cursor.col;
}

! if (did_change && !cmdmod.lockmarks)
{
// set the '[ and '] marks
curbuf->b_op_start = startpos;
--- 2852,2858 ----
--curwin->w_cursor.col;
}

! if (did_change && (cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// set the '[ and '] marks
curbuf->b_op_start = startpos;
***************
*** 3301,3307 ****
(void)call_func_retnr(p_opfunc, 1, argv);

virtual_op = save_virtual_op;
! if (cmdmod.lockmarks)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
--- 3301,3307 ----
(void)call_func_retnr(p_opfunc, 1, argv);

virtual_op = save_virtual_op;
! if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
*** ../vim-8.2.1897/src/os_unix.c 2020-10-24 13:30:46.280240528 +0200
--- src/os_unix.c 2020-10-24 19:44:18.640068048 +0200
***************
*** 7868,7882 ****
static void
xsmp_handle_interaction(SmcConn smc_conn, SmPointer client_data UNUSED)
{
! cmdmod_T save_cmdmod;
int cancel_shutdown = False;

! save_cmdmod = cmdmod;
! cmdmod.confirm = TRUE;
if (check_changed_any(FALSE, FALSE))
// Mustn't logout
cancel_shutdown = True;
! cmdmod = save_cmdmod;
setcursor(); // position cursor
out_flush();

--- 7868,7882 ----
static void
xsmp_handle_interaction(SmcConn smc_conn, SmPointer client_data UNUSED)
{
! int save_cmod_flags;
int cancel_shutdown = False;

! save_cmod_flags = cmdmod.cmod_flags;
! cmdmod.cmod_flags |= CMOD_CONFIRM;
if (check_changed_any(FALSE, FALSE))
// Mustn't logout
cancel_shutdown = True;
! cmdmod.cmod_flags = save_cmod_flags;
setcursor(); // position cursor
out_flush();

*** ../vim-8.2.1897/src/quickfix.c 2020-10-20 14:59:08.689104235 +0200
--- src/quickfix.c 2020-10-24 19:32:52.389937937 +0200
***************
*** 2834,2840 ****
win_T *wp;
int flags;

! if (cmdmod.tab != 0 || newwin)
wp = NULL;
else
wp = qf_find_help_win();
--- 2834,2840 ----
win_T *wp;
int flags;

! if (cmdmod.cmod_tab != 0 || newwin)
wp = NULL;
else
wp = qf_find_help_win();
***************
*** 2845,2851 ****
// Split off help window; put it at far top if no position
// specified, the current window is vertically split and narrow.
flags = WSP_HELP;
! if (cmdmod.split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
flags |= WSP_TOP;
// If the user asks to open a new window, then copy the location list.
--- 2845,2851 ----
// Split off help window; put it at far top if no position
// specified, the current window is vertically split and narrow.
flags = WSP_HELP;
! if (cmdmod.cmod_split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
flags |= WSP_TOP;
// If the user asks to open a new window, then copy the location list.
***************
*** 3278,3284 ****
qfltype_T qfl_type = qfl->qfl_type;

// For ":helpgrep" find a help window or open one.
! if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0))
if (jump_to_help_window(qi, newwin, opened_window) == FAIL)
return FAIL;
if (old_qf_curlist != qi->qf_curlist
--- 3278,3285 ----
qfltype_T qfl_type = qfl->qfl_type;

// For ":helpgrep" find a help window or open one.
! if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer)
! || cmdmod.cmod_tab != 0))
if (jump_to_help_window(qi, newwin, opened_window) == FAIL)
return FAIL;
if (old_qf_curlist != qi->qf_curlist
***************
*** 4125,4136 ****
// The current window becomes the previous window afterwards.
win = curwin;

! if (IS_QF_STACK(qi) && cmdmod.split == 0)
// Create the new quickfix window at the very bottom, except when
// :belowright or :aboveleft is used.
win_goto(lastwin);
// Default is to open the window below the current window
! if (cmdmod.split == 0)
flags = WSP_BELOW;
flags |= WSP_NEWLOC;
if (win_split(height, flags) == FAIL)
--- 4126,4137 ----
// The current window becomes the previous window afterwards.
win = curwin;

! if (IS_QF_STACK(qi) && cmdmod.cmod_split == 0)
// Create the new quickfix window at the very bottom, except when
// :belowright or :aboveleft is used.
win_goto(lastwin);
// Default is to open the window below the current window
! if (cmdmod.cmod_split == 0)
flags = WSP_BELOW;
flags |= WSP_NEWLOC;
if (win_split(height, flags) == FAIL)
***************
*** 4208,4216 ****
#endif

// Find an existing quickfix window, or open a new one.
! if (cmdmod.tab == 0)
status = qf_goto_cwindow(qi, eap->addr_count != 0, height,
! cmdmod.split & WSP_VERT);
if (status == FAIL)
if (qf_open_new_cwindow(qi, height) == FAIL)
{
--- 4209,4217 ----
#endif

// Find an existing quickfix window, or open a new one.
! if (cmdmod.cmod_tab == 0)
status = qf_goto_cwindow(qi, eap->addr_count != 0, height,
! cmdmod.cmod_split & WSP_VERT);
if (status == FAIL)
if (qf_open_new_cwindow(qi, height) == FAIL)
{
***************
*** 5693,5699 ****

enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg,
NULL, NULL,
--- 5694,5700 ----

enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
char_u *browse_file = do_browse(0, (char_u *)_("Error file"), eap->arg,
NULL, NULL,
***************
*** 6164,6170 ****
wipe_dummy_buffer(buf, dirname_start);
buf = NULL;
}
! else if (!cmdmod.hide
|| buf->b_p_bh[0] == 'u' // "unload"
|| buf->b_p_bh[0] == 'w' // "wipe"
|| buf->b_p_bh[0] == 'd') // "delete"
--- 6165,6171 ----
wipe_dummy_buffer(buf, dirname_start);
buf = NULL;
}
! else if ((cmdmod.cmod_flags & CMOD_HIDE) == 0
|| buf->b_p_bh[0] == 'u' // "unload"
|| buf->b_p_bh[0] == 'w' // "wipe"
|| buf->b_p_bh[0] == 'd') // "delete"
*** ../vim-8.2.1897/src/register.c 2020-09-08 22:45:31.113504961 +0200
--- src/register.c 2020-10-24 20:12:16.561759228 +0200
***************
*** 1358,1364 ****
}
}

! if (!cmdmod.lockmarks)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
--- 1358,1364 ----
}
}

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
{
// Set "'[" and "']" marks.
curbuf->b_op_start = oap->start;
***************
*** 2170,2176 ****
curwin->w_set_curswant = TRUE;

end:
! if (cmdmod.lockmarks)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
--- 2170,2176 ----
curwin->w_set_curswant = TRUE;

end:
! if (cmdmod.cmod_flags & CMOD_LOCKMARKS)
{
curbuf->b_op_start = orig_start;
curbuf->b_op_end = orig_end;
*** ../vim-8.2.1897/src/scriptfile.c 2020-10-14 19:39:16.041002546 +0200
--- src/scriptfile.c 2020-10-24 19:33:04.217905766 +0200
***************
*** 979,985 ****
ex_source(exarg_T *eap)
{
#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
char_u *fname = NULL;

--- 979,985 ----
ex_source(exarg_T *eap)
{
#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
char_u *fname = NULL;

*** ../vim-8.2.1897/src/search.c 2020-10-23 16:49:30.112311448 +0200
--- src/search.c 2020-10-24 20:14:40.805275636 +0200
***************
*** 189,195 ****
* Save the currently used pattern in the appropriate place,
* unless the pattern should not be remembered.
*/
! if (!(options & SEARCH_KEEP) && !cmdmod.keeppatterns)
{
// search or global command
if (pat_save == RE_SEARCH || pat_save == RE_BOTH)
--- 189,196 ----
* Save the currently used pattern in the appropriate place,
* unless the pattern should not be remembered.
*/
! if (!(options & SEARCH_KEEP)
! && (cmdmod.cmod_flags & CMOD_KEEPPATTERNS) == 0)
{
// search or global command
if (pat_save == RE_SEARCH || pat_save == RE_BOTH)
***************
*** 1661,1667 ****
curwin->w_set_curswant = TRUE;

end_do_search:
! if ((options & SEARCH_KEEP) || cmdmod.keeppatterns)
spats[0].off = old_off;
vim_free(strcopy);
vim_free(msgbuf);
--- 1662,1668 ----
curwin->w_set_curswant = TRUE;

end_do_search:
! if ((options & SEARCH_KEEP) || (cmdmod.cmod_flags & CMOD_KEEPPATTERNS))
spats[0].off = old_off;
vim_free(strcopy);
vim_free(msgbuf);
*** ../vim-8.2.1897/src/session.c 2020-09-11 22:10:17.965597366 +0200
--- src/session.c 2020-10-24 19:33:11.693885439 +0200
***************
*** 1144,1150 ****
fname = (char_u *)EXRC_FILE;

#ifdef FEAT_BROWSE
! if (cmdmod.browse)
{
browseFile = do_browse(BROWSE_SAVE,
# ifdef FEAT_SESSION
--- 1144,1150 ----
fname = (char_u *)EXRC_FILE;

#ifdef FEAT_BROWSE
! if (cmdmod.cmod_flags & CMOD_BROWSE)
{
browseFile = do_browse(BROWSE_SAVE,
# ifdef FEAT_SESSION
*** ../vim-8.2.1897/src/tag.c 2020-08-30 19:26:40.736556825 +0200
--- src/tag.c 2020-10-24 18:08:33.411759588 +0200
***************
*** 3463,3469 ****
}
}
if (getfile_result == GETFILE_UNUSED
! && (postponed_split || cmdmod.tab != 0))
{
if (win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags) == FAIL)
--- 3463,3469 ----
}
}
if (getfile_result == GETFILE_UNUSED
! && (postponed_split || cmdmod.cmod_tab != 0))
{
if (win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags) == FAIL)
*** ../vim-8.2.1897/src/terminal.c 2020-10-23 15:40:35.651287923 +0200
--- src/terminal.c 2020-10-24 19:44:31.660032502 +0200
***************
*** 440,446 ****
buf_T *old_curbuf = NULL;
int res;
buf_T *newbuf;
! int vertical = opt->jo_vertical || (cmdmod.split & WSP_VERT);
jobopt_T orig_opt; // only partly filled

if (check_restricted() || check_secure())
--- 440,446 ----
buf_T *old_curbuf = NULL;
int res;
buf_T *newbuf;
! int vertical = opt->jo_vertical || (cmdmod.cmod_split & WSP_VERT);
jobopt_T orig_opt; // only partly filled

if (check_restricted() || check_secure())
***************
*** 529,535 ****
}

if (vertical)
! cmdmod.split |= WSP_VERT;
ex_splitview(&split_ea);
if (curwin == old_curwin)
{
--- 529,535 ----
}

if (vertical)
! cmdmod.cmod_split |= WSP_VERT;
ex_splitview(&split_ea);
if (curwin == old_curwin)
{
***************
*** 1592,1598 ****
char *how = (char *)buf->b_term->tl_kill;

#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((how == NULL || *how == NUL) && (p_confirm || cmdmod.confirm))
{
char_u buff[DIALOG_MSG_SIZE];
int ret;
--- 1592,1599 ----
char *how = (char *)buf->b_term->tl_kill;

#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if ((how == NULL || *how == NUL)
! && (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
{
char_u buff[DIALOG_MSG_SIZE];
int ret;
*** ../vim-8.2.1897/src/textformat.c 2020-06-04 18:21:56.046395485 +0200
--- src/textformat.c 2020-10-24 20:12:25.457729088 +0200
***************
*** 819,825 ****
// When there is no change: need to remove the Visual selection
redraw_curbuf_later(INVERTED);

! if (!cmdmod.lockmarks)
// Set '[ mark at the start of the formatted area
curbuf->b_op_start = oap->start;

--- 819,825 ----
// When there is no change: need to remove the Visual selection
redraw_curbuf_later(INVERTED);

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
// Set '[ mark at the start of the formatted area
curbuf->b_op_start = oap->start;

***************
*** 839,845 ****
old_line_count = curbuf->b_ml.ml_line_count - old_line_count;
msgmore(old_line_count);

! if (!cmdmod.lockmarks)
// put '] mark on the end of the formatted area
curbuf->b_op_end = curwin->w_cursor;

--- 839,845 ----
old_line_count = curbuf->b_ml.ml_line_count - old_line_count;
msgmore(old_line_count);

! if ((cmdmod.cmod_flags & CMOD_LOCKMARKS) == 0)
// put '] mark on the end of the formatted area
curbuf->b_op_end = curwin->w_cursor;

*** ../vim-8.2.1897/src/usercmd.c 2020-10-20 23:11:30.172481858 +0200
--- src/usercmd.c 2020-10-24 20:21:04.528028294 +0200
***************
*** 1235,1242 ****
}

/*
! * Add modifiers from "cmdmod.split" to "buf". Set "multi_mods" when one was
! * added. Return the number of bytes added.
*/
size_t
add_win_cmd_modifers(char_u *buf, int *multi_mods)
--- 1235,1242 ----
}

/*
! * Add modifiers from "cmdmod.cmod_split" to "buf". Set "multi_mods" when one
! * was added. Return the number of bytes added.
*/
size_t
add_win_cmd_modifers(char_u *buf, int *multi_mods)
***************
*** 1244,1266 ****
size_t result = 0;

// :aboveleft and :leftabove
! if (cmdmod.split & WSP_ABOVE)
result += add_cmd_modifier(buf, "aboveleft", multi_mods);
// :belowright and :rightbelow
! if (cmdmod.split & WSP_BELOW)
result += add_cmd_modifier(buf, "belowright", multi_mods);
// :botright
! if (cmdmod.split & WSP_BOT)
result += add_cmd_modifier(buf, "botright", multi_mods);

// :tab
! if (cmdmod.tab > 0)
result += add_cmd_modifier(buf, "tab", multi_mods);
// :topleft
! if (cmdmod.split & WSP_TOP)
result += add_cmd_modifier(buf, "topleft", multi_mods);
// :vertical
! if (cmdmod.split & WSP_VERT)
result += add_cmd_modifier(buf, "vertical", multi_mods);
return result;
}
--- 1244,1266 ----
size_t result = 0;

// :aboveleft and :leftabove
! if (cmdmod.cmod_split & WSP_ABOVE)
result += add_cmd_modifier(buf, "aboveleft", multi_mods);
// :belowright and :rightbelow
! if (cmdmod.cmod_split & WSP_BELOW)
result += add_cmd_modifier(buf, "belowright", multi_mods);
// :botright
! if (cmdmod.cmod_split & WSP_BOT)
result += add_cmd_modifier(buf, "botright", multi_mods);

// :tab
! if (cmdmod.cmod_tab > 0)
result += add_cmd_modifier(buf, "tab", multi_mods);
// :topleft
! if (cmdmod.cmod_split & WSP_TOP)
result += add_cmd_modifier(buf, "topleft", multi_mods);
// :vertical
! if (cmdmod.cmod_split & WSP_VERT)
result += add_cmd_modifier(buf, "vertical", multi_mods);
return result;
}
***************
*** 1454,1477 ****
{
int multi_mods = 0;
typedef struct {
! int *varp;
char *name;
} mod_entry_T;
static mod_entry_T mod_entries[] = {
#ifdef FEAT_BROWSE_CMD
! {&cmdmod.browse, "browse"},
#endif
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! {&cmdmod.confirm, "confirm"},
#endif
! {&cmdmod.hide, "hide"},
! {&cmdmod.keepalt, "keepalt"},
! {&cmdmod.keepjumps, "keepjumps"},
! {&cmdmod.keepmarks, "keepmarks"},
! {&cmdmod.keeppatterns, "keeppatterns"},
! {&cmdmod.lockmarks, "lockmarks"},
! {&cmdmod.noswapfile, "noswapfile"},
! {NULL, NULL}
};
int i;

--- 1454,1477 ----
{
int multi_mods = 0;
typedef struct {
! int flag;
char *name;
} mod_entry_T;
static mod_entry_T mod_entries[] = {
#ifdef FEAT_BROWSE_CMD
! {CMOD_BROWSE, "browse"},
#endif
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! {CMOD_CONFIRM, "confirm"},
#endif
! {CMOD_HIDE, "hide"},
! {CMOD_KEEPALT, "keepalt"},
! {CMOD_KEEPJUMPS, "keepjumps"},
! {CMOD_KEEPMARKS, "keepmarks"},
! {CMOD_KEEPPATTERNS, "keeppatterns"},
! {CMOD_LOCKMARKS, "lockmarks"},
! {CMOD_NOSWAPFILE, "noswapfile"},
! {0, NULL}
};
int i;

***************
*** 1484,1491 ****
}

// the modifiers that are simple flags
! for (i = 0; mod_entries[i].varp != NULL; ++i)
! if (*mod_entries[i].varp)
result += add_cmd_modifier(buf, mod_entries[i].name,
&multi_mods);

--- 1484,1491 ----
}

// the modifiers that are simple flags
! for (i = 0; mod_entries[i].name != NULL; ++i)
! if (cmdmod.cmod_flags & mod_entries[i].flag)
result += add_cmd_modifier(buf, mod_entries[i].name,
&multi_mods);

***************
*** 1501,1507 ****
// :verbose
if (p_verbose > 0)
result += add_cmd_modifier(buf, "verbose", &multi_mods);
! // flags from cmdmod.split
result += add_win_cmd_modifers(buf, &multi_mods);
if (quote && buf != NULL)
{
--- 1501,1507 ----
// :verbose
if (p_verbose > 0)
result += add_cmd_modifier(buf, "verbose", &multi_mods);
! // flags from cmdmod.cmod_split
result += add_win_cmd_modifers(buf, &multi_mods);
if (quote && buf != NULL)
{
*** ../vim-8.2.1897/src/vim9compile.c 2020-10-24 17:19:12.135743402 +0200
--- src/vim9compile.c 2020-10-24 18:48:11.933299524 +0200
***************
*** 1826,1842 ****
* Generate any instructions for side effects of "cmdmod".
*/
static int
! generate_cmdmods(cctx_T *cctx)
{
isn_T *isn;

// TODO: use more modifiers in the command
! if (cmdmod.cmod_flags & (CMOD_SILENT | CMOD_ERRSILENT))
{
if ((isn = generate_instr(cctx, ISN_SILENT)) == NULL)
return FAIL;
! isn->isn_arg.number = (cmdmod.cmod_flags & CMOD_ERRSILENT) != 0;
! cctx->ctx_silent = (cmdmod.cmod_flags & CMOD_ERRSILENT) ? 2 : 1;
}
return OK;
}
--- 1826,1842 ----
* Generate any instructions for side effects of "cmdmod".
*/
static int
! generate_cmdmods(cctx_T *cctx, cmdmod_T *cmod)
{
isn_T *isn;

// TODO: use more modifiers in the command
! if (cmod->cmod_flags & (CMOD_SILENT | CMOD_ERRSILENT))
{
if ((isn = generate_instr(cctx, ISN_SILENT)) == NULL)
return FAIL;
! isn->isn_arg.number = (cmod->cmod_flags & CMOD_ERRSILENT) != 0;
! cctx->ctx_silent = (cmod->cmod_flags & CMOD_ERRSILENT) ? 2 : 1;
}
return OK;
}
***************
*** 7092,7101 ****
for (;;)
{
exarg_T ea;
! cmdmod_T save_cmdmod;
int starts_with_colon = FALSE;
char_u *cmd;
- int save_msg_scroll = msg_scroll;

// Bail out on the first error to avoid a flood of errors and report
// the right line number when inside try/catch.
--- 7092,7100 ----
for (;;)
{
exarg_T ea;
! cmdmod_T local_cmdmod;
int starts_with_colon = FALSE;
char_u *cmd;

// Bail out on the first error to avoid a flood of errors and report
// the right line number when inside try/catch.
***************
*** 7176,7183 ****
/*
* COMMAND MODIFIERS
*/
! save_cmdmod = cmdmod;
! if (parse_command_modifiers(&ea, &errormsg, FALSE) == FAIL)
{
if (errormsg != NULL)
goto erret;
--- 7175,7183 ----
/*
* COMMAND MODIFIERS
*/
! CLEAR_FIELD(local_cmdmod);
! if (parse_command_modifiers(&ea, &errormsg, &local_cmdmod, FALSE)
! == FAIL)
{
if (errormsg != NULL)
goto erret;
***************
*** 7185,7194 ****
line = (char_u *)"";
continue;
}
! generate_cmdmods(&cctx);
!
! undo_cmdmod(save_msg_scroll);
! cmdmod = save_cmdmod;

// Skip ":call" to get to the function name.
p = ea.cmd;
--- 7185,7192 ----
line = (char_u *)"";
continue;
}
! generate_cmdmods(&cctx, &local_cmdmod);
! undo_cmdmod(&local_cmdmod);

// Skip ":call" to get to the function name.
p = ea.cmd;
*** ../vim-8.2.1897/src/window.c 2020-10-01 22:37:36.403376674 +0200
--- src/window.c 2020-10-24 19:44:59.551956422 +0200
***************
*** 615,621 ****
#ifdef FEAT_SEARCHPATH
case 'f': // CTRL-W gf: "gf" in a new tab page
case 'F': // CTRL-W gF: "gF" in a new tab page
! cmdmod.tab = tabpage_index(curtab) + 1;
nchar = xchar;
goto wingotofile;
#endif
--- 615,621 ----
#ifdef FEAT_SEARCHPATH
case 'f': // CTRL-W gf: "gf" in a new tab page
case 'F': // CTRL-W gF: "gF" in a new tab page
! cmdmod.cmod_tab = tabpage_index(curtab) + 1;
nchar = xchar;
goto wingotofile;
#endif
***************
*** 798,804 ****
return OK;

// Add flags from ":vertical", ":topleft" and ":botright".
! flags |= cmdmod.split;
if ((flags & WSP_TOP) && (flags & WSP_BOT))
{
emsg(_("E442: Can't split topleft and botright at the same time"));
--- 798,804 ----
return OK;

// Add flags from ":vertical", ":topleft" and ":botright".
! flags |= cmdmod.cmod_split;
if ((flags & WSP_TOP) && (flags & WSP_BOT))
{
emsg(_("E442: Can't split topleft and botright at the same time"));
***************
*** 3568,3574 ****
if (!r)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (message && (p_confirm || cmdmod.confirm) && p_write)
{
dialog_changed(wp->w_buffer, FALSE);
if (!win_valid(wp)) // autocommands messed wp up
--- 3568,3575 ----
if (!r)
{
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
! if (message && (p_confirm
! || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write)
{
dialog_changed(wp->w_buffer, FALSE);
if (!win_valid(wp)) // autocommands messed wp up
***************
*** 3925,3935 ****
static int
may_open_tabpage(void)
{
! int n = (cmdmod.tab == 0) ? postponed_split_tab : cmdmod.tab;

if (n != 0)
{
! cmdmod.tab = 0; // reset it to avoid doing it twice
postponed_split_tab = 0;
return win_new_tabpage(n);
}
--- 3926,3937 ----
static int
may_open_tabpage(void)
{
! int n = (cmdmod.cmod_tab == 0)
! ? postponed_split_tab : cmdmod.cmod_tab;

if (n != 0)
{
! cmdmod.cmod_tab = 0; // reset it to avoid doing it twice
postponed_split_tab = 0;
return win_new_tabpage(n);
}
*** ../vim-8.2.1897/src/proto/ex_docmd.pro 2020-10-24 17:19:12.135743402 +0200
--- src/proto/ex_docmd.pro 2020-10-24 18:41:12.222471404 +0200
***************
*** 6,14 ****
void *getline_cookie(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char_u *getline_peek(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char *ex_errmsg(char *msg, char_u *arg);
! int parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only);
void apply_cmdmod(cmdmod_T *cmod);
! void undo_cmdmod(int save_msg_scroll);
int parse_cmd_address(exarg_T *eap, char **errormsg, int silent);
int checkforcmd(char_u **pp, char *cmd, int len);
char_u *skip_option_env_lead(char_u *start);
--- 6,14 ----
void *getline_cookie(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char_u *getline_peek(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
char *ex_errmsg(char *msg, char_u *arg);
! int parse_command_modifiers(exarg_T *eap, char **errormsg, cmdmod_T *cmod, int skip_only);
void apply_cmdmod(cmdmod_T *cmod);
! void undo_cmdmod(cmdmod_T *cmod);
int parse_cmd_address(exarg_T *eap, char **errormsg, int silent);
int checkforcmd(char_u **pp, char *cmd, int len);
char_u *skip_option_env_lead(char_u *start);
*** ../vim-8.2.1897/src/version.c 2020-10-24 17:19:12.135743402 +0200
--- src/version.c 2020-10-24 20:39:31.500559570 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1898,
/**/

--
Would you care for a drink? I mean, if it were, like,
disabled and you had to look after it?

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages