From 3bcbf802cea28e5f3632b7a226e46d6b8efa3668 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 7 Jun 2018 20:36:22 -0400 Subject: vim-patch:8.0.0533: abbreviation doesn't work after backspacing newline Problem: Abbreviation doesn't work after backspacing newline. (Hkonrk) Solution: Set the insert start column. (closes vim/vim#1609) https://github.com/vim/vim/commit/878c263a489b7e211eda31fa13a3d5ad9e120554 --- src/nvim/edit.c | 6 ++---- src/nvim/testdir/test_mapping.vim | 13 ++++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 462762aea0..90b88ce82d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -7545,9 +7545,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) curwin->w_cursor.coladd = 0; } - /* - * delete newline! - */ + // Delete newline! if (curwin->w_cursor.col == 0) { lnum = Insstart.lnum; if (curwin->w_cursor.lnum == lnum || revins_on) { @@ -7556,7 +7554,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p) return false; } Insstart.lnum--; - Insstart.col = MAXCOL; + Insstart.col = STRLEN(ml_get(Insstart.lnum)); } /* * In replace mode: diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 0a198763bb..f4fe1c2705 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -104,7 +104,7 @@ func Test_map_langmap() imap a c call feedkeys("Go\a\", "xt") call assert_equal('bbbb', getline('$')) - + " langmap should not apply in Command-line mode set langmap=+{ nolangremap call feedkeys(":call append(line('$'), '+')\", "xt") @@ -161,6 +161,17 @@ func Test_map_meta_quotes() iunmap endfunc +func Test_abbr_after_line_join() + new + abbr foo bar + set backspace=indent,eol,start + exe "normal o\foo " + call assert_equal("bar ", getline(1)) + bwipe! + unabbr foo + set backspace& +endfunc + func Test_map_timeout() nnoremap aaaa :let got_aaaa = 1 nnoremap bb :let got_bb = 1 -- cgit