Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

moson-mo
Copy link
Contributor

@moson-mo moson-mo commented Nov 29, 2023

  • 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 moson-mo changed the title Fix maximum field width for InputField Fix maximum-field-width / background-color for InputField Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant