aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-27 05:12:59 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-07 07:00:11 +0800
commitdf4c634d067cf01adca75abb5f38989777c5cddd (patch)
tree62f3beb3811b71d7712662a69ed82cbebfecab23 /src/nvim/undo.c
parent4ffe5d018919d3fbea21e667f09f14b9751f9cd5 (diff)
downloadrneovim-df4c634d067cf01adca75abb5f38989777c5cddd.tar.gz
rneovim-df4c634d067cf01adca75abb5f38989777c5cddd.tar.bz2
rneovim-df4c634d067cf01adca75abb5f38989777c5cddd.zip
vim-patch:8.2.5023: substitute overwrites allocated buffer
Problem: Substitute overwrites allocated buffer. Solution: Disallow undo when in a substitute command. https://github.com/vim/vim/commit/338f1fc0ee3ca929387448fe464579d6113fa76a
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 1c0b7aa669..8324db37c6 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -89,6 +89,7 @@
#include "nvim/change.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"
+#include "nvim/ex_getln.h"
#include "nvim/extmark.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
@@ -1954,6 +1955,11 @@ void undo_time(long step, bool sec, bool file, bool absolute)
bool above = false;
bool did_undo = true;
+ if (text_locked()) {
+ text_locked_msg();
+ return;
+ }
+
// First make sure the current undoable change is synced.
if (curbuf->b_u_synced == false) {
u_sync(true);