diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-24 16:51:40 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-24 16:51:40 +0300 |
commit | e64df67ec397795b8c6ebd06b391d953afe5a766 (patch) | |
tree | 52cbb9d3d02ec1e89d0de09a05d343408c7d4aba /ui/messages | |
parent | fcd9a932cb5542ed8980fc1daba7ee1f0041a3f2 (diff) |
Everything is no longer broken
Diffstat (limited to 'ui/messages')
-rw-r--r-- | ui/messages/textbase.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/messages/textbase.go b/ui/messages/textbase.go index 0960a57..79913f8 100644 --- a/ui/messages/textbase.go +++ b/ui/messages/textbase.go @@ -73,7 +73,13 @@ func (msg *BaseTextMessage) calculateBufferWithText(text tstring.TString, width matches := boundaryPattern.FindAllStringIndex(extract.String(), -1) if len(matches) > 0 { - extract = extract[:matches[len(matches)-1][1]] + match := matches[len(matches)-1] + if len(match) > 1 { + until := match[1] + if until < len(extract) { + extract = extract[:until] + } + } } } msg.buffer = append(msg.buffer, extract) |