31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
keychord_press_on_manifest_navigator = function(chord, key)
|
|
if chord == 'escape' then
|
|
reset_manifest_navigator()
|
|
elseif chord == 'return' then
|
|
if Manifest_navigator.for_delete then
|
|
delete_definition(Manifest_navigator.candidates[Manifest_navigator.index])
|
|
else
|
|
load_definition(Manifest_navigator.candidates[Manifest_navigator.index])
|
|
end
|
|
A()
|
|
reset_manifest_navigator()
|
|
elseif chord == 'backspace' then
|
|
local len = utf8.len(Manifest_navigator.filter)
|
|
local byte_offset = Text.offset(Manifest_navigator.filter, len)
|
|
Manifest_navigator.filter = string.sub(Manifest_navigator.filter, 1, byte_offset-1)
|
|
Manifest_navigator.index = 1
|
|
Manifest_navigator.candidates = manifest_navigator_candidates()
|
|
elseif chord == 'left' then
|
|
if Manifest_navigator.index > 1 then
|
|
Manifest_navigator.index = Manifest_navigator.index-1
|
|
end
|
|
elseif chord == 'right' then
|
|
if Manifest_navigator.index < #Manifest_navigator.candidates then
|
|
Manifest_navigator.index = Manifest_navigator.index+1
|
|
end
|
|
elseif chord == 'down' then
|
|
manifest_navigator_down()
|
|
elseif chord == 'up' then
|
|
manifest_navigator_up()
|
|
end
|
|
end |