Fix aligning in orders, rename function
This commit is contained in:
parent
3289e07a89
commit
20e844488a
12
orders.lua
12
orders.lua
|
@ -49,13 +49,14 @@ local function drawEntry(win, obj)
|
|||
win.write(obj.pos.x .. "," .. obj.pos.y .. "," .. obj.pos.z)
|
||||
win.write(" ")
|
||||
end
|
||||
local padding
|
||||
if obj.res_status then
|
||||
winhlp.alignRight(win, #obj.res_status + 4)
|
||||
padding = winhlp.alignRightPadding(win, #obj.res_status + 4)
|
||||
win.write(" " .. obj.res_status)
|
||||
else
|
||||
winhlp.alignRight(win, 3)
|
||||
padding = winhlp.alignRightPadding(win, 3)
|
||||
end
|
||||
win.write(" ")
|
||||
win.write(string.format("%" .. padding+1 .. "s", " "))
|
||||
if obj.claimed then
|
||||
win.setTextColor(colors.green)
|
||||
win.write("C")
|
||||
|
@ -66,8 +67,9 @@ local function drawEntry(win, obj)
|
|||
win.setTextColor(colors.gray)
|
||||
win.setCursorPos(1, 2)
|
||||
if obj.target then
|
||||
winhlp.alignRight(win, #obj.target + 1)
|
||||
win.write(" " .. obj.target)
|
||||
padding = winhlp.alignRightPadding(win, #obj.target + 1)
|
||||
win.write(string.format("%" .. padding+1 .. "s", " "))
|
||||
win.write(obj.target)
|
||||
end
|
||||
win.setTextColor(colors.white)
|
||||
win.setCursorPos(1, 2)
|
||||
|
|
|
@ -64,7 +64,7 @@ local function drawLine(termlike, obj)
|
|||
termlike.write(" ")
|
||||
if obj.answer == nil then
|
||||
termlike.setTextColor(colors.orange)
|
||||
local padding = winhlp.alignRight(termlike, 5)
|
||||
local padding = winhlp.alignRightPadding(termlike, 5)
|
||||
termlike.write(string.format("%" .. padding+5 .. "s", " N/A "))
|
||||
else
|
||||
if permset.has(allowed_items, obj.answer.name) then
|
||||
|
@ -74,7 +74,7 @@ local function drawLine(termlike, obj)
|
|||
end
|
||||
termlike.write(obj.answer.name)
|
||||
termlike.setTextColor(colors.white)
|
||||
local padding = winhlp.alignRight(termlike, 5)
|
||||
local padding = winhlp.alignRightPadding(termlike, 5)
|
||||
termlike.write(string.format("%" .. padding+2 .. "s", " ["))
|
||||
if permset.has(allowed_items, obj.answer.name) then
|
||||
termlike.setTextColor(colors.green)
|
||||
|
|
|
@ -15,7 +15,7 @@ local function setHeight(win, height)
|
|||
win.reposition(winX, winY, sizeX, height)
|
||||
end
|
||||
|
||||
local function alignRight(termlike, length)
|
||||
local function alignRightPadding(termlike, length)
|
||||
local tw, th = termlike.getSize()
|
||||
local x, y = termlike.getCursorPos()
|
||||
termlike.setCursorPos(math.min(x, tw-length+1), y)
|
||||
|
@ -27,5 +27,5 @@ return {
|
|||
translate=translate,
|
||||
contains=contains,
|
||||
setHeight=setHeight,
|
||||
alignRight=alignRight,
|
||||
alignRightPadding=alignRightPadding,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue