]> git.lizzy.rs Git - micro.git/commitdiff
use space for indentchar if empty, fixes #660
authoraerth <aerth@riseup.net>
Fri, 12 May 2017 23:32:24 +0000 (16:32 -0700)
committeraerth <aerth@riseup.net>
Fri, 12 May 2017 23:32:24 +0000 (16:32 -0700)
cmd/micro/cellview.go

index 0b5782f8a7c68456ab9b28d95f09eed4e26ddcca..2cab7a0896d05e7e0e99427fa016b883fb853d48 100644 (file)
@@ -67,7 +67,12 @@ type CellView struct {
 func (c *CellView) Draw(buf *Buffer, top, height, left, width int) {
        tabsize := int(buf.Settings["tabsize"].(float64))
        softwrap := buf.Settings["softwrap"].(bool)
-       indentchar := []rune(buf.Settings["indentchar"].(string))[0]
+       indentrunes := []rune(buf.Settings["indentchar"].(string))
+       // if empty indentchar settings, use space
+       if indentrunes == nil || len(indentrunes) == 0 {
+               indentrunes = []rune(" ")
+       }
+       indentchar := indentrunes[0]
 
        start := buf.Cursor.Y
        if buf.Settings["syntax"].(bool) && buf.syntaxDef != nil {