mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 12:07:23 +00:00
refactor viewTitle() to setViewTitle()
This commit is contained in:
@ -42,7 +42,7 @@ func cmdEdit(cmd []string) {
|
|||||||
clearView("Edit")
|
clearView("Edit")
|
||||||
popupView("Edit")
|
popupView("Edit")
|
||||||
printToView("Edit", fmt.Sprintf("/e %d %s", messageId, editString))
|
printToView("Edit", fmt.Sprintf("/e %d %s", messageId, editString))
|
||||||
viewTitle("Edit", fmt.Sprintf(" Editing message %d ", messageId))
|
setViewTitle("Edit", fmt.Sprintf(" Editing message %d ", messageId))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(cmd) < 3 {
|
if len(cmd) < 3 {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ func cmdJoin(cmd []string) {
|
|||||||
}
|
}
|
||||||
printToView("Feed", fmt.Sprintf("You are joining: %s", joinedName))
|
printToView("Feed", fmt.Sprintf("You are joining: %s", joinedName))
|
||||||
clearView("Chat")
|
clearView("Chat")
|
||||||
viewTitle("Input", fmt.Sprintf(" %s ", joinedName))
|
setViewTitle("Input", fmt.Sprintf(" %s ", joinedName))
|
||||||
go populateChat()
|
go populateChat()
|
||||||
default:
|
default:
|
||||||
printToView("Feed", fmt.Sprintf("To join a team use %sjoin <team> <channel>", cmdPrefix))
|
printToView("Feed", fmt.Sprintf("To join a team use %sjoin <team> <channel>", cmdPrefix))
|
||||||
|
|||||||
@ -18,6 +18,6 @@ func cmdStream(cmd []string) {
|
|||||||
channel.Name = ""
|
channel.Name = ""
|
||||||
|
|
||||||
printToView("Feed", "You are now viewing the formatted stream")
|
printToView("Feed", "You are now viewing the formatted stream")
|
||||||
viewTitle("Input", " Stream - Not in a chat /j to join ")
|
setViewTitle("Input", " Stream - Not in a chat /j to join ")
|
||||||
clearView("Chat")
|
clearView("Chat")
|
||||||
}
|
}
|
||||||
|
|||||||
6
main.go
6
main.go
@ -52,7 +52,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func viewTitle(viewName string, title string) {
|
func setViewTitle(viewName string, title string) {
|
||||||
g.Update(func(g *gocui.Gui) error {
|
g.Update(func(g *gocui.Gui) error {
|
||||||
updatingView, err := g.View(viewName)
|
updatingView, err := g.View(viewName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -381,7 +381,7 @@ 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)
|
||||||
}
|
}
|
||||||
viewTitle("Input", newViewTitle)
|
setViewTitle("Input", newViewTitle)
|
||||||
remainder := stringRemainder(s, lcp)
|
remainder := stringRemainder(s, lcp)
|
||||||
writeToView("Input", remainder)
|
writeToView("Input", remainder)
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ func handleInput(viewName string) error {
|
|||||||
}
|
}
|
||||||
// restore any tab completion view titles on input commit
|
// restore any tab completion view titles on input commit
|
||||||
if newViewTitle := getViewTitle(viewName); newViewTitle != "" {
|
if newViewTitle := getViewTitle(viewName); newViewTitle != "" {
|
||||||
viewTitle(viewName, newViewTitle)
|
setViewTitle(viewName, newViewTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
go populateList()
|
go populateList()
|
||||||
|
|||||||
Reference in New Issue
Block a user