66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/twirb/textgui.rb', line 66
def command_keyboard(var, status, m)
@entry.bind("Key", proc do
var.value = @entry.index(m)
status.value = "auto mode" if @edit_mode and @auto_highlight
end)
@entry.bind("Double-Key-Escape", proc {@edit_mode = true})
@entry.bind("Escape", proc {status.value = "edit mode"; @edit_mode = false})
@entry.bind("Double-Key-Return", proc {new_line})
@entry.bind("Key-Return", proc do |e|
e.widget.callback_continue unless @edit_mode
highlight
end)
@entry.bind("Control-Key-q", proc {convert;status.value = "text mode" unless @auto_highlight})
@entry.bind("Control-Key-w", proc {@auto_highlight = true})
@entry.bind("Control-Key-e", proc {execute_code})
@entry.bind("space", proc do |e|
e.widget.callback_continue unless @edit_mode
highlight
end)
end
|