aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2002-03-01 06:42:05 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-03-01 06:42:05 +0800
commit2b466c4caf404cc171071e11169946058d56b000 (patch)
treee5cd16f16d5d312d7ec4867d41a0b7d9b2f01e6e /widgets
parent8ad83fdce75b7d360d92bbd20175f4279faad19a (diff)
downloadgsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar.gz
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar.bz2
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar.lz
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar.xz
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.tar.zst
gsoc2013-evolution-2b466c4caf404cc171071e11169946058d56b000.zip
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
Diffstat (limited to 'widgets')
-rw-r--r--widgets/text/e-completion-view.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
index a206d5da0b..c2eafb6273 100644
--- a/widgets/text/e-completion-view.c
+++ b/widgets/text/e-completion-view.c
@@ -448,7 +448,7 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
{
ECompletionView *cv = E_COMPLETION_VIEW (user_data);
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.
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;
case GDK_Tab:
- /* Unbrowse, unhandled. */
- cv->selection = -1;
- dir = 0;
- key_handled = FALSE;
+ /* If our cursor is still up in the entry, move down into
+ the popup. Otherwise unbrowse. */
+ if (cv->choices->len > 0) {
+ if (cv->selection < 0) {
+ cv->selection = 0;
+ dir = 0;
+ } else {
+ cv->selection = -1;
+ dir = 0;
+ key_handled = FALSE;
+ }
+ }
break;
- case GDK_Return:
- case GDK_KP_Enter:
case GDK_space:
case GDK_KP_Space:
- /* Only handle these key presses if we have an active selection;
- otherwise, pass them on. */
- if (cv->selection >= 0) {
+ is_space = TRUE;
+
+ case GDK_Return:
+ case GDK_KP_Enter:
+ if (cv->selection < 0) {
+ /* We don't have a selection yet, move to the first selection if there is
+ more than one option. If there is only one option, select it automatically. */
+
+ /* 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);
goto stop_emission;
}
- return FALSE;
+ break;
case GDK_Escape:
/* Unbrowse hack */