mirror of
https://github.com/aclist/dztui.git
synced 2026-08-25 17:32:36 +02:00
change: normalize context menu keybind behavior for j,k keys
Normalized custom menu navigation keys to be in conformity with native keybindings for Gdk.KEY_uparrow and Gdk.KEY_downarrow.
This commit is contained in:
parent
3f1aff7cc6
commit
0a310f0b70
@ -104,20 +104,11 @@ class ContextMixin(TreeView):
|
||||
return False
|
||||
menu = self.context_menu
|
||||
children = menu.get_children()
|
||||
sel = menu.get_selected_item()
|
||||
for i, child in enumerate(children):
|
||||
if sel is child:
|
||||
ind = i
|
||||
break
|
||||
|
||||
match event.keyval:
|
||||
case Gdk.KEY_j:
|
||||
if ind + 1 > len(children) - 1:
|
||||
return False
|
||||
menu.emit("move-current", Gtk.MenuDirectionType.NEXT)
|
||||
case Gdk.KEY_k:
|
||||
if ind - 1 < 0:
|
||||
return False
|
||||
menu.emit("move-current", Gtk.MenuDirectionType.PREV)
|
||||
case Gdk.KEY_g:
|
||||
menu.select_item(children[0])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user