diff options
author | solawing <316786359@qq.com> | 2016-01-05 11:23:41 +0800 |
---|---|---|
committer | solawing <316786359@qq.com> | 2016-01-29 22:03:23 +0800 |
commit | edb5fb88aae686dd6949cd074595318e9f998676 (patch) | |
tree | c1a139596b5228bffded9201cc68ad65c8a66d9f /src/nvim/edit.c | |
parent | b55726b35075148ae29c5ae635e85a11e09e9dfa (diff) | |
download | rneovim-edb5fb88aae686dd6949cd074595318e9f998676.tar.gz rneovim-edb5fb88aae686dd6949cd074595318e9f998676.tar.bz2 rneovim-edb5fb88aae686dd6949cd074595318e9f998676.zip |
edit.c: fix incorrect redo buffer
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index f0b79110ea..434a26b58d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2464,6 +2464,14 @@ void ins_compl_show_pum(void) /* Need to build the popup menu list. */ compl_match_arraysize = 0; compl = compl_first_match; + /* + * If it's user complete function and refresh_always, + * not use "compl_leader" as prefix filter. + */ + if (ins_compl_need_restart()){ + xfree(compl_leader); + compl_leader = NULL; + } if (compl_leader != NULL) lead_len = (int)STRLEN(compl_leader); do { @@ -2929,15 +2937,8 @@ static void ins_compl_new_leader(void) spell_bad_len = 0; /* need to redetect bad word */ /* * Matches were cleared, need to search for them now. - * If it's user complete function and refresh_always, - * not use "compl_leader" as prefix filter. * Set "compl_restarting" to avoid that the first match is inserted. */ - if ((ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) - && compl_opt_refresh_always){ - xfree(compl_leader); - compl_leader = NULL; - } compl_restarting = TRUE; if (ins_complete(Ctrl_N) == FAIL) compl_cont_status = 0; @@ -2949,8 +2950,9 @@ static void ins_compl_new_leader(void) /* Show the popup menu with a different set of matches. */ ins_compl_show_pum(); - /* Don't let Enter select the original text when there is no popup menu. */ - if (compl_match_array == NULL) + /* Don't let Enter select the original text when there is no popup menu. + * Don't let Enter select when use user function and refresh_always is set */ + if (compl_match_array == NULL || ins_compl_need_restart()) compl_enter_selects = FALSE; } @@ -2981,14 +2983,8 @@ static void ins_compl_addleader(int c) (*mb_char2bytes)(c, buf); buf[cc] = NUL; ins_char_bytes(buf, cc); - if ((ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) - && compl_opt_refresh_always) - AppendToRedobuff(buf); } else { ins_char(c); - if ((ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI) - && compl_opt_refresh_always) - AppendCharToRedobuff(c); } /* If we didn't complete finding matches we must search again. */ @@ -3009,7 +3005,7 @@ static void ins_compl_restart(void) { /* update screen before restart. * so if complete is blocked, - * will stay to the last popup menu and reduce flick */ + * will stay to the last popup menu and reduce flicker */ update_screen(0); ins_compl_free(); compl_started = FALSE; |