-
-
Notifications
You must be signed in to change notification settings - Fork 16
Stop eating spaces when a non-search widget is selected #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
- Coverage 83.01% 81.52% -1.50%
==========================================
Files 22 22
Lines 2190 2273 +83
==========================================
+ Hits 1818 1853 +35
- Misses 372 420 +48 ☔ View full report in Codecov by Sentry. |
|
codecov fails because unit tests don't cover sending key presses to menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, when I press a space outside of the search page, keyboard navigation (arrows etc) stops working...
|
😱 I'll try to fix it |
qubes_menu/appmenu.py
Outdated
| if isinstance(current_widget, | ||
| Gtk.SearchEntry): | ||
| p = current_widget.get_position() | ||
| current_widget.set_text(current_widget.get_text() + " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now when I type space in the middle of search entry (move cursor with arrows first), then the space doesn't appear there, only at the end...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXED IT FINALLY, no more raging consumption of spaces or weird space behavior
| p = current_widget.get_position() | ||
| current_widget.insert_text(" ", p) | ||
| current_widget.set_position(p + 1) | ||
| return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose current_widget is the same as the widget receiving the event? If so, this return value (whether to stop propagation) seems backwards: the search widget should continue handling the event (by inserting a space itself), while the menu items should stop handling the event. The code before this change makes more sense to me.
* origin/pr/60: Always insert spaces into search bar Pull request description: Fixes QubesOS/qubes-issues#8789. Follow up to #47, cc @marmarta. This combines elements of different versions of that PR. Alternative: could let a focused search bar insert the space itself by wrapping all of this in in the previously present ```py if not isinstance(self.get_active_window().get_focus(), Gtk.SearchEntry): ``` Developed and tested on top of branch `release4.2`. Tested scenarios from previous PR: - Pressing space does not interfere with arrow key navigation on any page. - Spaces can be inserted in the middle of the search text. Still weird: - Pressing space when the search bar is not focused never focuses it (unlike letter keys). - Pressing space when the search page is not visible does not show the search page (unlike letter keys) but does still add a space to the invisible search bar. - The `_key_press` and `_key_pressed` methods appear to handle the same events. Combining them would make it easier to address the previous point.
fixes QubesOS/qubes-issues#8789