Skip to content

Commit

Permalink
Fixed #160 through explicit addition of TAB_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrenda committed Sep 6, 2023
1 parent 14eaa84 commit 1b989b9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions addons/pronto/signal_connecting/function_name.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ var anchor

signal method_selected(name: String)

var _gui_input_keycode

func add_class_item(name):
var behaviors = G.at("_pronto_behaviors")
%list.add_item(name, Utils.icon_from_theme(behaviors[name], anchor) if name in behaviors else Utils.icon_for_class(name, anchor), false)

func _gui_input(event):
if event is InputEventKey and event.pressed:
_gui_input_keycode = event.keycode
match event.keycode:
KEY_DOWN: move_focus(1)
KEY_UP: move_focus(-1)
KEY_ENTER, KEY_KP_ENTER:
KEY_ENTER, KEY_KP_ENTER, KEY_TAB:
accept_selected()

func accept_selected():
Expand All @@ -31,7 +34,8 @@ func selected(index: int):
%list.visible = false
text = %list.get_item_text(index)
method_selected.emit(text)
find_next_valid_focus().grab_focus()
if _gui_input_keycode != KEY_TAB:
find_next_valid_focus().grab_focus()

func move_focus(dir: int):
var current = get_focused_index() + dir
Expand Down

0 comments on commit 1b989b9

Please sign in to comment.