InputText, DictQuickLookup: add keyboard shortcut for prev/next dict, toggle virtual keyboard, comma on shift+. (#12078)

This commit is contained in:
David
2024-06-28 14:44:18 +01:00
committed by GitHub
parent e88bfbed97
commit 2c9bb33f66
2 changed files with 47 additions and 10 deletions

View File

@@ -595,11 +595,16 @@ function InputText:onKeyPress(key)
end
local handled = true
if not key["Ctrl"] and not key["Shift"] and not key["Alt"] then
if not key["Ctrl"] and not key["Shift"] and not key["Alt"] and not key["ScreenKB"] then
if key["Backspace"] then
self:delChar()
elseif key["Del"] then
self:delNextChar()
-- Kindles with physical keyboards only have a "Del" key (no "Backspace").
if Device:hasSymKey() then
self:delChar()
else
self:delNextChar()
end
elseif key["Left"] then
self:leftChar()
elseif key["Right"] then
@@ -634,6 +639,31 @@ function InputText:onKeyPress(key)
else
handled = false
end
if not handled and (key["ScreenKB"] or key["Shift"]) then
handled = true
if key["Back"] then
self:delChar()
elseif key["Left"] then
self:leftChar()
elseif key["Right"] then
self:rightChar()
elseif key["Up"] then
self:upLine()
elseif key["Down"] then
self:downLine()
elseif key["Home"] then
if self.keyboard:isVisible() then
self:onCloseKeyboard()
else
self:onShowKeyboard()
end
elseif key["."] and Device:hasSymKey() then
-- Kindle does not have a dedicated button for commas
self:addChars(",")
else
handled = false
end
end
if not handled and Device:hasDPad() then
-- FocusManager may turn on alternative key maps.
-- These key map maybe single text keys.