diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-19 14:12:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-19 14:12:45 +0800 |
commit | c011747b5fc33eb7d9955c21d85085131ffaac0d (patch) | |
tree | 11edeb9c7e41db8e0e0123c379d24cda1d50f9d1 /src/nvim/ex_getln.c | |
parent | 92e51d7e4b79913434c7b74a275babcf65098b97 (diff) | |
download | rneovim-c011747b5fc33eb7d9955c21d85085131ffaac0d.tar.gz rneovim-c011747b5fc33eb7d9955c21d85085131ffaac0d.tar.bz2 rneovim-c011747b5fc33eb7d9955c21d85085131ffaac0d.zip |
vim-patch:8.2.5148: invalid memory access when using expression on command line (#21113)
Problem: Invalid memory access when using an expression on the command line.
Solution: Make sure the position does not go negative.
https://github.com/vim/vim/commit/6046aded8da002b08d380db29de2ba0268b6616e
N/A patches for version.c:
vim-patch:8.2.5149: cannot build without the +eval feature
Problem: Cannot build without the +eval feature. (Tony Mechelynck)
Solution: Add #ifdefs.
https://github.com/vim/vim/commit/6689df024bce4309ec5884e445738fe07ee4ffcc
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 0520c0e4a0..89d295e1a8 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1613,6 +1613,8 @@ static int command_line_handle_key(CommandLineState *s) return 0; // back to cmd mode case Ctrl_R: { // insert register + const int save_new_cmdpos = new_cmdpos; + putcmdline('"', true); no_mapping++; allow_keys++; @@ -1627,8 +1629,6 @@ static int command_line_handle_key(CommandLineState *s) no_mapping--; allow_keys--; // Insert the result of an expression. - // Need to save the current command line, to be able to enter - // a new one... new_cmdpos = -1; if (s->c == '=') { if (ccline.cmdfirstc == '=' // can't do this recursively @@ -1660,8 +1660,12 @@ static int command_line_handle_key(CommandLineState *s) } } } + new_cmdpos = save_new_cmdpos; + + // remove the double quote ccline.special_char = NUL; redrawcmd(); + return command_line_changed(s); } |