regression: typing uppercase letters in text

This commit is contained in:
Kartik K. Agaram 2022-05-30 15:36:53 -07:00
parent fd5a47f8bf
commit 3b4dacaee8
2 changed files with 7 additions and 8 deletions

View File

@ -12,17 +12,16 @@ end
function App.combine_modifiers(key) function App.combine_modifiers(key)
local result = '' local result = ''
local down = love.keyboard.isDown if App.ctrl_down() then
if down('lctrl') or down('rctrl') then
result = result..'C-' result = result..'C-'
end end
if down('lalt') or down('ralt') then if App.alt_down() then
result = result..'M-' result = result..'M-'
end end
if down('lshift') or down('rshift') then if App.shift_down() then
result = result..'S-' -- don't try to use this with letters/digits result = result..'S-' -- don't try to use this with letters/digits
end end
if down('lgui') or down('rgui') then if App.cmd_down() then
result = result..'s-' result = result..'s-'
end end
result = result..key result = result..key
@ -30,7 +29,7 @@ function App.combine_modifiers(key)
end end
function App.modifier_down() function App.modifier_down()
return array.any(Modifiers, love.keyboard.isDown) return App.ctrl_down() or App.alt_down() or App.shift_down() or App.cmd_down()
end end
function App.ctrl_down() function App.ctrl_down()
@ -45,7 +44,7 @@ function App.shift_down()
return love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift') return love.keyboard.isDown('lshift') or love.keyboard.isDown('rshift')
end end
function App.gui_down() function App.cmd_down()
return love.keyboard.isDown('lgui') or love.keyboard.isDown('rgui') return love.keyboard.isDown('lgui') or love.keyboard.isDown('rgui')
end end

View File

@ -1109,7 +1109,7 @@ end
function Text.textinput(t) function Text.textinput(t)
if love.mouse.isDown('1') then return end if love.mouse.isDown('1') then return end
if App.modifier_down() then return end if App.ctrl_down() or App.alt_down() or App.cmd_down() then return end
local down = love.keyboard.isDown local down = love.keyboard.isDown
Text.insert_at_cursor(t) Text.insert_at_cursor(t)
end end