1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-23 19:08:05 +11:00

And with that done, nuke a particularly memory-heavy GPU-optimisation in textedit

This commit is contained in:
20kdc 2018-03-22 23:40:49 +00:00
parent d8c4378ec1
commit 7b9f1a2776

View File

@ -54,8 +54,6 @@ local sW, sH = 37, #lines + 2
local window = neo.requestAccess("x.neo.pub.window")(sW, sH) local window = neo.requestAccess("x.neo.pub.window")(sW, sH)
local flush local flush
local screenCache = {}
local function splitCur() local function splitCur()
local s = lines[cursorY] local s = lines[cursorY]
local st = unicode.sub(s, 1, cursorX - 1) local st = unicode.sub(s, 1, cursorX - 1)
@ -378,14 +376,9 @@ local function ev_clipboard(t)
end end
flush = function () flush = function ()
local newCache = {}
for i = 1, sH do for i = 1, sH do
newCache[i] = getline(i) window.span(1, i, getline(i), 0xFFFFFF, 0)
if newCache[i] ~= screenCache[i] then
window.span(1, i, newCache[i], 0xFFFFFF, 0)
end
end end
screenCache = newCache
end end
local flash local flash
flash = function () flash = function ()
@ -393,9 +386,7 @@ flash = function ()
-- reverse: -- reverse:
--local rY = (y + cursorY) - math.ceil(sH / 2) --local rY = (y + cursorY) - math.ceil(sH / 2)
local csY = math.ceil(sH / 2) local csY = math.ceil(sH / 2)
local l = getline(csY) window.span(1, csY, getline(csY), 0xFFFFFF, 0)
screenCache[csY] = l
window.span(1, csY, l, 0xFFFFFF, 0)
event.runAt(os.uptime() + 0.5, flash) event.runAt(os.uptime() + 0.5, flash)
end end
event.runAt(os.uptime() + 0.5, flash) event.runAt(os.uptime() + 0.5, flash)