aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-07 07:51:50 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-07 08:10:00 +0800
commit4bb01262ca8644ff62bb37b40d5f0ccebadcc1fb (patch)
tree469d17bb073522786dc3dac3cffccad45038aaca
parent4cded8cec13cb91ce97d6c505879123b8b892bb3 (diff)
downloadrneovim-4bb01262ca8644ff62bb37b40d5f0ccebadcc1fb.tar.gz
rneovim-4bb01262ca8644ff62bb37b40d5f0ccebadcc1fb.tar.bz2
rneovim-4bb01262ca8644ff62bb37b40d5f0ccebadcc1fb.zip
vim-patch:8.2.3674: when ml_get_buf() fails it messes up IObuff
Problem: When ml_get_buf() fails it messes up IObuff. Solution: Return a local pointer. (closes vim/vim#9214) https://github.com/vim/vim/commit/96e7a5928e1e7a350cd6c6d0b9376305190046e7
-rw-r--r--src/nvim/memline.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 1c54035a9e..74608e75ad 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1834,6 +1834,7 @@ char_u *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change)
DATA_BL *dp;
char_u *ptr;
static int recursive = 0;
+ static char_u questions[4];
if (lnum > buf->b_ml.ml_line_count) { // invalid line number
if (recursive == 0) {
@@ -1844,8 +1845,8 @@ char_u *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change)
recursive--;
}
errorret:
- STRCPY(IObuff, "???");
- return IObuff;
+ STRCPY(questions, "???");
+ return questions;
}
if (lnum <= 0) { // pretend line 0 is line 1
lnum = 1;