@@ -14,9 +14,9 @@ func HighlightRange(t *widget.TextGrid, blockMode bool, startRow, startCol, endR
1414 // Check if already highlighted
1515 if h , ok := cell .Style .(* TermTextGridStyle ); ! ok {
1616 if cell .Style != nil {
17- cell .Style = NewTermTextGridStyle (cell .Style .TextColor (), cell .Style .BackgroundColor (), bitmask , false )
17+ cell .Style = NewTermTextGridStyle (cell .Style .TextColor (), cell .Style .BackgroundColor (), bitmask , false , false , false )
1818 } else {
19- cell .Style = NewTermTextGridStyle (nil , nil , bitmask , false )
19+ cell .Style = NewTermTextGridStyle (nil , nil , bitmask , false , false , false )
2020 }
2121 cell .Style .(* TermTextGridStyle ).Highlighted = true
2222
@@ -173,6 +173,8 @@ type TermTextGridStyle struct {
173173 Highlighted bool
174174 BlinkEnabled bool
175175 Blink bool
176+ IsBold bool
177+ IsUnderlined bool
176178}
177179
178180// TextColor returns the color of the text, depending on whether it is highlighted.
@@ -197,6 +199,16 @@ func (h *TermTextGridStyle) BackgroundColor() color.Color {
197199 return h .OriginalBackgroundColor
198200}
199201
202+ // Bold is the text bold or not.
203+ func (h * TermTextGridStyle ) Bold () bool {
204+ return h .IsBold
205+ }
206+
207+ // Underlined is the text underlined or not.
208+ func (h * TermTextGridStyle ) Underlined () bool {
209+ return h .IsUnderlined
210+ }
211+
200212// HighlightOption defines a function type that can modify a TermTextGridStyle.
201213type HighlightOption func (h * TermTextGridStyle )
202214
@@ -214,7 +226,7 @@ type HighlightOption func(h *TermTextGridStyle)
214226// Returns:
215227//
216228// A pointer to a TermTextGridStyle initialized with the provided colors and inversion settings.
217- func NewTermTextGridStyle (fg , bg color.Color , bitmask byte , blinkEnabled bool ) widget.TextGridStyle {
229+ func NewTermTextGridStyle (fg , bg color.Color , bitmask byte , blinkEnabled , bold , underlined bool ) widget.TextGridStyle {
218230 // calculate the inverted colors
219231 var invertedFg , invertedBg color.Color
220232 if fg == nil {
@@ -236,6 +248,8 @@ func NewTermTextGridStyle(fg, bg color.Color, bitmask byte, blinkEnabled bool) w
236248 Highlighted : false ,
237249 BlinkEnabled : blinkEnabled ,
238250 Blink : false ,
251+ IsBold : bold ,
252+ IsUnderlined : underlined ,
239253 }
240254}
241255
0 commit comments