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 searchPattern
|
||||
local undo = { chain = { }, pointer = 0 }
|
||||
local complete = { }
|
||||
|
||||
if _G.__CLIPBOARD then
|
||||
clipboard = _G.__CLIPBOARD
|
||||
@ -485,24 +486,32 @@ local __actions = {
|
||||
end,
|
||||
|
||||
autocomplete = function()
|
||||
if keyboard.lastAction ~= 'autocomplete' or not complete.results then
|
||||
local sLine = tLines[y]:sub(1, x - 1)
|
||||
local nStartPos = sLine:find("[a-zA-Z0-9_%.]+$")
|
||||
if nStartPos then
|
||||
sLine = sLine:sub(nStartPos)
|
||||
end
|
||||
if #sLine > 0 then
|
||||
local results = textutils.complete(sLine)
|
||||
complete.results = textutils.complete(sLine)
|
||||
else
|
||||
complete.results = { }
|
||||
end
|
||||
complete.index = 0
|
||||
complete.x = x
|
||||
end
|
||||
|
||||
if #results == 0 then
|
||||
if #complete.results == 0 then
|
||||
setError('No completions available')
|
||||
|
||||
elseif #results == 1 then
|
||||
actions.insertText(x, y, results[1])
|
||||
elseif #complete.results == 1 then
|
||||
actions.insertText(x, y, complete.results[1])
|
||||
complete.results = nil
|
||||
|
||||
elseif #results > 1 then
|
||||
local prefix = results[1]
|
||||
for n = 1, #results do
|
||||
local result = results[n]
|
||||
elseif #complete.results > 1 then
|
||||
local prefix = complete.results[1]
|
||||
for n = 1, #complete.results do
|
||||
local result = complete.results[n]
|
||||
while #prefix > 0 do
|
||||
if result:find(prefix, 1, true) == 1 then
|
||||
break
|
||||
@ -512,9 +521,16 @@ local __actions = {
|
||||
end
|
||||
if #prefix > 0 then
|
||||
actions.insertText(x, y, prefix)
|
||||
complete.results = nil
|
||||
else
|
||||
setStatus('Too many results')
|
||||
if complete.index > 0 then
|
||||
actions.deleteText(complete.x, y, complete.x + #complete.results[complete.index], y)
|
||||
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,
|
||||
@ -1203,6 +1219,9 @@ while bRunning do
|
||||
mark.continue = false
|
||||
|
||||
actions[action](param, param2)
|
||||
if action ~= 'menu' then
|
||||
keyboard.lastAction = action
|
||||
end
|
||||
|
||||
if x ~= lastPos.x or y ~= lastPos.y then
|
||||
actions.setCursor()
|
||||
|
@ -518,6 +518,10 @@ while true do
|
||||
local tEventData = { os.pullEventRaw() }
|
||||
local sEvent = table.remove(tEventData, 1)
|
||||
|
||||
if sEvent == 'key_up' then
|
||||
processKeyEvent(sEvent, tEventData[1])
|
||||
end
|
||||
|
||||
if sEvent == "term_resize" then
|
||||
-- Resize event
|
||||
w,h = parentTerm.getSize()
|
||||
|
@ -480,8 +480,14 @@ 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
|
||||
local thisChar, thisT, thisB, xBump = chars[buffer[yy][xx][1]:byte()], buffer[yy][xx][2], buffer[yy][xx][3], (xx - xMin) * charW
|
||||
|
||||
for y = 1, charH do for x = 1, charW do thisFrame[y + yBump][x + xBump] = thisChar[y][x] and thisT or thisB end end
|
||||
if thisChar then
|
||||
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
|
||||
thisT, thisChar = colourNum[tCol], chars[95]
|
||||
|
Loading…
Reference in New Issue
Block a user