mirror of
https://github.com/kepler155c/opus
synced 2024-12-24 15:40:26 +00:00
Merge branch 'develop'
This commit is contained in:
commit
55e335acbc
@ -32,6 +32,7 @@ local keyboard
|
|||||||
local clipboard = { size, internal }
|
local clipboard = { size, internal }
|
||||||
local searchPattern
|
local searchPattern
|
||||||
local undo = { chain = { }, pointer = 0 }
|
local undo = { chain = { }, pointer = 0 }
|
||||||
|
local complete = { }
|
||||||
|
|
||||||
if _G.__CLIPBOARD then
|
if _G.__CLIPBOARD then
|
||||||
clipboard = _G.__CLIPBOARD
|
clipboard = _G.__CLIPBOARD
|
||||||
@ -485,36 +486,51 @@ local __actions = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
autocomplete = function()
|
autocomplete = function()
|
||||||
local sLine = tLines[y]:sub(1, x - 1)
|
if keyboard.lastAction ~= 'autocomplete' or not complete.results then
|
||||||
local nStartPos = sLine:find("[a-zA-Z0-9_%.]+$")
|
local sLine = tLines[y]:sub(1, x - 1)
|
||||||
if nStartPos then
|
local nStartPos = sLine:find("[a-zA-Z0-9_%.]+$")
|
||||||
sLine = sLine:sub(nStartPos)
|
if nStartPos then
|
||||||
|
sLine = sLine:sub(nStartPos)
|
||||||
|
end
|
||||||
|
if #sLine > 0 then
|
||||||
|
complete.results = textutils.complete(sLine)
|
||||||
|
else
|
||||||
|
complete.results = { }
|
||||||
|
end
|
||||||
|
complete.index = 0
|
||||||
|
complete.x = x
|
||||||
end
|
end
|
||||||
if #sLine > 0 then
|
|
||||||
local results = textutils.complete(sLine)
|
|
||||||
|
|
||||||
if #results == 0 then
|
if #complete.results == 0 then
|
||||||
setError('No completions available')
|
setError('No completions available')
|
||||||
|
|
||||||
elseif #results == 1 then
|
elseif #complete.results == 1 then
|
||||||
actions.insertText(x, y, results[1])
|
actions.insertText(x, y, complete.results[1])
|
||||||
|
complete.results = nil
|
||||||
|
|
||||||
elseif #results > 1 then
|
elseif #complete.results > 1 then
|
||||||
local prefix = results[1]
|
local prefix = complete.results[1]
|
||||||
for n = 1, #results do
|
for n = 1, #complete.results do
|
||||||
local result = results[n]
|
local result = complete.results[n]
|
||||||
while #prefix > 0 do
|
while #prefix > 0 do
|
||||||
if result:find(prefix, 1, true) == 1 then
|
if result:find(prefix, 1, true) == 1 then
|
||||||
break
|
break
|
||||||
end
|
|
||||||
prefix = prefix:sub(1, #prefix - 1)
|
|
||||||
end
|
end
|
||||||
|
prefix = prefix:sub(1, #prefix - 1)
|
||||||
end
|
end
|
||||||
if #prefix > 0 then
|
end
|
||||||
actions.insertText(x, y, prefix)
|
if #prefix > 0 then
|
||||||
else
|
actions.insertText(x, y, prefix)
|
||||||
setStatus('Too many results')
|
complete.results = nil
|
||||||
|
else
|
||||||
|
if complete.index > 0 then
|
||||||
|
actions.deleteText(complete.x, y, complete.x + #complete.results[complete.index], y)
|
||||||
end
|
end
|
||||||
|
complete.index = complete.index + 1
|
||||||
|
if complete.index > #complete.results then
|
||||||
|
complete.index = 1
|
||||||
|
end
|
||||||
|
actions.insertText(complete.x, y, complete.results[complete.index])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -1203,6 +1219,9 @@ while bRunning do
|
|||||||
mark.continue = false
|
mark.continue = false
|
||||||
|
|
||||||
actions[action](param, param2)
|
actions[action](param, param2)
|
||||||
|
if action ~= 'menu' then
|
||||||
|
keyboard.lastAction = action
|
||||||
|
end
|
||||||
|
|
||||||
if x ~= lastPos.x or y ~= lastPos.y then
|
if x ~= lastPos.x or y ~= lastPos.y then
|
||||||
actions.setCursor()
|
actions.setCursor()
|
||||||
|
@ -518,6 +518,10 @@ while true do
|
|||||||
local tEventData = { os.pullEventRaw() }
|
local tEventData = { os.pullEventRaw() }
|
||||||
local sEvent = table.remove(tEventData, 1)
|
local sEvent = table.remove(tEventData, 1)
|
||||||
|
|
||||||
|
if sEvent == 'key_up' then
|
||||||
|
processKeyEvent(sEvent, tEventData[1])
|
||||||
|
end
|
||||||
|
|
||||||
if sEvent == "term_resize" then
|
if sEvent == "term_resize" then
|
||||||
-- Resize event
|
-- Resize event
|
||||||
w,h = parentTerm.getSize()
|
w,h = parentTerm.getSize()
|
||||||
|
@ -129,7 +129,7 @@ recTerm = multishell.term
|
|||||||
for key, func in pairs(oldTerm) do
|
for key, func in pairs(oldTerm) do
|
||||||
recTerm[key] = function(...)
|
recTerm[key] = function(...)
|
||||||
local result = { func(...) }
|
local result = { func(...) }
|
||||||
|
|
||||||
if callCount == 0 then
|
if callCount == 0 then
|
||||||
os.queueEvent('capture_frame')
|
os.queueEvent('capture_frame')
|
||||||
end
|
end
|
||||||
@ -480,9 +480,15 @@ for i = 1, #calls do
|
|||||||
|
|
||||||
for xx = xMin, xMax do if buffer[yy][xx][1] ~= oldBuffer[yy][xx][1] or (buffer[yy][xx][2] ~= oldBuffer[yy][xx][2] and buffer[yy][xx][1] ~= " ") or buffer[yy][xx][3] ~= oldBuffer[yy][xx][3] or buffer[yy][xx][4] ~= oldBuffer[yy][xx][4] or i == 1 then
|
for xx = xMin, xMax do if buffer[yy][xx][1] ~= oldBuffer[yy][xx][1] or (buffer[yy][xx][2] ~= oldBuffer[yy][xx][2] and buffer[yy][xx][1] ~= " ") or buffer[yy][xx][3] ~= oldBuffer[yy][xx][3] or buffer[yy][xx][4] ~= oldBuffer[yy][xx][4] or i == 1 then
|
||||||
local thisChar, thisT, thisB, xBump = chars[buffer[yy][xx][1]:byte()], buffer[yy][xx][2], buffer[yy][xx][3], (xx - xMin) * charW
|
local thisChar, thisT, thisB, xBump = chars[buffer[yy][xx][1]:byte()], buffer[yy][xx][2], buffer[yy][xx][3], (xx - xMin) * charW
|
||||||
|
if thisChar then
|
||||||
for y = 1, charH do for x = 1, charW do thisFrame[y + yBump][x + xBump] = thisChar[y][x] and thisT or thisB end end
|
for y = 1, charH do
|
||||||
|
for x = 1, charW do
|
||||||
|
local ch = thisChar[y][x] and thisT or thisB
|
||||||
|
thisFrame[y + yBump][x + xBump] = ch
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if buffer[yy][xx][4] then
|
if buffer[yy][xx][4] then
|
||||||
thisT, thisChar = colourNum[tCol], chars[95]
|
thisT, thisChar = colourNum[tCol], chars[95]
|
||||||
for y = 1, charH do for x = 1, charW do if thisChar[y][x] then thisFrame[y + yBump][x + xBump] = thisT end end end
|
for y = 1, charH do for x = 1, charW do if thisChar[y][x] then thisFrame[y + yBump][x + xBump] = thisT end end end
|
||||||
|
Loading…
Reference in New Issue
Block a user