[PR #924] Fix maximum-field-width / background-color for InputField #1076

Open
opened 2026-03-04 01:09:19 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/924
Author: @moson-mo
Created: 11/29/2023
Status: 🔄 Open

Base: masterHead: fix-max-inputfield-width


📝 Commits (2)

  • 6d27cc1 Fix maximum field width for InputField
  • b4533bd Fix background color for InputField

📊 Changes

1 file changed (+4 additions, -2 deletions)

View changed files

📝 inputfield.go (+4 -2)

📄 Description

  • 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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rivo/tview/pull/924 **Author:** [@moson-mo](https://github.com/moson-mo) **Created:** 11/29/2023 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix-max-inputfield-width` --- ### 📝 Commits (2) - [`6d27cc1`](https://github.com/rivo/tview/commit/6d27cc1b1436092abecf0b15b780eb3b0d180ecc) Fix maximum field width for InputField - [`b4533bd`](https://github.com/rivo/tview/commit/b4533bdcc92792b24b74b0a47d4ee6762db0712a) Fix background color for InputField ### 📊 Changes **1 file changed** (+4 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `inputfield.go` (+4 -2) </details> ### 📄 Description * Limit the width to the maximum available width before drawing an `InputField` * Fix background color Before: ![image](https://github.com/rivo/tview/assets/13588013/c2afcdf9-acd0-4234-a6ce-ef0f5012048a) Demo code: ```go 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](https://github.com/rivo/tview/assets/13588013/c66a52c3-4e47-48ef-ba37-2268bc3305ae) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#1076
No description provided.