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 785959 - Full Text Search: update how the snippet is showed
Full Text Search: update how the snippet is showed
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File Search Interface
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-08-07 18:48 UTC by Alexandru Pandelea
Modified: 2017-08-08 10:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
list-view: display snippet next to filename (1.07 KB, patch)
2017-08-07 18:50 UTC, Alexandru Pandelea
none Details | Review
list-view: fix snippet newline removal (1.66 KB, patch)
2017-08-07 18:51 UTC, Alexandru Pandelea
none Details | Review
list-view: fix snippet newline removal (1.65 KB, patch)
2017-08-07 19:22 UTC, Alexandru Pandelea
none Details | Review
list-view: display snippet next to filename (1.15 KB, patch)
2017-08-07 19:50 UTC, Alexandru Pandelea
committed Details | Review
list-view: fix snippet newline removal (2.59 KB, patch)
2017-08-08 10:12 UTC, Alexandru Pandelea
committed Details | Review

Description Alexandru Pandelea 2017-08-07 18:48:54 UTC
See patch.
Comment 1 Alexandru Pandelea 2017-08-07 18:50:51 UTC
Created attachment 357136 [details] [review]
list-view: display snippet next to filename

Instead of showing the snippet under the filename, show it next to
the filename.
Comment 2 Alexandru Pandelea 2017-08-07 18:51:19 UTC
Created attachment 357137 [details] [review]
list-view: fix snippet newline removal

Removing only \n from the snippet is not enough, as there are also
other newline characters.

Use a GRegex to match those new line chars and remove them.
Comment 3 Alexandru Pandelea 2017-08-07 19:22:32 UTC
Created attachment 357139 [details] [review]
list-view: fix snippet newline removal

Removing only \n from the snippet is not enough, as there are also
other newline characters.

Use a GRegex to match those new line chars and remove them.
Comment 4 Alexandru Pandelea 2017-08-07 19:50:16 UTC
Created attachment 357141 [details] [review]
list-view: display snippet next to filename

Instead of showing the snippet under the filename, show it next to
the filename.
Comment 5 Carlos Garnacho 2017-08-08 09:39:25 UTC
Review of attachment 357139 [details] [review]:

The approach seems correct, but I think there's a couple minor things to fix :).

::: src/nautilus-list-view.c
@@ +1615,3 @@
         if (snippet)
         {
+            GRegex *regex = g_regex_new ("\\R", 0, G_REGEX_MATCH_NEWLINE_ANY, NULL);

I would prefer that the regex were compiled once for the whole view (eg. keep as private data), so just g_regex_replace() happens here.

Compiling a regex is IMO expensive enough that we want to take it out of such an often called function.

@@ +1621,3 @@
+                                             -1,
+                                             0,
+                                             "",

It would probably be better to replace newlines with an space character so "this\ntext" doesn't look like "thistext"
Comment 6 Carlos Garnacho 2017-08-08 09:40:11 UTC
Comment on attachment 357141 [details] [review]
list-view: display snippet next to filename

Looks good!
Comment 7 Alexandru Pandelea 2017-08-08 10:12:06 UTC
Created attachment 357178 [details] [review]
list-view: fix snippet newline removal

Removing only \n from the snippet is not enough, as there are also
other newline characters.

Use a GRegex to match those new line chars and remove them.
Comment 8 Carlos Garnacho 2017-08-08 10:17:00 UTC
Comment on attachment 357178 [details] [review]
list-view: fix snippet newline removal

Looks good!
Comment 9 Alexandru Pandelea 2017-08-08 10:35:56 UTC
Attachment 357141 [details] pushed as c0b9039 - list-view: display snippet next to filename
Attachment 357178 [details] pushed as 85c28ff - list-view: fix snippet newline removal