fixed a display error when scrolling in editor lead to a horizontal scroll due to the new line being shorter than the previous one

This commit is contained in:
Florian Nücke 2013-11-23 22:52:57 +01:00
parent 4bc0b891f8
commit 175f0706f3

View File

@ -46,7 +46,7 @@ local function setCursor(nbx, nby)
scrollY = sy
component.gpu.copy(1, 1 + dy, w, h - dy, 0, -dy)
for by = nby - (dy - 1), nby do
local str = text.pad(buffer[by], w)
local str = text.pad(unicode.sub(buffer[by], 1 + scrollX), w)
component.gpu.set(1, by - scrollY, str)
end
elseif ncy < 1 then
@ -55,7 +55,7 @@ local function setCursor(nbx, nby)
scrollY = sy
component.gpu.copy(1, 1, w, h - dy, 0, dy)
for by = nby, nby + (dy - 1) do
local str = text.pad(buffer[by], w)
local str = text.pad(unicode.sub(buffer[by], 1 + scrollX), w)
component.gpu.set(1, by - scrollY, str)
end
end