rivo / tview

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

fixing #959 textview mouse out of bounds fix #963

Closed digitallyserviced closed 7 months ago

digitallyserviced commented 7 months ago

959 bails if user clicks on border of textview when regions enabled

package main

import (
        "fmt"
        "log"

        "github.com/rivo/tview"
)

func main() {
        tabs := tview.NewTextView().SetRegions(true)
        tabs.SetBorder(true)
                tabs.SetDynamicColors(true)

        myApp := tview.NewApplication()
        myApp.EnableMouse(true)
                // tabs.SetToggleHighlights(true)

        myFlex := tview.NewFlex().SetDirection(tview.FlexRow).
                AddItem(
                        tview.NewFlex().
                                AddItem(tabs, 30, 0, false),
                        5, 0, false,
                )

        fmt.Fprintf(tabs, `
["%s"][white]%s[""]
[red] vv %s vv
["%s"][green]%s[""]
`, "0", "Anything", "Long Text","2","Anythong")

        if err := myApp.SetRoot(myFlex, true).Run(); err != nil {
                log.Fatal(err)
        }
}

Peek 2024-03-28 20-25