tview icon indicating copy to clipboard operation
tview copied to clipboard

Fix maximum-field-width / background-color for InputField

Open moson-mo opened this issue 1 year ago • 0 comments

  • Limit the width to the maximum available width before drawing an InputField
  • Fix background color

Before: image

Demo code:

package main

import (
	"github.com/gdamore/tcell/v2"
	"github.com/rivo/tview"
)

func main() {
	app := tview.NewApplication()
	form := tview.NewForm()
	form.AddInputField("test color", "test", 15, nil, nil).
		AddInputField("test width", "test", 1000, nil, nil).
		SetBackgroundColor(tcell.ColorDarkBlue).
		SetBorder(true)
	if err := app.SetRoot(form, true).EnableMouse(true).Run(); err != nil {
		panic(err)
	}
}

After:

image

moson-mo avatar Nov 29 '23 18:11 moson-mo