GNOME Bugzilla – Bug 696430
query-editor: Don't set the entry's text if not strictly needed
Last modified: 2013-03-25 17:33:26 UTC
Noticed this while working on bug 696260. If one quickly types some letters followed by space the entry text cursor moves to the start after the search triggers. This patch fixes it.
Created attachment 239596 [details] [review] query-editor: Don't set the entry's text if not strictly needed If the current text in the entry is equal to the new query's text we shouldn't needlessly set the text on the entry since that affects the cursor position. gtk_entry_set_text() already does a similar check internally but that isn't enough here because NautilusQuery doesn't keep the full string but instead a stripped version of it.
Review of attachment 239596 [details] [review]: Looks good with this style comment fixed, thanks! ::: src/nautilus-query-editor.c @@ +1224,3 @@ + + current_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (editor->details->entry)))); + if (!g_str_equal (current_text, text)) Missing braces around block.
Attachment 239596 [details] pushed as 54270d1 - query-editor: Don't set the entry's text if not strictly needed