Hi Olivier!
On Mo, 25 Feb 2013, Olivier Teulière wrote:
> Hi Christian,
>
> On Saturday, February 16, 2013 10:03:05 PM UTC+1, Christian Brabandt wrote:
> > Check this patch:
> > [...]
>
> Your patch solves the problem, but maybe not in the best way. Now, after
> typing 'f' to shrink the list, the selection is lost in the popup. This means
> that I cannot simply type Enter to insert the selected entry and close the
> popup at the same time, which was very practical.
>
> I think it would make more sense to keep the selection, and to return to one
> of the following states after <bs>:
> - foofoobar1 is selected (both visually and "internally"), because it was
> selected before typing <bs>
> - foobar is selected (both visually and "internally"), because it was
> selected before typing the letter erased by <bs>
> Whichever is easier to implement :) Currently, it seems to be in the first
> state visually, and in the second one internally.
The problem is, hitting backspace changes the leader and on the next
invocation of ins_complete() compl_curr_match() will be set wrongly
because ins_compl_next is called.
This patch should work better:
diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -93,6 +93,7 @@
static compl_T *compl_first_match = NULL;
static compl_T *compl_curr_match = NULL;
static compl_T *compl_shown_match = NULL;
+static int did_bs = FALSE;
/* After using a cursor key <Enter> selects a match in the popup menu,
* otherwise it inserts a line break. */
@@ -3380,6 +3381,7 @@
if (compl_leader != NULL)
{
ins_compl_new_leader();
+ did_bs = TRUE;
return NUL;
}
return K_BS;
@@ -5363,7 +5365,10 @@
* Find next match (and following matches).
*/
save_w_wrow = curwin->w_wrow;
- n = ins_compl_next(TRUE, ins_compl_key2count(c), ins_compl_use_match(c));
+ /* don't add completions, after hitting backspace and the leader changed */
+ if (!did_bs)
+ n = ins_compl_next(TRUE, ins_compl_key2count(c),
ins_compl_use_match(c));
+ did_bs = FALSE;
/* may undisplay the popup menu */
ins_compl_upd_pum();
Mit freundlichen Grüßen
Christian
--
Was man erfindet, tut man mit Liebe, was man gelernt hat, mit
Sicherheit.
-- Goethe, Maximen und Reflektionen, Nr. 1068
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.