mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4233: crash when recording and using Select mode
Problem: Crash when recording and using Select mode.
Solution: When deleting the last recorded character check there is something
to delete.
a4bc2dd7cc
This commit is contained in:
parent
530c65b17a
commit
e691ef338c
@ -288,8 +288,12 @@ static void add_buff(buffheader_T *const buf, const char *const s, ptrdiff_t sle
|
||||
/// Only works when it was just added.
|
||||
static void delete_buff_tail(buffheader_T *buf, int slen)
|
||||
{
|
||||
int len = (int)STRLEN(buf->bh_curr->b_str);
|
||||
int len;
|
||||
|
||||
if (buf->bh_curr == NULL || buf->bh_curr->b_str == NULL) {
|
||||
return; // nothing to delete
|
||||
}
|
||||
len = (int)STRLEN(buf->bh_curr->b_str);
|
||||
if (len >= slen) {
|
||||
buf->bh_curr->b_str[len - slen] = NUL;
|
||||
buf->bh_space += (size_t)slen;
|
||||
|
@ -511,4 +511,14 @@ func Test_insert_small_delete()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_record_in_select_mode()
|
||||
new
|
||||
call setline(1, 'text')
|
||||
sil norm q00
|
||||
sil norm q
|
||||
call assert_equal('0ext', getline(1))
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
Loading…
Reference in New Issue
Block a user