If tab is hit and the cursor is still in the entry, move down into the
2002-02-28 Jon Trowbridge <trow@ximian.com> * gal/e-text/e-completion-view.c (e_completion_view_key_press_handler): If tab is hit and the cursor is still in the entry, move down into the entry otherwise unbrowse. svn path=/trunk/; revision=15878
This commit is contained in:

committed by
Jeffrey Stedfast

parent
8ad83fdce7
commit
2b466c4caf
@ -448,7 +448,7 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
|
|||||||
{
|
{
|
||||||
ECompletionView *cv = E_COMPLETION_VIEW (user_data);
|
ECompletionView *cv = E_COMPLETION_VIEW (user_data);
|
||||||
gint dir = 0;
|
gint dir = 0;
|
||||||
gboolean key_handled = TRUE, complete_key = FALSE, uncomplete_key = FALSE;
|
gboolean key_handled = TRUE, complete_key = FALSE, uncomplete_key = FALSE, is_space = FALSE;
|
||||||
|
|
||||||
/* FIXME: This is totally lame.
|
/* FIXME: This is totally lame.
|
||||||
The ECompletionView should be able to specify multiple completion/uncompletion keys, or just
|
The ECompletionView should be able to specify multiple completion/uncompletion keys, or just
|
||||||
@ -503,23 +503,48 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_Tab:
|
case GDK_Tab:
|
||||||
/* Unbrowse, unhandled. */
|
/* If our cursor is still up in the entry, move down into
|
||||||
cv->selection = -1;
|
the popup. Otherwise unbrowse. */
|
||||||
dir = 0;
|
if (cv->choices->len > 0) {
|
||||||
key_handled = FALSE;
|
if (cv->selection < 0) {
|
||||||
|
cv->selection = 0;
|
||||||
|
dir = 0;
|
||||||
|
} else {
|
||||||
|
cv->selection = -1;
|
||||||
|
dir = 0;
|
||||||
|
key_handled = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GDK_space:
|
||||||
|
case GDK_KP_Space:
|
||||||
|
is_space = TRUE;
|
||||||
|
|
||||||
case GDK_Return:
|
case GDK_Return:
|
||||||
case GDK_KP_Enter:
|
case GDK_KP_Enter:
|
||||||
case GDK_space:
|
if (cv->selection < 0) {
|
||||||
case GDK_KP_Space:
|
/* We don't have a selection yet, move to the first selection if there is
|
||||||
/* Only handle these key presses if we have an active selection;
|
more than one option. If there is only one option, select it automatically. */
|
||||||
otherwise, pass them on. */
|
|
||||||
if (cv->selection >= 0) {
|
/* Let space pass through. */
|
||||||
|
if (is_space)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (cv->choices->len == 1) {
|
||||||
|
e_completion_view_select (cv, 0);
|
||||||
|
goto stop_emission;
|
||||||
|
} else {
|
||||||
|
cv->selection = 0;
|
||||||
|
dir = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Our cursor is down in the pop-up, so we make our selection. */
|
||||||
e_completion_view_select (cv, cv->selection);
|
e_completion_view_select (cv, cv->selection);
|
||||||
goto stop_emission;
|
goto stop_emission;
|
||||||
}
|
}
|
||||||
return FALSE;
|
break;
|
||||||
|
|
||||||
case GDK_Escape:
|
case GDK_Escape:
|
||||||
/* Unbrowse hack */
|
/* Unbrowse hack */
|
||||||
|
Reference in New Issue
Block a user