[GH-ISSUE #915] InputField in Form: Cursor is at the beginning of InputField and not movable when initial text is set #664

Closed
opened 2026-03-04 01:06:53 +03:00 by kerem · 1 comment
Owner

Originally created by @elsni on GitHub (Nov 10, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/915

When I show a form contraining an InputField with some text, the cursor is at the beginning of the InputField an can't be moved by the arrow keys. You need to type "arrow up" first, then the cursor can be moved as expected.
I would expect that the cursor is at the end of the preset text, so it can be edited easily.

This is the code:

func TestForm() {
	app := tview.NewApplication()
	form := tview.NewForm().
		AddInputField("Name", "Test", 40, nil, nil)
	form.AddButton("Quit", func() {
		app.Stop()
	})
	form.SetRect(0, 0, 56, 6)
	if err := app.SetRoot(form, false).SetFocus(form).EnableMouse(true).Run(); err != nil {
		panic(err)
	}
}

Originally created by @elsni on GitHub (Nov 10, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/915 When I show a form contraining an InputField with some text, the cursor is at the beginning of the InputField an can't be moved by the arrow keys. You need to type "arrow up" first, then the cursor can be moved as expected. I would expect that the cursor is at the end of the preset text, so it can be edited easily. This is the code: ``` func TestForm() { app := tview.NewApplication() form := tview.NewForm(). AddInputField("Name", "Test", 40, nil, nil) form.AddButton("Quit", func() { app.Stop() }) form.SetRect(0, 0, 56, 6) if err := app.SetRoot(form, false).SetFocus(form).EnableMouse(true).Run(); err != nil { panic(err) } } ```
kerem closed this issue 2026-03-04 01:06:53 +03:00
Author
Owner

@rivo commented on GitHub (Nov 13, 2023):

Thanks for reporting this. The latest commit should fix this, i.e. the cursor will be initialized to be at the end of the text.

<!-- gh-comment-id:1807551835 --> @rivo commented on GitHub (Nov 13, 2023): Thanks for reporting this. The latest commit should fix this, i.e. the cursor will be initialized to be at the end of the text.
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#664
No description provided.