aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-02-02 19:02:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-02-02 19:02:58 +0000
commitb255fa570d8b041e4c81e3454d51e06100c2fa4f (patch)
treed3b246b467500ca48067ed4a45d2fa53966cd9f1 /src/nvim/getchar.c
parenteeccad2ff1ae8892fe9e06d733a7b07a166eecb0 (diff)
parent0bd07bea095a8000cffa4f379c1fa53e009c1143 (diff)
downloadrneovim-20230125_mix.tar.gz
rneovim-20230125_mix.tar.bz2
rneovim-20230125_mix.zip
Merge branch 'aucmd_textputpost' into 20230125_mix20230125_mix
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 9c5364e1b1..8ed9381bca 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -252,7 +252,7 @@ static void add_buff(buffheader_T *const buf, const char *const s, ptrdiff_t sle
} else {
len = (size_t)slen;
}
- buffblock_T *p = xmalloc(sizeof(buffblock_T) + len);
+ buffblock_T *p = xmalloc(offsetof(buffblock_T, b_str) + len + 1);
buf->bh_space = len - (size_t)slen;
xstrlcpy(p->b_str, s, (size_t)slen + 1);
@@ -2526,10 +2526,12 @@ static int vgetorpeek(bool advance)
// move cursor left, if possible
if (curwin->w_cursor.col != 0) {
if (curwin->w_wcol > 0) {
- if (did_ai) {
- // We are expecting to truncate the trailing
- // white-space, so find the last non-white
- // character -- webb
+ // After auto-indenting and no text is following,
+ // we are expecting to truncate the trailing
+ // white-space, so find the last non-white
+ // character -- webb
+ if (did_ai
+ && *skipwhite(get_cursor_line_ptr() + curwin->w_cursor.col) == NUL) {
curwin->w_wcol = 0;
ptr = (char_u *)get_cursor_line_ptr();
chartabsize_T cts;