For shift we'll mostly rely on love.textinput. For the rest I've created a simple driver.
6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC
function love.keypressed(key, scancode, isrepeat)
if key == 'return' then
function love.textinput(t)
lines[#lines] = lines[#lines]..t
end
function keychord_pressed(chord)
-- Don't handle any keys here that would trigger love.textinput above.
if chord == 'return' then
elseif key == 'space' then
lines[#lines] = lines[#lines]..' '
elseif key == 'lctrl' or key == 'rctrl' then
-- do nothing
elseif key == 'lalt' or key == 'ralt' then
-- do nothing
elseif key == 'lshift' or key == 'rshift' then
-- do nothing
elseif love.keyboard.isDown('lctrl') or love.keyboard.isDown('rctrl') then
if key == 'r' then
lines[#lines+1] = eval(lines[#lines])[1]
lines[#lines+1] = ''
end
else
lines[#lines] = lines[#lines]..key
elseif chord == 'C-r' then
lines[#lines+1] = eval(lines[#lines])[1]
lines[#lines+1] = ''
-- Keyboard driver
function love.keypressed(key, scancode, isrepeat)
if key == 'lctrl' or key == 'rctrl' or key == 'lalt' or key == 'ralt' or key == 'lshift' or key == 'rshift' or key == 'lgui' or key == 'rgui' then
-- do nothing when the modifier is pressed
end
-- include the modifier(s) when the non-modifer is pressed
keychord_pressed(combine_modifiers(key))
end
function combine_modifiers(key)
local result = ''
local down = love.keyboard.isDown
if down('lctrl') or down('rctrl') then
result = result..'C-'
end
if down('lalt') or down('ralt') then
result = result..'M-'
end
if down('lgui') or down('rgui') then
result = result..'S-'
end
result = result..key
return result
end