non-global clipboard
This commit is contained in:
@@ -314,8 +314,8 @@ local function writeHighlighted(sLine, ny)
|
|||||||
text = '',
|
text = '',
|
||||||
}
|
}
|
||||||
|
|
||||||
local function tryWrite(sLine, regex, fgcolor)
|
local function tryWrite(line, regex, fgcolor)
|
||||||
local match = sLine:match(regex)
|
local match = line:match(regex)
|
||||||
if match then
|
if match then
|
||||||
local fg
|
local fg
|
||||||
if type(fgcolor) == "string" then
|
if type(fgcolor) == "string" then
|
||||||
@@ -325,7 +325,7 @@ local function writeHighlighted(sLine, ny)
|
|||||||
end
|
end
|
||||||
buffer.text = buffer.text .. match
|
buffer.text = buffer.text .. match
|
||||||
buffer.fg = buffer.fg .. string.rep(fg, #match)
|
buffer.fg = buffer.fg .. string.rep(fg, #match)
|
||||||
return sLine:sub(#match + 1)
|
return line:sub(#match + 1)
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@@ -452,12 +452,12 @@ local function hacky_read()
|
|||||||
local _oldSetCursorPos = term.setCursorPos
|
local _oldSetCursorPos = term.setCursorPos
|
||||||
local _oldGetCursorPos = term.getCursorPos
|
local _oldGetCursorPos = term.getCursorPos
|
||||||
|
|
||||||
term.setCursorPos = function(x, y)
|
term.setCursorPos = function(cx)
|
||||||
return _oldSetCursorPos(x, h)
|
return _oldSetCursorPos(cx, h)
|
||||||
end
|
end
|
||||||
term.getCursorPos = function()
|
term.getCursorPos = function()
|
||||||
local x, y = _oldGetCursorPos()
|
local cx = _oldGetCursorPos()
|
||||||
return x, 1
|
return cx, 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local s, m = pcall(function() return read() end)
|
local s, m = pcall(function() return read() end)
|
||||||
@@ -986,18 +986,18 @@ local __actions = {
|
|||||||
local count = 0
|
local count = 0
|
||||||
local lines = { }
|
local lines = { }
|
||||||
|
|
||||||
for _ = csy, cey do
|
for cy = csy, cey do
|
||||||
local line = tLines[y]
|
local line = tLines[cy]
|
||||||
if line then
|
if line then
|
||||||
local x = 1
|
local cx = 1
|
||||||
local ex = #line
|
local ex = #line
|
||||||
if y == csy then
|
if cy == csy then
|
||||||
x = csx
|
cx = csx
|
||||||
end
|
end
|
||||||
if y == cey then
|
if cy == cey then
|
||||||
ex = cex - 1
|
ex = cex - 1
|
||||||
end
|
end
|
||||||
local str = line:sub(x, ex)
|
local str = line:sub(cx, ex)
|
||||||
count = count + #str
|
count = count + #str
|
||||||
table.insert(lines, str)
|
table.insert(lines, str)
|
||||||
end
|
end
|
||||||
@@ -1055,6 +1055,7 @@ local __actions = {
|
|||||||
setStatus('Using system clipboard')
|
setStatus('Using system clipboard')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
mark.continue = mark.active
|
||||||
end,
|
end,
|
||||||
|
|
||||||
copy_marked = function()
|
copy_marked = function()
|
||||||
@@ -1063,6 +1064,7 @@ local __actions = {
|
|||||||
clipboard.setData(text)
|
clipboard.setData(text)
|
||||||
clipboard.useInternal(true)
|
clipboard.useInternal(true)
|
||||||
else
|
else
|
||||||
|
debug(text)
|
||||||
os.queueEvent('clipboard_copy', text)
|
os.queueEvent('clipboard_copy', text)
|
||||||
end
|
end
|
||||||
setStatus('%d chars copied', size)
|
setStatus('%d chars copied', size)
|
||||||
|
|||||||
Reference in New Issue
Block a user