GNOME Bugzilla – Bug 706900
File browser: file content should have focus after opening
Last modified: 2019-03-23 20:50:40 UTC
When I open a document from the File Browser Panel in the sidebar, the sidebar retains focus. This means when I do CTRL+F to search in the document I just opened, it tries to search for a matching file instead. This is a pretty frustrating usability issue, and should be easy to fix. CTRL+I does properly switch focus to the file content, so the behavior is also inconsistent.
Created attachment 253705 [details] [review] File browser: grab focus to the GeditView after opening a file
Review of attachment 253705 [details] [review]: As gregier explained on IRC, the problem has already been fixed in the past: https://git.gnome.org/browse/gedit/commit/?id=139db33451057858f196be29f567b7c37140c70b So the bug should be fixed somewhere else.
I don't have a good understanding of the code in the file browser, with the button_press_event(). gregier, you added the row_activated() recently: https://git.gnome.org/browse/gedit/commit/?id=0701c9c4639c93e6f Now the activate_selected_items() is called two times. One with the row-activated, and one in the button_press_event(): https://git.gnome.org/browse/gedit/tree/plugins/filebrowser/gedit-file-browser-view.c#n582 The "row-activated" signal is actually emitted when widget_parent->button_press_event (widget, event); is running. Maybe the button_press_event() can be simplified. It seems a bit complicated for what it is. Or gedit_commands_load_location() can always grab the focus to the GeditView, even if the file is already loaded.
Fixed: https://git.gnome.org/browse/gedit/commit/?id=221acefbe94a6f31f827090033f3981f349f3f9f