mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 13:17:23 +00:00
changed handleTab() to accomodate viewName
This commit is contained in:
2
main.go
2
main.go
@ -137,7 +137,7 @@ func initKeybindings() error {
|
|||||||
}
|
}
|
||||||
if err := g.SetKeybinding("Input", gocui.KeyTab, gocui.ModNone,
|
if err := g.SetKeybinding("Input", gocui.KeyTab, gocui.ModNone,
|
||||||
func(g *gocui.Gui, v *gocui.View) error {
|
func(g *gocui.Gui, v *gocui.View) error {
|
||||||
return handleTab()
|
return handleTab("Input")
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// This defines the handleTab function thats called by key bindind tab for the input control.
|
// This defines the handleTab function thats called by key bindind tab for the input control.
|
||||||
func handleTab() error {
|
func handleTab(viewName string) error {
|
||||||
inputString, err := getInputString("Input")
|
inputString, err := getInputString(viewName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
@ -48,9 +48,9 @@ func handleTab() error {
|
|||||||
} else if rLen > 5 {
|
} else if rLen > 5 {
|
||||||
newViewTitle = fmt.Sprintf("%s|| %s +%d more", originalViewTitle, strings.Join(resultSlice[:6], " "), rLen-5)
|
newViewTitle = fmt.Sprintf("%s|| %s +%d more", originalViewTitle, strings.Join(resultSlice[:6], " "), rLen-5)
|
||||||
}
|
}
|
||||||
setViewTitle("Input", newViewTitle)
|
setViewTitle(viewName, newViewTitle)
|
||||||
remainder := stringRemainder(s, lcp)
|
remainder := stringRemainder(s, lcp)
|
||||||
writeToView("Input", remainder)
|
writeToView(viewName, remainder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user