21 lines
521 B
Plaintext
21 lines
521 B
Plaintext
paste_button = function(x, y, r)
|
|
return overflowable_button('paste', x, y, r,
|
|
function()
|
|
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
|