Update basalt.lua
This commit is contained in:
30
basalt.lua
30
basalt.lua
@@ -1,3 +1,5 @@
|
|||||||
|
-- current version 1
|
||||||
|
|
||||||
local theme = {
|
local theme = {
|
||||||
basaltBG = colors.lightGray,
|
basaltBG = colors.lightGray,
|
||||||
basaltFG = colors.black,
|
basaltFG = colors.black,
|
||||||
@@ -21,7 +23,7 @@ local theme = {
|
|||||||
selectionFG = colors.lightGray,
|
selectionFG = colors.lightGray,
|
||||||
}
|
}
|
||||||
|
|
||||||
local basalt = {debugger=true}
|
local basalt = {debugger=true, version=1}
|
||||||
local activeFrame
|
local activeFrame
|
||||||
local frames = {}
|
local frames = {}
|
||||||
|
|
||||||
@@ -245,7 +247,8 @@ local function basaltDrawHelper()
|
|||||||
|
|
||||||
update = function ()
|
update = function ()
|
||||||
local xC, yC = terminal.getCursorPos()
|
local xC, yC = terminal.getCursorPos()
|
||||||
local isBlinking = terminal.getCursorBlink()
|
local isBlinking = false
|
||||||
|
if(terminal.getCursorBlink~=nil)then isBlinking = terminal.getCursorBlink() end
|
||||||
terminal.setCursorBlink(false)
|
terminal.setCursorBlink(false)
|
||||||
for n=1, h do
|
for n=1, h do
|
||||||
terminal.setCursorPos(1, n)
|
terminal.setCursorPos(1, n)
|
||||||
@@ -1633,29 +1636,23 @@ local function Input(name) -- Input
|
|||||||
for n=1,self.h do
|
for n=1,self.h do
|
||||||
if(n==verticalAlign)then
|
if(n==verticalAlign)then
|
||||||
local val = tostring(base.getValue())
|
local val = tostring(base.getValue())
|
||||||
local text = inputType == "password" and ("*"):rep(val:len()) or val
|
|
||||||
if(text:len()>=self.w)then
|
|
||||||
if(inputType=="password")then
|
|
||||||
text = ("*"):rep(text:len()):sub(text:len()-self.w+2, text:len())
|
|
||||||
else
|
|
||||||
text = text:sub(text:len()-self.w+2, text:len())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local bCol = self.bgcolor
|
local bCol = self.bgcolor
|
||||||
local fCol = self.fgcolor
|
local fCol = self.fgcolor
|
||||||
if(text:len()<=0)then text = showingText bCol = defaultBGCol or bCol fCol = defaultFGCol or fCol end
|
local text
|
||||||
|
if(val:len()<=0)then text = showingText bCol = defaultBGCol or bCol fCol = defaultFGCol or fCol end
|
||||||
|
|
||||||
local text = showingText
|
text = showingText
|
||||||
if(val~="")then
|
if(val~="")then
|
||||||
text = val
|
text = val
|
||||||
end
|
end
|
||||||
text = text:sub(wIndex, self.w+wIndex-1)
|
text = text:sub(wIndex, self.w+wIndex-1)
|
||||||
local space = self.w-text:len()
|
local space = self.w-text:len()
|
||||||
if(space<0)then space = 0 end
|
if(space<0)then space = 0 end
|
||||||
|
if(inputType=="password")and(val~="")then
|
||||||
|
text = string.rep("*", text:len())
|
||||||
|
end
|
||||||
text = text..string.rep(" ", space)
|
text = text..string.rep(" ", space)
|
||||||
self.parent:setText(obx, oby+n-1, text)
|
|
||||||
self.parent:writeText(obx, oby+(n-1), text, bCol, fCol)
|
self.parent:writeText(obx, oby+(n-1), text, bCol, fCol)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1910,6 +1907,7 @@ local function Textfield(name)
|
|||||||
if(self.parent~=nil)then
|
if(self.parent~=nil)then
|
||||||
local obx, oby = self:getAnchorPosition()
|
local obx, oby = self:getAnchorPosition()
|
||||||
self.parent:drawBackgroundBox(obx, oby, self.w, self.h, self.bgcolor)
|
self.parent:drawBackgroundBox(obx, oby, self.w, self.h, self.bgcolor)
|
||||||
|
self.parent:drawForegroundBox(obx, oby, self.w, self.h, self.fgcolor)
|
||||||
for n=1, self.h do
|
for n=1, self.h do
|
||||||
local text = ""
|
local text = ""
|
||||||
if(lines[n+hIndex-1]~=nil)then
|
if(lines[n+hIndex-1]~=nil)then
|
||||||
|
|||||||
Reference in New Issue
Block a user