rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang
MIT License
11.17k stars 574 forks source link

add setdontclear for cases where padding and borders on primitives #860

Open digitallyserviced opened 1 year ago

digitallyserviced commented 1 year ago

some primitives set Box.dontClear = true which screws up padding/borders that arent including a bg color in Flex and i believe Frame/Table. it definitely should be available outside regardless... it is not just here it becomes an issue. This is why it is included in my fork https://github.com/rivo/tview/compare/master...digitallyserviced:tview:master

This is in reference to #833

For a flex there should be no reason you need to sest a item as a Box instead of nil just to get the BG color. It also doesn't solve padding issues.


    layoutCol2 := tview.NewFlex().
        SetDirection(tview.FlexRow).
        AddItem(identificationTextview, 3, 0, false).
        AddItem(valueInput, 1, 0, false).
        AddItem(detailsTextview, 6, 0, false)
    layoutCol2.SetBorder(true)
    layoutCol2.SetBorderPadding(0, 0, 1, 1)

    // re-enable dontClear for this padding on a flex
    layoutCol2.SetDontClear(false)