1
0
mirror of https://github.com/Rudi9719/kbtui.git synced 2026-03-22 08:47:24 +00:00

refactor viewTitle() to setViewTitle()

This commit is contained in:
2019-10-16 19:24:06 -04:00
parent dc52c48d99
commit 8e6724bdb6
4 changed files with 6 additions and 6 deletions

View File

@ -42,7 +42,7 @@ func cmdEdit(cmd []string) {
clearView("Edit")
popupView("Edit")
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
}
if len(cmd) < 3 {

View File

@ -43,7 +43,7 @@ func cmdJoin(cmd []string) {
}
printToView("Feed", fmt.Sprintf("You are joining: %s", joinedName))
clearView("Chat")
viewTitle("Input", fmt.Sprintf(" %s ", joinedName))
setViewTitle("Input", fmt.Sprintf(" %s ", joinedName))
go populateChat()
default:
printToView("Feed", fmt.Sprintf("To join a team use %sjoin <team> <channel>", cmdPrefix))

View File

@ -18,6 +18,6 @@ func cmdStream(cmd []string) {
channel.Name = ""
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")
}

View File

@ -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 {
updatingView, err := g.View(viewName)
if err != nil {
@ -381,7 +381,7 @@ func handleTab() error {
} else if 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)
writeToView("Input", remainder)
}
@ -650,7 +650,7 @@ func handleInput(viewName string) error {
}
// restore any tab completion view titles on input commit
if newViewTitle := getViewTitle(viewName); newViewTitle != "" {
viewTitle(viewName, newViewTitle)
setViewTitle(viewName, newViewTitle)
}
go populateList()