Pyroxenium / Basalt

A UI Framework for CC:Tweaked
MIT License
164 stars 28 forks source link

bug: Calling `removeLine()` to empty `Textfield` deforms the first line of the `Textfield`'s box #33

Closed luiz00martins closed 1 year ago

luiz00martins commented 1 year ago

Minimal Working Example

image

local filePath = "/basalt.lua"
if not(fs.exists(filePath))then
    shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", ""))
end
local basalt = require(filePath:gsub(".lua", ""))

local main = basalt.createFrame("mainFrame")

-- This is fine.
local textfield_0 = main:addTextfield('textfield_0')
    :setPosition(1, 1)
    :setSize(20, 3)
    -- two addLine
    :addLine('Value')
    :addLine('Another Value')
    -- no removeLine

-- This is fine.
local textfield_1 = main:addTextfield('textfield_1')
    :setPosition(1, 5)
    :setSize(20, 3)
    -- two addLine
    :addLine('Value')
    :addLine('Another Value')
    -- one removeLine
    :removeLine()

-- This gets deformed.
local textfield_2 = main:addTextfield('textfield_2')
    :setPosition(1, 9)
    :setSize(20, 3)
    -- two addLine
    :addLine('Value')
    :addLine('Another Value')
    -- two removeLine
    :removeLine()
    :removeLine()

basalt.autoUpdate()

As seen in the MWE above, textfield_2 gets deformed by the second call to removeLine().

Expected behavior

The Textfield maintains its shape.

image

Checklist

[X] I am running the latest version.

NoryiE commented 1 year ago

Thank you very much, i will work on that in the weekend!

NoryiE commented 1 year ago

Hey, i fixed this issue here: f8232d6 - right now its only available in the dev branch and will take a while to be in the release branch. Here's a shell command for downloading the most recent dev branch:

wget run https://basalt.madefor.cc/install.lua packed basalt.lua dev