Mercurial > vim
changeset 3271:8b928bc814a8 v7.3.404
updated for version 7.3.404
Problem: When a complete function uses refresh "always" redo will not work
properly.
Solution: Do not reset compl_leader when compl_opt_refresh_always is set.
(Yasuhiro Matsumoto)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 20 Jan 2012 14:32:27 +0100 |
parents | df0b1a9396fa |
children | 3ab7f7a36bbf |
files | src/edit.c src/version.c |
diffstat | 2 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/edit.c +++ b/src/edit.c @@ -3465,11 +3465,17 @@ ins_compl_addleader(c) if (ins_compl_need_restart()) ins_compl_restart(); - vim_free(compl_leader); - compl_leader = vim_strnsave(ml_get_curline() + compl_col, + /* When 'always' is set, don't reset compl_leader. While completing, + * cursor don't point original position, changing compl_leader would + * break redo. */ + if (!compl_opt_refresh_always) + { + vim_free(compl_leader); + compl_leader = vim_strnsave(ml_get_curline() + compl_col, (int)(curwin->w_cursor.col - compl_col)); - if (compl_leader != NULL) - ins_compl_new_leader(); + if (compl_leader != NULL) + ins_compl_new_leader(); + } } /* @@ -4554,6 +4560,11 @@ ins_compl_next(allow_get_expansion, coun int found_end = FALSE; int advance; + /* When user complete function return -1 for findstart which is next + * time of 'always', compl_shown_match become NULL. */ + if (compl_shown_match == NULL) + return -1; + if (compl_leader != NULL && (compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0) {