From 8e6724bdb6ce32ab5abebeba3abecc2e3feaded1 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Wed, 16 Oct 2019 19:24:06 -0400 Subject: [PATCH] refactor viewTitle() to setViewTitle() --- cmdEdit.go | 2 +- cmdJoin.go | 2 +- cmdStream.go | 2 +- main.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmdEdit.go b/cmdEdit.go index cd4fdff..af40142 100644 --- a/cmdEdit.go +++ b/cmdEdit.go @@ -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 { diff --git a/cmdJoin.go b/cmdJoin.go index 1e66613..fa5aee0 100644 --- a/cmdJoin.go +++ b/cmdJoin.go @@ -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 ", cmdPrefix)) diff --git a/cmdStream.go b/cmdStream.go index 9978e6e..ee68867 100644 --- a/cmdStream.go +++ b/cmdStream.go @@ -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") } diff --git a/main.go b/main.go index fbb1493..13dfcc0 100644 --- a/main.go +++ b/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()