Browse Source

refactor viewTitle() to setViewTitle()

pull/22/head
Gregory Rudolph 5 years ago
parent
commit
8e6724bdb6
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 2
      cmdEdit.go
  2. 2
      cmdJoin.go
  3. 2
      cmdStream.go
  4. 6
      main.go

2
cmdEdit.go

@ -42,7 +42,7 @@ func cmdEdit(cmd []string) { @@ -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 {

2
cmdJoin.go

@ -43,7 +43,7 @@ func cmdJoin(cmd []string) { @@ -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))

2
cmdStream.go

@ -18,6 +18,6 @@ func cmdStream(cmd []string) { @@ -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

@ -52,7 +52,7 @@ func main() { @@ -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 { @@ -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 { @@ -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()

Loading…
Cancel
Save