|
|
@ -126,16 +126,23 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
function Input:keyreleased(key)
|
|
|
|
function Input:keyreleased(key)
|
|
|
|
if self.candidate.length == 0 then
|
|
|
|
if self.candidate.length == 0 then
|
|
|
|
|
|
|
|
local moveTo
|
|
|
|
|
|
|
|
|
|
|
|
if key == 'home' then
|
|
|
|
if key == 'home' then
|
|
|
|
self.cursor = 1
|
|
|
|
self.cursor = 1
|
|
|
|
elseif key == 'end' then
|
|
|
|
elseif key == 'end' then
|
|
|
|
self.cursor = utf8.len(self.text)+1
|
|
|
|
self.cursor = utf8.len(self.text)+1
|
|
|
|
elseif key == 'up' or key == 'down' then
|
|
|
|
elseif key == 'up' or key == 'down' then
|
|
|
|
self.ui:navigate(key)
|
|
|
|
moveTo = key
|
|
|
|
elseif key == 'tab' or key == 'return' then
|
|
|
|
elseif key == 'tab' or key == 'return' then
|
|
|
|
self.ui:navigate('right')
|
|
|
|
moveTo = 'right'
|
|
|
|
elseif key == 'escape' then
|
|
|
|
elseif key == 'escape' then
|
|
|
|
self.ui:navigate('cancel')
|
|
|
|
moveTo = 'cancel'
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if moveTo then
|
|
|
|
|
|
|
|
self.cursor = 1 -- reset cursor position
|
|
|
|
|
|
|
|
self.ui:navigate(moveTo)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|