]> git.lizzy.rs Git - micro.git/blobdiff - internal/display/termwindow.go
Fix weird behavior of JumpToMatchingBrace in some ill cases (#1966)
[micro.git] / internal / display / termwindow.go
index c7d82ecbc9eaf929e4eafdf6eda2ec863804fd86..6c30fa7f36bff26eae5bb5f816b4a638cc597214 100644 (file)
@@ -1,13 +1,12 @@
 package display
 
 import (
-       "unicode/utf8"
-
-       "github.com/zyedidia/micro/internal/buffer"
-       "github.com/zyedidia/micro/internal/config"
-       "github.com/zyedidia/micro/internal/screen"
-       "github.com/zyedidia/micro/internal/shell"
-       "github.com/zyedidia/tcell"
+       "github.com/zyedidia/micro/v2/internal/buffer"
+       "github.com/zyedidia/micro/v2/internal/config"
+       "github.com/zyedidia/micro/v2/internal/screen"
+       "github.com/zyedidia/micro/v2/internal/shell"
+       "github.com/zyedidia/micro/v2/internal/util"
+       "github.com/zyedidia/tcell/v2"
        "github.com/zyedidia/terminal"
 )
 
@@ -82,7 +81,7 @@ func (w *TermWindow) Display() {
                        if b == terminal.DefaultBG {
                                bg = int(tcell.ColorDefault)
                        }
-                       st := tcell.StyleDefault.Foreground(config.GetColor256(int(fg))).Background(config.GetColor256(int(bg)))
+                       st := tcell.StyleDefault.Foreground(config.GetColor256(fg)).Background(config.GetColor256(bg))
 
                        if l.LessThan(w.Selection[1]) && l.GreaterEqual(w.Selection[0]) || l.LessThan(w.Selection[0]) && l.GreaterEqual(w.Selection[1]) {
                                st = st.Reverse(true)
@@ -98,12 +97,12 @@ func (w *TermWindow) Display() {
                }
 
                text := []byte(w.Name())
-               textLen := utf8.RuneCount(text)
+               textLen := util.CharacterCount(text)
                for x := 0; x < w.Width; x++ {
                        if x < textLen {
-                               r, size := utf8.DecodeRune(text)
+                               r, combc, size := util.DecodeCharacter(text)
                                text = text[size:]
-                               screen.SetContent(w.X+x, w.Y+w.Height, r, nil, statusLineStyle)
+                               screen.SetContent(w.X+x, w.Y+w.Height, r, combc, statusLineStyle)
                        } else {
                                screen.SetContent(w.X+x, w.Y+w.Height, ' ', nil, statusLineStyle)
                        }