refactor viewTitle() to setViewTitle()
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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")
|
||||
}
|
||||
|
||||
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 {
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user