From b9ed68644a151e486dcffdd830faafa7e9f5610b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 22:29:28 +0000 Subject: [PATCH] Update config, LuaLS definitions, bundle and changelog --- config.lua | 680 ++++++++++++++++++++++----------------------- release/basalt.lua | 67 ++--- 2 files changed, 374 insertions(+), 373 deletions(-) diff --git a/config.lua b/config.lua index 339c1b1..bcca84f 100644 --- a/config.lua +++ b/config.lua @@ -1,361 +1,361 @@ return { - ["metadata"] = { - ["generated"] = "Tue Feb 25 11:22:48 2025", - ["version"] = "2.0", - }, ["categories"] = { - ["libraries"] = { - ["description"] = "Libraries", - ["files"] = { - ["utils"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "libraries/utils.lua", - ["size"] = 2661, - ["default"] = true, - }, - ["colorHex"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "libraries/colorHex.lua", - ["size"] = 132, - ["default"] = true, - }, - ["expect"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "libraries/expect.lua", - ["size"] = 880, - ["default"] = true, - }, - }, - }, - ["plugins"] = { - ["description"] = "Plugins", - ["files"] = { - ["state"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/state.lua", - ["size"] = 5867, - ["default"] = true, - }, - ["theme"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/theme.lua", - ["size"] = 5885, - ["default"] = true, - }, - ["xml"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/xml.lua", - ["size"] = 6389, - ["default"] = true, - }, - ["benchmark"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/benchmark.lua", - ["size"] = 12515, - ["default"] = true, - }, - ["animation"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/animation.lua", - ["size"] = 14116, - ["default"] = true, - }, - ["reactive"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/reactive.lua", - ["size"] = 6962, - ["default"] = true, - }, - ["debug"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "plugins/debug.lua", - ["size"] = 6175, - ["default"] = true, - }, - }, - }, - ["elements"] = { - ["description"] = "UI Elements", - ["files"] = { - ["List"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "A scrollable list of selectable items", - ["path"] = "elements/List.lua", - ["size"] = 8302, - ["default"] = true, - }, - ["BigFont"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/BigFont.lua", - ["size"] = 20332, - ["default"] = false, - }, - ["Menu"] = { - ["requires"] = { - [1] = "List", - }, - ["description"] = "A horizontal menu bar with selectable items.", - ["path"] = "elements/Menu.lua", - ["size"] = 4658, - ["default"] = true, - }, - ["Image"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "An element that displays an image in bimg format", - ["path"] = "elements/Image.lua", - ["size"] = 6593, - ["default"] = false, - }, - ["Tree"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Tree.lua", - ["size"] = 7887, - ["default"] = true, - }, - ["BaseFrame"] = { - ["requires"] = { - [1] = "Container", - }, - ["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.", - ["path"] = "elements/BaseFrame.lua", - ["size"] = 5248, - ["default"] = true, - }, - ["Flexbox"] = { - ["requires"] = { - [1] = "Container", - }, - ["description"] = "A flexbox container that arranges its children in a flexible layout.", - ["path"] = "elements/Flexbox.lua", - ["size"] = 11530, - ["default"] = true, - }, - ["Scrollbar"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Scrollbar.lua", - ["size"] = 9166, - ["default"] = true, - }, - ["Dropdown"] = { - ["requires"] = { - [1] = "List", - }, - ["description"] = "A dropdown menu that shows a list of selectable items", - ["path"] = "elements/Dropdown.lua", - ["size"] = 5896, - ["default"] = false, - }, - ["Frame"] = { - ["requires"] = { - [1] = "Container", - }, - ["description"] = "A frame element that serves as a grouping container for other elements.", - ["path"] = "elements/Frame.lua", - ["size"] = 4296, - ["default"] = true, - }, - ["VisualElement"] = { - ["requires"] = { - [1] = "BaseElement", - }, - ["description"] = "The Visual Element class which is the base class for all visual UI elements", - ["path"] = "elements/VisualElement.lua", - ["size"] = 16058, - ["default"] = true, - }, - ["BaseElement"] = { - ["requires"] = { - }, - ["description"] = "The base class for all UI elements in Basalt.", - ["path"] = "elements/BaseElement.lua", - ["size"] = 8488, - ["default"] = true, - }, - ["Label"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "A simple text display element that automatically resizes its width based on the text content.", - ["path"] = "elements/Label.lua", - ["size"] = 2948, - ["default"] = true, - }, - ["Button"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Button.lua", - ["size"] = 1632, - ["default"] = true, - }, - ["Program"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Program.lua", - ["size"] = 6522, - ["default"] = true, - }, - ["Container"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers", - ["path"] = "elements/Container.lua", - ["size"] = 22610, - ["default"] = true, - }, - ["Table"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Table.lua", - ["size"] = 7589, - ["default"] = true, - }, - ["Slider"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Slider.lua", - ["size"] = 4678, - ["default"] = true, - }, - ["Input"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "A text input field with various features", - ["path"] = "elements/Input.lua", - ["size"] = 7057, - ["default"] = true, - }, - ["Checkbox"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/Checkbox.lua", - ["size"] = 2872, - ["default"] = true, - }, - ["ProgressBar"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "", - ["path"] = "elements/ProgressBar.lua", - ["size"] = 2273, - ["default"] = true, - }, - ["TextBox"] = { - ["requires"] = { - [1] = "VisualElement", - }, - ["description"] = "A multi-line text editor component with cursor support and text manipulation features", - ["path"] = "elements/TextBox.lua", - ["size"] = 10905, - ["default"] = false, - }, - }, - }, ["core"] = { - ["description"] = "Core Files", ["files"] = { - ["init"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "init.lua", - ["size"] = 519, - ["default"] = true, - }, ["elementManager"] = { - ["requires"] = { - }, - ["description"] = "", ["path"] = "elementManager.lua", + ["description"] = "", ["size"] = 6297, - ["default"] = true, - }, - ["render"] = { ["requires"] = { }, - ["description"] = "", - ["path"] = "render.lua", - ["size"] = 10935, - ["default"] = true, - }, - ["propertySystem"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "propertySystem.lua", - ["size"] = 15220, - ["default"] = true, - }, - ["errorManager"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "errorManager.lua", - ["size"] = 3789, - ["default"] = true, - }, - ["log"] = { - ["requires"] = { - }, - ["description"] = "", - ["path"] = "log.lua", - ["size"] = 3142, ["default"] = true, }, ["main"] = { + ["path"] = "main.lua", + ["description"] = "", + ["size"] = 7849, ["requires"] = { }, + ["default"] = true, + }, + ["errorManager"] = { + ["path"] = "errorManager.lua", ["description"] = "", - ["path"] = "main.lua", - ["size"] = 7849, + ["size"] = 3789, + ["requires"] = { + }, + ["default"] = true, + }, + ["propertySystem"] = { + ["path"] = "propertySystem.lua", + ["description"] = "", + ["size"] = 15220, + ["requires"] = { + }, + ["default"] = true, + }, + ["log"] = { + ["path"] = "log.lua", + ["description"] = "", + ["size"] = 3142, + ["requires"] = { + }, + ["default"] = true, + }, + ["init"] = { + ["path"] = "init.lua", + ["description"] = "", + ["size"] = 519, + ["requires"] = { + }, + ["default"] = true, + }, + ["render"] = { + ["path"] = "render.lua", + ["description"] = "", + ["size"] = 10935, + ["requires"] = { + }, ["default"] = true, }, }, + ["description"] = "Core Files", + }, + ["plugins"] = { + ["files"] = { + ["animation"] = { + ["path"] = "plugins/animation.lua", + ["description"] = "", + ["size"] = 14116, + ["requires"] = { + }, + ["default"] = true, + }, + ["reactive"] = { + ["path"] = "plugins/reactive.lua", + ["description"] = "", + ["size"] = 6962, + ["requires"] = { + }, + ["default"] = true, + }, + ["state"] = { + ["path"] = "plugins/state.lua", + ["description"] = "", + ["size"] = 5867, + ["requires"] = { + }, + ["default"] = true, + }, + ["debug"] = { + ["path"] = "plugins/debug.lua", + ["description"] = "", + ["size"] = 6175, + ["requires"] = { + }, + ["default"] = true, + }, + ["theme"] = { + ["path"] = "plugins/theme.lua", + ["description"] = "", + ["size"] = 5885, + ["requires"] = { + }, + ["default"] = true, + }, + ["xml"] = { + ["path"] = "plugins/xml.lua", + ["description"] = "", + ["size"] = 6389, + ["requires"] = { + }, + ["default"] = true, + }, + ["benchmark"] = { + ["path"] = "plugins/benchmark.lua", + ["description"] = "", + ["size"] = 12515, + ["requires"] = { + }, + ["default"] = true, + }, + }, + ["description"] = "Plugins", + }, + ["libraries"] = { + ["files"] = { + ["colorHex"] = { + ["path"] = "libraries/colorHex.lua", + ["description"] = "", + ["size"] = 132, + ["requires"] = { + }, + ["default"] = true, + }, + ["expect"] = { + ["path"] = "libraries/expect.lua", + ["description"] = "", + ["size"] = 880, + ["requires"] = { + }, + ["default"] = true, + }, + ["utils"] = { + ["path"] = "libraries/utils.lua", + ["description"] = "", + ["size"] = 2661, + ["requires"] = { + }, + ["default"] = true, + }, + }, + ["description"] = "Libraries", + }, + ["elements"] = { + ["files"] = { + ["List"] = { + ["path"] = "elements/List.lua", + ["description"] = "A scrollable list of selectable items", + ["size"] = 8302, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Table"] = { + ["path"] = "elements/Table.lua", + ["description"] = "", + ["size"] = 7589, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["BaseFrame"] = { + ["path"] = "elements/BaseFrame.lua", + ["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.", + ["size"] = 5248, + ["requires"] = { + [1] = "Container", + }, + ["default"] = true, + }, + ["TextBox"] = { + ["path"] = "elements/TextBox.lua", + ["description"] = "A multi-line text editor component with cursor support and text manipulation features", + ["size"] = 10905, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = false, + }, + ["VisualElement"] = { + ["path"] = "elements/VisualElement.lua", + ["description"] = "The Visual Element class which is the base class for all visual UI elements", + ["size"] = 15984, + ["requires"] = { + [1] = "BaseElement", + }, + ["default"] = true, + }, + ["ProgressBar"] = { + ["path"] = "elements/ProgressBar.lua", + ["description"] = "", + ["size"] = 2273, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Input"] = { + ["path"] = "elements/Input.lua", + ["description"] = "A text input field with various features", + ["size"] = 7219, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Slider"] = { + ["path"] = "elements/Slider.lua", + ["description"] = "", + ["size"] = 4678, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Menu"] = { + ["path"] = "elements/Menu.lua", + ["description"] = "A horizontal menu bar with selectable items.", + ["size"] = 4658, + ["requires"] = { + [1] = "List", + }, + ["default"] = true, + }, + ["BaseElement"] = { + ["path"] = "elements/BaseElement.lua", + ["description"] = "The base class for all UI elements in Basalt.", + ["size"] = 8488, + ["requires"] = { + }, + ["default"] = true, + }, + ["Program"] = { + ["path"] = "elements/Program.lua", + ["description"] = "", + ["size"] = 6295, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Scrollbar"] = { + ["path"] = "elements/Scrollbar.lua", + ["description"] = "", + ["size"] = 9166, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Image"] = { + ["path"] = "elements/Image.lua", + ["description"] = "An element that displays an image in bimg format", + ["size"] = 6593, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = false, + }, + ["Checkbox"] = { + ["path"] = "elements/Checkbox.lua", + ["description"] = "", + ["size"] = 2872, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Tree"] = { + ["path"] = "elements/Tree.lua", + ["description"] = "", + ["size"] = 7887, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Frame"] = { + ["path"] = "elements/Frame.lua", + ["description"] = "A frame element that serves as a grouping container for other elements.", + ["size"] = 4291, + ["requires"] = { + [1] = "Container", + }, + ["default"] = true, + }, + ["Label"] = { + ["path"] = "elements/Label.lua", + ["description"] = "A simple text display element that automatically resizes its width based on the text content.", + ["size"] = 2948, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["BigFont"] = { + ["path"] = "elements/BigFont.lua", + ["description"] = "", + ["size"] = 20332, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = false, + }, + ["Container"] = { + ["path"] = "elements/Container.lua", + ["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers", + ["size"] = 22866, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + ["Dropdown"] = { + ["path"] = "elements/Dropdown.lua", + ["description"] = "A dropdown menu that shows a list of selectable items", + ["size"] = 5896, + ["requires"] = { + [1] = "List", + }, + ["default"] = false, + }, + ["Flexbox"] = { + ["path"] = "elements/Flexbox.lua", + ["description"] = "A flexbox container that arranges its children in a flexible layout.", + ["size"] = 11530, + ["requires"] = { + [1] = "Container", + }, + ["default"] = true, + }, + ["Button"] = { + ["path"] = "elements/Button.lua", + ["description"] = "", + ["size"] = 1632, + ["requires"] = { + [1] = "VisualElement", + }, + ["default"] = true, + }, + }, + ["description"] = "UI Elements", }, }, + ["metadata"] = { + ["version"] = "2.0", + ["generated"] = "Tue Feb 25 22:29:23 2025", + }, } \ No newline at end of file diff --git a/release/basalt.lua b/release/basalt.lua index 8a892d2..38dd1ef 100644 --- a/release/basalt.lua +++ b/release/basalt.lua @@ -896,22 +896,23 @@ function ca:mouse_click(da,_b,ab) if (aa.mouse_click(self,da,_b,ab))then local bb,cb=self:getRelativePosition(_b,ab) local db=self.get("draggingMap") -for _c,ac in ipairs(db)do local bc=ac.width;local cc=ac.height or 1;if type(bc)=="string"and -bc=="width"then bc=self.get("width")elseif type(bc)=="function"then -bc=bc(self)end;if type(cc)=="string"and cc== -"height"then cc=self.get("height")elseif -type(cc)=="function"then cc=cc(self)end -local dc=ac.y or 1 -if bb>=ac.x and bb<=ac.x+bc-1 and cb>=dc and -cb<=dc+cc-1 then self.dragStartX=_b-self.get("x")self.dragStartY= -ab-self.get("y")self.dragging=true;return true end end;return ba.mouse_click(self,da,_b,ab)end end +for _c,ac in ipairs(db)do local bc=ac.width or 1;local cc=ac.height or 1;if +type(bc)=="string"and bc=="width"then bc=self.get("width")elseif +type(bc)=="function"then bc=bc(self)end +if type(cc)== +"string"and cc=="height"then cc=self.get("height")elseif +type(cc)=="function"then cc=cc(self)end;local dc=ac.y or 1 +if +bb>=ac.x and bb<=ac.x+bc-1 and cb>=dc and cb<=dc+cc-1 then +self.dragStartX=_b-self.get("x")self.dragStartY=ab-self.get("y")self.dragging=true +return true end end;return ba.mouse_click(self,da,_b,ab)end end function ca:mouse_drag(da,_b,ab) if self.get("clicked")and self.dragging then local bb=_b-self.dragStartX;local cb=ab-self.dragStartY;self.set("x",bb) self.set("y",cb)return true end if not self.dragging then return ba.mouse_drag(self,da,_b,ab)end;return false end -function ca:mouse_release(da,_b,ab)self.dragging=false;self.dragStartX=nil;self.dragStartY=nil;return -ba.mouse_release(self,da,_b,ab)end;return ca end +function ca:mouse_up(da,_b,ab)self.dragging=false;self.dragStartX=nil;self.dragStartY=nil;return +ba.mouse_up(self,da,_b,ab)end;return ca end project["elements/Button.lua"] = function(...) local _a=require("elementManager") local aa=_a.getElement("VisualElement") local ba=require("libraries/utils").getCenteredPosition;local ca=setmetatable({},aa)ca.__index=ca @@ -929,10 +930,7 @@ local ca=ba.getElement("VisualElement")local da=require("errorManager")local _b= _b.__index=_b _b.defineProperty(_b,"program",{default=nil,type="table"}) _b.defineProperty(_b,"path",{default="",type="string"}) -_b.defineProperty(_b,"running",{default=false,type="boolean"})_b.defineEvent(_b,"key")_b.defineEvent(_b,"char") -_b.defineEvent(_b,"key_up")_b.defineEvent(_b,"paste") -_b.defineEvent(_b,"mouse_click")_b.defineEvent(_b,"mouse_drag") -_b.defineEvent(_b,"mouse_scroll")_b.defineEvent(_b,"mouse_up")local ab={}ab.__index=ab +_b.defineProperty(_b,"running",{default=false,type="boolean"})_b.defineEvent(_b,"*")local ab={}ab.__index=ab local bb=dofile("rom/modules/main/cc/require.lua").make function ab.new()local cb=setmetatable({},ab)cb.env={}cb.args={}return cb end function ab:run(cb,db,_c) @@ -967,14 +965,14 @@ local db=ab.new()self.set("program",db) db:run(cb,self.get("width"),self.get("height"))self:updateRender()return self end function _b:dispatchEvent(cb,...)local db=self.get("program") local _c=ca.dispatchEvent(self,cb,...) -if db then db:resume(cb,...)if(self.get("focused"))then +if db then db:resume(cb,...) +if(self.get("focused"))then local ac=db.window.getCursorBlink()local bc,cc=db.window.getCursorPos() -self:setCursor(bc,cc,ac)end -self:updateRender()end;return _c end +self:setCursor(bc,cc,ac,db.window.getTextColor())end;self:updateRender()end;return _c end function _b:focus() if(ca.focus(self))then local cb=self.get("program")if cb then local db=cb.window.getCursorBlink()local _c,ac=cb.window.getCursorPos() -self:setCursor(_c,ac,db)end end end +self:setCursor(_c,ac,db,cb.window.getTextColor())end end end function _b:render()ca.render(self)local cb=self.get("program") if cb then local db,_c=cb.window.getSize()for y=1,_c do local ac,bc,cc=cb.window.getLine(y)if ac then @@ -1228,6 +1226,8 @@ function bb:callChildrenEvent(_c,ac,...)local bc=_c and self.get("visibleChildre self.get("childrenEvents") if bc[ac]then local cc=bc[ac]for i=#cc,1,-1 do local dc=cc[i] +if(dc:dispatchEvent(ac,...))then return true,dc end end end +if(bc["*"])then local cc=bc["*"]for i=#cc,1,-1 do local dc=cc[i] if(dc:dispatchEvent(ac,...))then return true,dc end end end;return false end function bb:handleEvent(_c,...)da.handleEvent(self,_c,...)local ac=db(self,_c,...)return self:callChildrenEvent(false,_c,table.unpack(ac))end @@ -1421,12 +1421,16 @@ aa.defineEvent(aa,"key")aa.defineEvent(aa,"char") function aa.new() local ba=setmetatable({},aa):__init()ba.set("width",8)ba.set("z",3)return ba end function aa:init(ba,ca)d.init(self,ba,ca)self.set("type","Input")return self end +function aa:setCursor(ba,ca,da,_b) +ba=math.min(self.get("width"),math.max(1,ba))return d.setCursor(self,ba,ca,da,_b)end function aa:char(ba)if not self.get("focused")then return false end local ca=self.get("text")local da=self.get("cursorPos")local _b=self.get("maxLength") local ab=self.get("pattern")if _b and#ca>=_b then return end if ab and not ba:match(ab)then return end -self.set("text",ca:sub(1,da-1)..ba..ca:sub(da))self.set("cursorPos",da+1)self:updateRender() -self:updateViewport()return true end +self.set("text",ca:sub(1,da-1)..ba..ca:sub(da))self.set("cursorPos",da+1)self:updateViewport()local bb= +self.get("cursorPos")-self.get("viewOffset") +self:setCursor(bb,1,true, +self.get("cursorColor")or self.get("foreground"))return true end function aa:key(ba)if not self.get("focused")then return false end local ca=self.get("cursorPos")local da=self.get("text")local _b=self.get("viewOffset") local ab=self.get("width") @@ -1440,20 +1444,18 @@ self.set("text",da:sub(1,ca-2)..da:sub(ca))self.set("cursorPos",ca-1)self:update self:updateViewport()end end local bb=self.get("cursorPos")-self.get("viewOffset") self:setCursor(bb,1,true,self.get("cursorColor")or self.get("foreground"))return true end -function aa:focus()d.focus(self)self:updateRender()end -function aa:blur()d.blur(self)self:updateRender()end function aa:mouse_click(ba,ca,da) if d.mouse_click(self,ba,ca,da)then -local _b,ab=self:getRelativePosition(ca,da)local bb=self.get("text") -self:setCursor(math.min(_b,#bb+1),ab,true, -self.get("cursorColor")or self.get("foreground")) -self:set("cursorPos",_b+self.get("viewOffset"))return true end end +local _b,ab=self:getRelativePosition(ca,da)local bb=self.get("text")local cb=self.get("viewOffset") +local db=#bb+1;local _c=math.min(db,cb+_b)self.set("cursorPos",_c) +local ac=_c-cb +self:setCursor(ac,1,true,self.get("cursorColor")or self.get("foreground"))return true end;return false end function aa:updateViewport()local ba=self.get("width") local ca=self.get("cursorPos")local da=self.get("viewOffset") local _b=#self.get("text") -if ca-da>ba then self.set("viewOffset",ca-ba)elseif ca<=da then self.set("viewOffset",math.max(0, -ca-1))end;if da>_b-ba then -self.set("viewOffset",math.max(0,_b-ba))end;return self end +if ca-da>=ba then self.set("viewOffset",ca-ba+1)elseif ca<=da then self.set("viewOffset", +ca-1)end +self.set("viewOffset",math.max(0,math.min(self.get("viewOffset"),_b-ba+1)))return self end function aa:render()local ba=self.get("text")local ca=self.get("viewOffset") local da=self.get("width")local _b=self.get("placeholder") local ab=self.get("focusedColor")local bb=self.get("focused") @@ -1608,9 +1610,8 @@ cb,db=self.get("x"),self.get("y")end;local _c,ac=1,1;if self.parent then _c,ac=self.parent:getRelativePosition()end local bc,cc=self.get("x"),self.get("y")return cb- (bc-1)- (_c-1),db- (cc-1)- (ac-1)end function _b:setCursor(cb,db,_c,ac) -if self.parent then local bc,cc=self:getAbsolutePosition(cb,db) -bc=ab(self.get("x"),bb(bc, -self.get("width")+self.get("x")-1))return self.parent:setCursor(bc,cc,_c,ac)end;return self end +if self.parent then local bc,cc=self:calculatePosition()return self.parent:setCursor( +cb+bc-1,db+cc-1,_c,ac)end;return self end function _b:prioritize() if(self.parent)then local cb=self.parent;cb:removeChild(self) cb:addChild(self)self:updateRender()end;return self end