Merge pull request #760 from adamharrison/fix-multiline-paste-system-clipboard

Restore External Paste to Non-Multiline Paste
This commit is contained in:
Adam 2021-12-21 17:15:03 -05:00 committed by GitHub
commit e0d0d17c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -124,7 +124,8 @@ local commands = {
["doc:paste"] = function()
local clipboard = system.get_clipboard()
-- If the clipboard has changed since our last look, use that instead
if core.cursor_clipboard["full"] ~= clipboard then
local external_paste = core.cursor_clipboard["full"] ~= clipboard
if external_paste then
core.cursor_clipboard = {}
core.cursor_clipboard_whole_line = {}
end
@ -135,7 +136,7 @@ local commands = {
whole_line = core.cursor_clipboard_whole_line[idx] == true
else
value = clipboard
whole_line = clipboard:find("\n") ~= nil
whole_line = not external_paste and clipboard:find("\n") ~= nil
end
if whole_line then
doc():insert(line1, 1, value:gsub("\r", ""))