First of all I would like to thank you for this wonderful library.
Recently I updated to the latest release 20240818110301-fd649dbf1223 from the previous one 20230325211341-281d14d896d7.
And I've encountered a strange behaviour with the InputField.SetText method in the latest version. If I take the InputField demo and add 2 consecutive SetText("12"), the resulting input field text contains the string "1212". So the second SetText had the effect of appending the string instead to the current text field of replacing it. While in the previous version, I encountered the behaviour I would expect. The second SetText replaced the string.
I leave the code below and a screenshot of what I get
// Demo code for the InputField primitive.
package main
import (
"github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
func main() {
app := tview.NewApplication()
inputField := tview.NewInputField().
SetLabel("Enter a number: ").
SetPlaceholder("E.g. 1234").
SetFieldWidth(10).
SetAcceptanceFunc(tview.InputFieldInteger).
SetDoneFunc(func(key tcell.Key) {
app.Stop()
})
inputField.SetText("12")
inputField.SetText("12")
if err := app.SetRoot(inputField, true).EnableMouse(true).Run(); err != nil {
panic(err)
}
}
Latest version:
Previous version:
I will keep looking to see if I find the cause of this change of behaviour, but maybe you can spot the problem faster than me.
Hello,
First of all I would like to thank you for this wonderful library.
Recently I updated to the latest release 20240818110301-fd649dbf1223 from the previous one 20230325211341-281d14d896d7.
And I've encountered a strange behaviour with the InputField.SetText method in the latest version. If I take the InputField demo and add 2 consecutive SetText("12"), the resulting input field text contains the string "1212". So the second SetText had the effect of appending the string instead to the current text field of replacing it. While in the previous version, I encountered the behaviour I would expect. The second SetText replaced the string.
I leave the code below and a screenshot of what I get
Latest version:
Previous version:
I will keep looking to see if I find the cause of this change of behaviour, but maybe you can spot the problem faster than me.
Thank you for your support