Fix listview clearing after update

This commit is contained in:
Ben 2024-06-02 03:25:04 +02:00
parent 8cb74f5dbe
commit 6ec60f8e1c
Signed by: ben
GPG key ID: 0F54A7ED232D3319
2 changed files with 5 additions and 5 deletions

View file

@ -37,13 +37,13 @@ local function updateItemAt(idx, item)
redrawLine(idx) redrawLine(idx)
end end
local function clearAfter(idx) local function clearFrom(idx)
local tw, th = frame.getSize() local tw, th = frame.getSize()
for j = length, idx+1, -1 do for j = length, idx, -1 do
backingList[j] = nil backingList[j] = nil
end end
length = idx length = idx
for y = paginationOffset-idx+2, th, 1 do for y = idx-paginationOffset+1, th, 1 do
frame.setCursorPos(1, y) frame.setCursorPos(1, y)
frame.clearLine() frame.clearLine()
end end
@ -78,7 +78,7 @@ return {
setDrawLineFunc=setDrawLineFunc, setDrawLineFunc=setDrawLineFunc,
itemAt=itemAt, itemAt=itemAt,
updateItemAt=updateItemAt, updateItemAt=updateItemAt,
clearAfter=clearAfter, clearFrom=clearFrom,
redraw=redraw, redraw=redraw,
updatePage=updatePage, updatePage=updatePage,
} }

View file

@ -53,7 +53,7 @@ local function fetch(wait_for)
end end
wait_for(config.step_sleep_time) wait_for(config.step_sleep_time)
end end
listview.clearAfter(currentIdx) listview.clearFrom(currentIdx)
end end
local function drawLine(termlike, obj) local function drawLine(termlike, obj)