@@ -2,7 +2,6 @@ package display
22
33import (
44 runewidth "github.com/mattn/go-runewidth"
5- "github.com/micro-editor/tcell/v2"
65 "github.com/zyedidia/micro/v2/internal/buffer"
76 "github.com/zyedidia/micro/v2/internal/config"
87 "github.com/zyedidia/micro/v2/internal/screen"
@@ -97,25 +96,23 @@ func (w *TabWindow) Display() {
9796
9897 globalTabReverse := config .GetGlobalOption ("tabreverse" ).(bool )
9998 globalTabHighlight := config .GetGlobalOption ("tabhighlight" ).(bool )
99+ tabBarStyle := config .DefStyle
100100
101- // xor of reverse and tab highlight to get tab character (as in filename and surrounding characters) reverse state
102- tabCharHighlight := (globalTabReverse || globalTabHighlight ) && ! (globalTabReverse && globalTabHighlight )
103-
104- reverseStyles := func (reverse bool ) (tcell.Style , tcell.Style ) {
105- tabBarStyle := config .DefStyle .Reverse (reverse )
106- if style , ok := config .Colorscheme ["tabbar" ]; ok {
107- tabBarStyle = style
108- }
109- tabBarActiveStyle := tabBarStyle
110- if style , ok := config .Colorscheme ["tabbar.active" ]; ok {
111- tabBarActiveStyle = style
112- }
113- return tabBarStyle , tabBarActiveStyle
101+ if style , ok := config .Colorscheme ["tabbar" ]; ok {
102+ tabBarStyle = style
103+ }
104+ if globalTabReverse {
105+ tabBarStyle = config .ReverseColor (tabBarStyle )
106+ }
107+ tabBarActiveStyle := tabBarStyle
108+ if globalTabHighlight {
109+ tabBarActiveStyle = config .ReverseColor (tabBarStyle )
110+ }
111+ if style , ok := config .Colorscheme ["tabbar.active" ]; ok {
112+ tabBarActiveStyle = style
114113 }
115114
116- draw := func (r rune , n int , active bool , reversed bool ) {
117- tabBarStyle , tabBarActiveStyle := reverseStyles (reversed )
118-
115+ draw := func (r rune , n int , active bool , tab bool ) {
119116 style := tabBarStyle
120117 if active {
121118 style = tabBarActiveStyle
@@ -128,11 +125,11 @@ func (w *TabWindow) Display() {
128125 c = ' '
129126 }
130127 if x == w .Width - 1 && ! done {
131- screen .SetContent (w .Width - 1 , w .Y , '>' , nil , tabBarStyle )
128+ screen .SetContent (w .Width - 1 , w .Y , '>' , nil , style )
132129 x ++
133130 break
134131 } else if x == 0 && w .hscroll > 0 {
135- screen .SetContent (0 , w .Y , '<' , nil , tabBarStyle )
132+ screen .SetContent (0 , w .Y , '<' , nil , style )
136133 } else if x >= 0 && x < w .Width {
137134 screen .SetContent (x , w .Y , c , nil , style )
138135 }
@@ -143,25 +140,25 @@ func (w *TabWindow) Display() {
143140
144141 for i , n := range w .Names {
145142 if i == w .active {
146- draw ('[' , 1 , true , tabCharHighlight )
143+ draw ('[' , 1 , true , true )
147144 } else {
148- draw (' ' , 1 , false , tabCharHighlight )
145+ draw (' ' , 1 , false , true )
149146 }
150147
151148 for _ , c := range n {
152- draw (c , 1 , i == w .active , tabCharHighlight )
149+ draw (c , 1 , i == w .active , true )
153150 }
154151
155152 if i == len (w .Names )- 1 {
156153 done = true
157154 }
158155
159156 if i == w .active {
160- draw (']' , 1 , true , tabCharHighlight )
161- draw (' ' , 2 , true , globalTabReverse )
157+ draw (']' , 1 , true , true )
158+ draw (' ' , 2 , true , false )
162159 } else {
163- draw (' ' , 1 , false , tabCharHighlight )
164- draw (' ' , 2 , false , globalTabReverse )
160+ draw (' ' , 1 , false , true )
161+ draw (' ' , 2 , false , false )
165162 }
166163
167164 if x >= w .Width {
0 commit comments