! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] Search bar hides matches and lines of text
Status:
RESOLVED: MOVED
Product:
Mousepad
Component:
General

Comments

Description Manuel Grießmayr 2018-10-29 19:13:18 CET
How to reproduce:

Create a plain text file which contains more lines of text than the window is able to show without scrolling. Now call the search (Strg + F in my case, with other keyboads I assume it is Ctrl + F). Type in a word which is only available in the last line. Until now everthing works fine. Close the search whithout deleting the keyword, scroll to the top and and call the search again. Voilà, the match cannot been seen and you aren't able to scroll to it. Furthermore the match will not be highlighted which is another little bug I think. How do I know this when the match is not visible at all? Try the same but search for a string which is available in the first line. Close the search without deleting the keyword, scroll to the bottom and call the search again. The match is now visible but not highlighted. I think the match should be highlighted because the view jumps to it.

I am using Xubuntu 18.10 64 bit. Let me know when I should create another bug for the missing highlighting.
Comment 1 Theo Linkspfeifer editbugs 2019-11-09 21:20:48 CET
Created attachment 9200 
patch

This seems to be a timing issue which can be fixed by not letting Mousepad scroll to the search result occurrence immediately, but when idle.
Comment 2 Manuel Grießmayr 2019-11-13 12:44:02 CET
Many thanks. The patch works fine for me. The match is now visible but not highlighted (see description above). Should I create another bug for this issue?
Comment 3 Theo Linkspfeifer editbugs 2019-11-13 14:04:06 CET
Created attachment 9223 
diff

Sorry that I ignored the second part.

When one opens the search bar, it selects/marks the text in the input field. This removes any highlight in the document. The attached diff disables this behavior.
Comment 4 Manuel Grießmayr 2019-11-13 14:14:17 CET
Wonderful. Also second patch works like a charm.
Comment 5 inactive 2020-04-17 21:42:26 CEST
Maybe it's just me but, without the second patch (in Comment 3) my PRIMARY selection (aka that shift+insert or MMB clipboard) is overwritten with the text selected from the search bar, because gtk3 (apparently) is overwriting it when selection happens. Also, given the name of this clipboard(PRIMARY selection), it makes sense that would happen. But compared to how notepad/word in Windows does it, you'd expect the text you selected inside the editor to not be lost when find bar opens.

With that in mind, I had to patch both gtk3 and mousepad. gtk3 so that xfce4-terminal(and likely others) which just use focus like terminal/terminal-search-dialog.c:367:  gtk_widget_grab_focus (dialog->entry);
which gtk3 makes it so that all text is selected (unless 'gtk-entry-select-on-focus' isn't set, and it is by default), and gtk3 will copy to PRIMARY selection any text selection (even if automatic, ie. non-human generated)


gtk3 patch is like this:

diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index db93ee1baa..4829e03192 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -5055,22 +5055,22 @@ static void
 gtk_entry_grab_focus (GtkWidget *widget)
 {
   GtkEntry *entry = GTK_ENTRY (widget);
-  GtkEntryPrivate *priv = entry->priv;
-  gboolean select_on_focus;
-
-  if (priv->editable && !priv->in_click)
-    {
-      g_object_get (gtk_widget_get_settings (widget),
-                    "gtk-entry-select-on-focus",
-                    &select_on_focus,
-                    NULL);
-
-      _gtk_entry_grab_focus (entry, select_on_focus);
-    }
-  else
-    {
+//  GtkEntryPrivate *priv = entry->priv;
+//  gboolean select_on_focus;
+//
+//  if (priv->editable && !priv->in_click)
+//    {
+//      g_object_get (gtk_widget_get_settings (widget),
+//                    "gtk-entry-select-on-focus",
+//                    &select_on_focus,
+//                    NULL);
+//
+//      _gtk_entry_grab_focus (entry, select_on_focus);
+//    }
+//  else
+//    {
       _gtk_entry_grab_focus (entry, FALSE);
-    }
+//    }
 }
 
 /**
Comment 6 Git Bot editbugs 2020-05-24 01:30:57 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/mousepad/-/issues/26.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #14814

Reported by:
Manuel Grießmayr
Reported on: 2018-10-29
Last modified on: 2020-05-24

People

Assignee:
Matthew Brush
CC List:
4 users

Version

Target Milestone:
Mousepad 0.4.x

Attachments

patch (1.59 KB, patch)
2019-11-09 21:20 CET , Theo Linkspfeifer
no flags
diff (477 bytes, patch)
2019-11-13 14:04 CET , Theo Linkspfeifer
no flags

Additional information