After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 696430 - query-editor: Don't set the entry's text if not strictly needed
query-editor: Don't set the entry's text if not strictly needed
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-23 00:37 UTC by Rui Matos
Modified: 2013-03-25 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
query-editor: Don't set the entry's text if not strictly needed (1.60 KB, patch)
2013-03-23 00:37 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2013-03-23 00:37:56 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.
Comment 1 Rui Matos 2013-03-23 00:37:58 UTC
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.
Comment 2 Cosimo Cecchi 2013-03-23 21:38:26 UTC
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.
Comment 3 Cosimo Cecchi 2013-03-25 17:33:23 UTC
Attachment 239596 [details] pushed as 54270d1 - query-editor: Don't set the entry's text if not strictly needed