diff src/vim9compile.c @ 23586:8c5374ec8a3d v8.2.2335

patch 8.2.2335: Vim9: "silent return" does not restore command modifiers Commit: https://github.com/vim/vim/commit/7cd24227c02afdb4249db406e2174eda1e6b36b4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 12 18:58:39 2021 +0100 patch 8.2.2335: Vim9: "silent return" does not restore command modifiers Problem: Vim9: "silent return" does not restore command modifiers. Solution: Resture command modifiers before returning. (closes https://github.com/vim/vim/issues/7649)
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Jan 2021 19:00:07 +0100
parents 85ce241ff9e3
children 455ad460ff4f
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2055,6 +2055,7 @@ generate_undo_cmdmods(cctx_T *cctx)
 {
     if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL)
 	return FAIL;
+    cctx->ctx_has_cmdmod = FALSE;
     return OK;
 }
 
@@ -4933,6 +4934,10 @@ compile_return(char_u *arg, int check_re
 	// No argument, return zero.
 	generate_PUSHNR(cctx, 0);
     }
+
+    // Undo any command modifiers.
+    generate_undo_cmdmods(cctx);
+
     if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_RETURN) == NULL)
 	return NULL;