diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-24 22:58:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 22:58:30 +0300 |
commit | 7026ed99a3ef4071a35e74d2d5f9026f6848be92 (patch) | |
tree | 33332880db2cbdaeabaeb4e1ddbf94a3f15686a3 /ui/messages | |
parent | 49cd74c548e3baf259fce9270af3ecca5bdb625e (diff) | |
parent | d7d654e2ec0a1d001f936b1575a3e6af3973a874 (diff) |
Merge pull request #33 from tulir/initial-sync
Use initial sync data instead of fetching room list, state, history, etc manually
Diffstat (limited to 'ui/messages')
-rw-r--r-- | ui/messages/textbase.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ui/messages/textbase.go b/ui/messages/textbase.go index 0960a57..f44d5d5 100644 --- a/ui/messages/textbase.go +++ b/ui/messages/textbase.go @@ -72,8 +72,18 @@ 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]] + if len(matches) == 0 { + continue + } + + match := matches[len(matches)-1] + if len(match) < 2 { + continue + } + + until := match[1] + if until < len(extract) { + extract = extract[:until] } } msg.buffer = append(msg.buffer, extract) |