Skip to content

Conversation

@marmarta
Copy link
Member

@codecov
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.

Project coverage is 81.52%. Comparing base (9d665ee) to head (d0f39c3).
Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
qubes_menu/appmenu.py 14.28% 6 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@marmarta
Copy link
Member Author

codecov fails because unit tests don't cover sending key presses to menu

Copy link
Member

@marmarek marmarek left a 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...

@marmarta
Copy link
Member Author

😱 I'll try to fix it

if isinstance(current_widget,
Gtk.SearchEntry):
p = current_widget.get_position()
current_widget.set_text(current_widget.get_text() + " ")
Copy link
Member

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...

Copy link
Member Author

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

@marmarek marmarek merged commit 0345aff into QubesOS:main Nov 2, 2024
2 of 4 checks passed
p = current_widget.get_position()
current_widget.insert_text(" ", p)
current_widget.set_position(p + 1)
return True
Copy link
Contributor

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.

marmarek added a commit that referenced this pull request Jul 15, 2025
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mouse cursor position can prevent typing spaces in app menu search bar

3 participants