fixed buffer rendering bug

this bug was causing the editor to crash when the command palette is
opened if there are no buffers open.
This commit is contained in:
Felix Angell 2018-08-09 22:18:17 +01:00
parent 454068ff05
commit 9777cb0336
2 changed files with 4 additions and 2 deletions

View File

@ -1398,8 +1398,10 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
for lineNum, rope := range b.table.Lines[start:upper] {
currLine := []rune(rope.String())
// slice the visible characters only.
currLine = currLine[:min(visibleChars, len(currLine))]
if visibleChars >= 0 {
// slice the visible characters only.
currLine = currLine[:min(visibleChars, len(currLine))]
}
// char index => colour
var matches map[int]syntaxRuneInfo

0
foo Normal file
View File