paste in text with M-v
This commit is contained in:
parent
dd635546e3
commit
0fab1b499d
|
@ -23,3 +23,8 @@ function App.combine_modifiers(key)
|
|||
result = result..key
|
||||
return result
|
||||
end
|
||||
|
||||
function App.modifier_down()
|
||||
local down = love.keyboard.isDown
|
||||
return down('lctrl') or down('rctrl') or down('lalt') or down('ralt') or down('lgui') or down('rgui')
|
||||
end
|
||||
|
|
8
text.lua
8
text.lua
|
@ -739,6 +739,8 @@ end
|
|||
|
||||
function Text.textinput(t)
|
||||
if love.mouse.isDown('1') then return end
|
||||
if App.modifier_down() then return end
|
||||
local down = love.keyboard.isDown
|
||||
Text.insert_at_cursor(t)
|
||||
end
|
||||
|
||||
|
@ -794,6 +796,12 @@ function Text.keychord_pressed(chord)
|
|||
break
|
||||
end
|
||||
end
|
||||
-- paste
|
||||
elseif chord == 'M-v' then
|
||||
local s = love.system.getClipboardText()
|
||||
for _,code in utf8.codes(s) do
|
||||
Text.insert_at_cursor(utf8.char(code))
|
||||
end
|
||||
elseif chord == 'home' then
|
||||
Cursor1.pos = 1
|
||||
elseif chord == 'end' then
|
||||
|
|
Loading…
Reference in New Issue