vim-patch:8.2.1910: reading past the end of the command line

Problem:    Reading past the end of the command line.
Solution:   Check for NUL. (closes vim/vim#7204)
caf73dcfad

Cherry-pick undo_cmdmod() from patch 8.2.1137.

N/A patches for version.c:

vim-patch:8.1.2050: popup window test fails in some configurations

Problem:    Popup window test fails in some configurations. (James McCoy)
Solution:   Clear the command line.
7e0f462db5

vim-patch:8.2.0913: code for resetting v:register is duplicated

Problem:    Code for resetting v:register is duplicated.
Solution:   Add reset_reg_var().
439c036ed0

reset_reg_var() is not ported.
Use set_reg_var(get_default_register_name()) instead.

vim-patch:8.2.1913: GTK GUI: rounding for the cell height is too strict

Problem:    GTK GUI: rounding for the cell height is too strict.
Solution:   Round up above 15/16 of a pixel. (closes vim/vim#7203)
70cf45810c

vim-patch:8.2.1922: Win32: scrolling problems when part of window is off-screen

Problem:    Win32: scrolling doesn't work properly when part of window is
            off-screen.
Solution:   Fall back to GDI scrolling if part of the window is off-screen.
            Handle multi-monitor setup better. (Ken Takata, closes vim/vim#7219)
185577e47e
This commit is contained in:
Jan Edmund Lazo 2020-10-27 19:22:28 -04:00
parent c6ccdda26a
commit cb6b5e5540
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 40 additions and 30 deletions

View File

@ -1251,7 +1251,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
char_u *errormsg = NULL; // error message
char_u *after_modifier = NULL;
exarg_T ea;
int save_msg_scroll = msg_scroll;
const int save_msg_scroll = msg_scroll;
cmdmod_T save_cmdmod;
const int save_reg_executing = reg_executing;
char_u *cmd;
@ -2003,34 +2003,10 @@ doend:
? cmdnames[(int)ea.cmdidx].cmd_name
: (char_u *)NULL);
if (ea.verbose_save >= 0) {
p_verbose = ea.verbose_save;
}
free_cmdmod();
undo_cmdmod(&ea, save_msg_scroll);
cmdmod = save_cmdmod;
reg_executing = save_reg_executing;
if (ea.save_msg_silent != -1) {
// messages could be enabled for a serious error, need to check if the
// counters don't become negative
if (!did_emsg || msg_silent > ea.save_msg_silent) {
msg_silent = ea.save_msg_silent;
}
emsg_silent -= ea.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;
}
if (ea.did_sandbox) {
sandbox--;
}
@ -2298,9 +2274,14 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only)
return OK;
}
// Free contents of "cmdmod".
static void free_cmdmod(void)
// Undo and free contents of "cmdmod".
static void undo_cmdmod(const exarg_T *eap, int save_msg_scroll)
FUNC_ATTR_NONNULL_ALL
{
if (eap->verbose_save >= 0) {
p_verbose = eap->verbose_save;
}
if (cmdmod.save_ei != NULL) {
/* Restore 'eventignore' to the value before ":noautocmd". */
set_string_option_direct((char_u *)"ei", -1, cmdmod.save_ei,
@ -2308,8 +2289,27 @@ static void free_cmdmod(void)
free_string_option(cmdmod.save_ei);
}
if (cmdmod.filter_regmatch.regprog != NULL) {
vim_regfree(cmdmod.filter_regmatch.regprog);
vim_regfree(cmdmod.filter_regmatch.regprog);
if (eap->save_msg_silent != -1) {
// messages could be enabled for a serious error, need to check if the
// counters don't become negative
if (!did_emsg || msg_silent > eap->save_msg_silent) {
msg_silent = eap->save_msg_silent;
}
emsg_silent -= eap->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;
}
}
}
@ -4446,6 +4446,9 @@ void separate_nextcmd(exarg_T *eap)
else if (p[0] == '`' && p[1] == '=' && (eap->argt & XFILE)) {
p += 2;
(void)skip_expr(&p);
if (*p == NUL) { // stop at NUL after CTRL-V
break;
}
}
/* Check for '"': start of comment or '|': next command */
/* :@" does not start a comment!

View File

@ -1587,4 +1587,11 @@ func Test_edit_browse()
bwipe!
endfunc
func Test_read_invalid()
" set encoding=latin1
" This was not properly checking for going past the end.
call assert_fails('r`=', 'E484')
set encoding=utf-8
endfunc
" vim: shiftwidth=2 sts=2 expandtab