Add pagination info view

This commit is contained in:
Ben 2024-06-02 17:40:22 +02:00
parent 17af6e2304
commit ce81e0a8bd
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -17,24 +17,47 @@ local function display()
term.setCursorPos(1,1)
term.setBackgroundColor(colors.yellow)
term.setTextColor(colors.black)
term.clearLine()
local activeTab = tabview.currentTab()
if activeTab ~= nil then
term.clearLine()
term.write(" " .. string.upper(tabview.currentTab().name) .. " ")
term.setCursorPos(tw-8,1)
if currently_working then
term.write(" w ")
term.write(" " .. string.upper(activeTab.name) .. " ")
term.setCursorPos(tw-8,1)
if currently_working then
term.write(" w ")
else
term.write(" R ")
end
term.write(" ^ v ")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.gray)
term.setCursorPos(1,2)
if tabview_window ~= nil then
local tabviewW, tabviewH = tabview_window.getSize()
local estimatedHeight = "?"
if activeTab.estimatedHeight ~= nil then
estimatedHeight = activeTab.estimatedHeight()
end
local paginationInfo = activeTab.scrollPos .. "-" .. tabviewH .. "/" .. estimatedHeight
local padding = winhlp.alignRightPadding(term, #paginationInfo)
term.write(string.format("%" .. padding-1 .. "s", " "))
term.write(paginationInfo)
term.write(" ")
else
term.clearLine()
end
term.setTextColor(colors.white)
for name, tab in pairs(tabview.allTabs()) do
tab.displayTab(tab)
end
else
term.write(" R ")
end
term.write(" ^ v ")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
term.setCursorPos(1,2)
term.clearLine()
for name, tab in pairs(tabview.allTabs()) do
tab.displayTab(tab)
term.setBackgroundColor(colors.black)
term.clear()
term.setBackgroundColor(colors.yellow)
term.clearLine()
term.write(" NO ACTIVE TAB ")
end
end