diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2018-06-20 02:17:00 -0400 | 
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-20 08:17:00 +0200 | 
| commit | b454d24e044e7fba6888e4b7727c8e0c03a352c4 (patch) | |
| tree | c69ece03e660a8c073142f1ef95a2875faef07f1 /src/nvim/edit.c | |
| parent | 6e55c5997e03a757526048d9e677f45820accc3f (diff) | |
| download | rneovim-b454d24e044e7fba6888e4b7727c8e0c03a352c4.tar.gz rneovim-b454d24e044e7fba6888e4b7727c8e0c03a352c4.tar.bz2 rneovim-b454d24e044e7fba6888e4b7727c8e0c03a352c4.zip | |
vim-patch:8.0.0669: CTRL-N at start of the buffer does not work correctly (#8600)
Problem:    In Insert mode, CTRL-N at start of the buffer does not work
            correctly. (zuloloxi)
Solution:   Wrap around the start of the buffer. (Christian Brabandt)
https://github.com/vim/vim/commit/24a9e348aa88a6c60ae0cdf5c4a777d8c03b08ca
Diffstat (limited to 'src/nvim/edit.c')
| -rw-r--r-- | src/nvim/edit.c | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1f18fc36fd..d4075fc197 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3708,9 +3708,15 @@ static int ins_compl_get_exp(pos_T *ini)        if (*e_cpt == '.' && !curbuf->b_scanned) {          ins_buf = curbuf;          first_match_pos = *ini; -        /* So that ^N can match word immediately after cursor */ -        if (l_ctrl_x_mode == 0) -          dec(&first_match_pos); +        // Move the cursor back one character so that ^N can match the +        // word immediately after the cursor. +        if (ctrl_x_mode == 0 && dec(&first_match_pos) < 0) { +          // Move the cursor to after the last character in the +          // buffer, so that word at start of buffer is found +          // correctly. +          first_match_pos.lnum = ins_buf->b_ml.ml_line_count; +          first_match_pos.col = (colnr_T)STRLEN(ml_get(first_match_pos.lnum)); +        }          last_match_pos = first_match_pos;          type = 0; | 
