Compare commits
2 commits
7616a5bed3
...
3289e07a89
Author | SHA1 | Date | |
---|---|---|---|
Ben | 3289e07a89 | ||
Ben | 8972bf27e5 |
|
@ -68,7 +68,8 @@ local function repositionOrCreateEntryFrame(idx)
|
||||||
if previousFrame ~= nil then
|
if previousFrame ~= nil then
|
||||||
local xPos
|
local xPos
|
||||||
xPos, yPos = previousFrame.getPosition()
|
xPos, yPos = previousFrame.getPosition()
|
||||||
yPos = yPos + 1
|
local xSize, ySize = previousFrame.getSize()
|
||||||
|
yPos = yPos + ySize
|
||||||
end
|
end
|
||||||
local tw, th = frame.getSize()
|
local tw, th = frame.getSize()
|
||||||
local entryFrame = subFrames[idx]
|
local entryFrame = subFrames[idx]
|
||||||
|
|
|
@ -39,9 +39,7 @@ local function fetch(wait_for)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawEntry(win, obj)
|
local function drawEntry(win, obj)
|
||||||
local winX, winY = win.getPosition()
|
winhlp.setHeight(win, 2)
|
||||||
local sizeX, sizeY = win.getSize()
|
|
||||||
win.reposition(winX, winY, sizeX, 2)
|
|
||||||
win.setBackgroundColor(colors.black)
|
win.setBackgroundColor(colors.black)
|
||||||
win.setTextColor(colors.lightGray)
|
win.setTextColor(colors.lightGray)
|
||||||
win.write(obj.id)
|
win.write(obj.id)
|
||||||
|
|
17
winhlp.lua
17
winhlp.lua
|
@ -1,14 +1,20 @@
|
||||||
local function translate(window, x, y)
|
local function translate(win, x, y)
|
||||||
local winX, winY = window.getPosition()
|
local winX, winY = win.getPosition()
|
||||||
return x-winX+1, y-winY+1
|
return x-winX+1, y-winY+1
|
||||||
end
|
end
|
||||||
|
|
||||||
local function contains(window, x, y)
|
local function contains(win, x, y)
|
||||||
local winX, winY = window.getPosition()
|
local winX, winY = win.getPosition()
|
||||||
local width, height = window.getSize()
|
local width, height = win.getSize()
|
||||||
return x >= winX and y >= winY and x-winX < width and y-winY < height
|
return x >= winX and y >= winY and x-winX < width and y-winY < height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function setHeight(win, height)
|
||||||
|
local winX, winY = win.getPosition()
|
||||||
|
local sizeX, sizeY = win.getSize()
|
||||||
|
win.reposition(winX, winY, sizeX, height)
|
||||||
|
end
|
||||||
|
|
||||||
local function alignRight(termlike, length)
|
local function alignRight(termlike, length)
|
||||||
local tw, th = termlike.getSize()
|
local tw, th = termlike.getSize()
|
||||||
local x, y = termlike.getCursorPos()
|
local x, y = termlike.getCursorPos()
|
||||||
|
@ -20,5 +26,6 @@ end
|
||||||
return {
|
return {
|
||||||
translate=translate,
|
translate=translate,
|
||||||
contains=contains,
|
contains=contains,
|
||||||
|
setHeight=setHeight,
|
||||||
alignRight=alignRight,
|
alignRight=alignRight,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue