summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-03-19 12:14:26 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-03-19 12:14:26 +0900
commit3dddbfd8fa45283b93c06f4263a30dfe6f7055f5 (patch)
treef32cf5abaee2d4805933980e7e46957196bd1606 /src
parente70a2a5817586e4e7df0ee1446f609bbd859164a (diff)
Fix string truncation
Diffstat (limited to 'src')
-rw-r--r--src/terminal.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/terminal.go b/src/terminal.go
index 9402ef2d..ea0e8264 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -333,10 +333,8 @@ func (*Terminal) printHighlighted(item *Item, bold bool, col1 int, col2 int, cur
b += 2 - diff
e += 2 - diff
b = util.Max32(b, 2)
- if b < e {
- offsets[idx].offset[0] = b
- offsets[idx].offset[1] = e
- }
+ offsets[idx].offset[0] = b
+ offsets[idx].offset[1] = util.Max32(b, e)
}
text = append([]rune(".."), text...)
}
@@ -353,8 +351,10 @@ func (*Terminal) printHighlighted(item *Item, bold bool, col1 int, col2 int, cur
substr, prefixWidth = processTabs(text[index:b], prefixWidth)
C.CPrint(col1, bold, substr)
- substr, prefixWidth = processTabs(text[b:e], prefixWidth)
- C.CPrint(offset.color, bold, substr)
+ if b < e {
+ substr, prefixWidth = processTabs(text[b:e], prefixWidth)
+ C.CPrint(offset.color, bold, substr)
+ }
index = e
if index >= maxOffset {