aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/ui.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-02-16 12:41:54 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-02-16 12:41:54 -0500
commit64dd43f93aeb50768ab9b82bf40a384f1a44ab16 (patch)
tree8db60757bd021d485bfc3cbc82c786290e4999f5 /core/ui.lua
parentdbf70c7d7bf4dfda98a06d19a2827b611fa3db8b (diff)
Fixed copy-paste between views in the terminal version.
Diffstat (limited to 'core/ui.lua')
-rw-r--r--core/ui.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/ui.lua b/core/ui.lua
index 7e4ca9ad..6b3f51b5 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -422,9 +422,15 @@ events_connect(events.BUFFER_DELETED, function()
end
end)
--- Enables and disables mouse mode in curses and focuses and resizes views based
--- on mouse events.
+-- Properly handle clipboard text between views in curses, enables and disables
+-- mouse mode, and focuses and resizes views based on mouse events.
if CURSES then
+ local clipboard_text
+ events.connect(events.VIEW_BEFORE_SWITCH,
+ function() clipboard_text = ui.clipboard_text end)
+ events.connect(events.VIEW_AFTER_SWITCH,
+ function() ui.clipboard_text = clipboard_text end)
+
if not WIN32 then
local function enable_mouse() io.stdout:write("\x1b[?1002h"):flush() end
local function disable_mouse() io.stdout:write("\x1b[?1002l"):flush() end