[gtk+] entry-completion: don't move to leftmost character with inline-selection



commit 3851a1cf904a088e859e617108e839e3c6271730
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Jun 12 00:13:55 2012 -0400

    entry-completion: don't move to leftmost character with inline-selection
    
    When inline-selection is set, and the completion popup is showing,
    pressing left abruptly jumps to the beginning of the entry text.
    This is not expected, since the cursor is at the end of the text before
    the left key is pressed, and this behavior is completely inconsistent
    with how an entry would normally behave.
    The behavior can be observed in Epiphany by selecting a completion match
    and pressing left.
    
    This patch changes the code so that it just runs the default entry key
    press keybindings in such a case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677915

 gtk/gtkentry.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 59a34f4..cfb6ba5 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -9571,14 +9571,15 @@ gtk_entry_completion_key_press (GtkWidget   *widget,
                 gtk_entry_set_text (GTK_ENTRY (completion->priv->entry), "");
             }
 
-          /* Move the cursor to the end for Right/Esc, to the
-             beginning for Left */
+          /* Move the cursor to the end for Right/Esc */
           if (event->keyval == GDK_KEY_Right ||
               event->keyval == GDK_KEY_KP_Right ||
               event->keyval == GDK_KEY_Escape)
             gtk_editable_set_position (GTK_EDITABLE (widget), -1);
+          /* Let the default keybindings run for Left, i.e. either move to the
+           * previous character or select word if a modifier is used */
           else
-            gtk_editable_set_position (GTK_EDITABLE (widget), 0);
+            retval = FALSE;
         }
 
 keypress_completion_out:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]