summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Burke <rich.g.burke@gmail.com>2019-04-28 18:58:45 +0100
committerRichard Burke <rich.g.burke@gmail.com>2019-04-28 18:58:45 +0100
commit48320a6077a2ab55caa5b6edc56ce606e646f848 (patch)
tree4e71d5d8eb41d5fef7aea2ca6bbdf8113abaa1c4
parent0a5a94030aba8ef13a1b33b0e46d85a04519b61b (diff)
Only Sprintf text added to window when args are provided
-rw-r--r--cmd/grv/window.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/grv/window.go b/cmd/grv/window.go
index 35cb93e..238865a 100644
--- a/cmd/grv/window.go
+++ b/cmd/grv/window.go
@@ -235,10 +235,15 @@ func (lineBuilder *LineBuilder) Append(format string, args ...interface{}) *Line
// AppendWithStyle adds the provided text with style information to the end of the line
func (lineBuilder *LineBuilder) AppendWithStyle(themeComponentID ThemeComponentID, format string, args ...interface{}) *LineBuilder {
- str := fmt.Sprintf(format, args...)
line := lineBuilder.line
+ var text string
+ if len(args) > 0 {
+ text = fmt.Sprintf(format, args...)
+ } else {
+ text = format
+ }
- for _, codePoint := range str {
+ for _, codePoint := range text {
renderedCodePoints := DetermineRenderedCodePoint(codePoint, lineBuilder.column, lineBuilder.config)
for _, renderedCodePoint := range renderedCodePoints {