carousel.love/0067-paste_button

22 lines
540 B
Plaintext

paste_button = function(x, y, r)
return overflowable_button('paste', x, y, r,
function()
Show_menu = nil
local state = Current_pane.editor_state
-- initial state for recording undo operation
local before_line = state.cursor1.line
local before = snapshot(state, before_line)
-- paste
local s = App.get_clipboard()
Text.insert_text(state, s)
-- record undo operation
record_undo_event(state,
{
before=before,
after=snapshot(
state, before_line,
state.cursor1.line)
})
end)
end