don't edit display charactor

develop
skanehira 5 years ago
parent 36d4114d49
commit 805b6e1745

@ -69,10 +69,10 @@ func (g *Gui) Message(message, page string, doneFunc func()) {
g.Pages.AddAndSwitchToPage("message", g.Modal(modal, 80, 29), true).ShowPage("main")
}
func (g *Gui) Input(text, label string, doneFunc func(text string)) {
func (g *Gui) Input(text, label string, width int, doneFunc func(text string)) {
input := tview.NewInputField().SetText(text)
input.SetBorder(true)
input.SetLabel(label).SetLabelWidth(7).SetDoneFunc(func(key tcell.Key) {
input.SetLabel(label).SetLabelWidth(width).SetDoneFunc(func(key tcell.Key) {
if key == tcell.KeyEnter {
doneFunc(input.GetText())
g.Pages.RemovePage("input")

@ -96,11 +96,12 @@ func (t *Tree) NewNodeWithLiteral(i interface{}) *tview.TreeNode {
func (t *Tree) SetKeybindings(g *Gui) {
t.SetSelectedFunc(func(node *tview.TreeNode) {
nodeType := node.GetReference().(Type)
if nodeType == Root || nodeType == Object {
text := node.GetText()
if text == "{object}" || text == "{array}" || text == "{value}" {
return
}
g.Input(node.GetText(), "filed", func(text string) {
labelWidth := 5
g.Input(text, "text", labelWidth, func(text string) {
node.SetText(text)
})
})

Loading…
Cancel
Save