aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-17 20:15:42 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-01-17 20:26:12 +0800
commitc416da9d1a41b919412d88aecf827aebb8ea973b (patch)
tree8d9c872732f56feb3175819b1f532250f7e0717c /src/nvim/ex_docmd.c
parent8aece0089dab9d1d22462de8a36bba2ee3fa1188 (diff)
downloadrneovim-c416da9d1a41b919412d88aecf827aebb8ea973b.tar.gz
rneovim-c416da9d1a41b919412d88aecf827aebb8ea973b.tar.bz2
rneovim-c416da9d1a41b919412d88aecf827aebb8ea973b.zip
vim-patch:8.2.5126: substitute may overrun destination buffer
Problem: Substitute may overrun destination buffer. Solution: Disallow switching buffers in a substitute expression. https://github.com/vim/vim/commit/d6211a52ab9f53b82f884561ed43d2fe4d24ff7d Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index a1dd88a709..511251f0b5 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5249,9 +5249,9 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
old_curwin == NULL ? curwin : NULL);
} else if ((eap->cmdidx != CMD_split && eap->cmdidx != CMD_vsplit)
|| *eap->arg != NUL) {
- // Can't edit another file when "curbuf->b_ro_locked" is set. Only ":edit"
- // can bring us here, others are stopped earlier.
- if (*eap->arg != NUL && curbuf_locked()) {
+ // Can't edit another file when "textlock" or "curbuf->b_ro_locked" is set.
+ // Only ":edit" or ":script" can bring us here, others are stopped earlier.
+ if (*eap->arg != NUL && text_or_buf_locked()) {
return;
}
n = readonlymode;