mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-06 03:53:59 +02:00
Support strikethrough text style
This commit is contained in:
parent
2e0d0a92ee
commit
820f7b9404
@ -347,6 +347,7 @@ The available attributes are:
|
||||
- default
|
||||
- reverse # useful for high-contrast
|
||||
- underline
|
||||
- strikethrough
|
||||
|
||||
## Highlighting the selected line
|
||||
|
||||
|
@ -6,6 +6,7 @@ type Decoration struct {
|
||||
bold bool
|
||||
underline bool
|
||||
reverse bool
|
||||
strikethrough bool
|
||||
}
|
||||
|
||||
func (d *Decoration) SetBold() {
|
||||
@ -20,6 +21,10 @@ func (d *Decoration) SetReverse() {
|
||||
d.reverse = true
|
||||
}
|
||||
|
||||
func (d *Decoration) SetStrikethrough() {
|
||||
d.strikethrough = true
|
||||
}
|
||||
|
||||
func (d Decoration) ToOpts() color.Opts {
|
||||
opts := make([]color.Color, 0, 3)
|
||||
|
||||
@ -35,6 +40,10 @@ func (d Decoration) ToOpts() color.Opts {
|
||||
opts = append(opts, color.OpReverse)
|
||||
}
|
||||
|
||||
if d.strikethrough {
|
||||
opts = append(opts, color.OpStrikethrough)
|
||||
}
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
@ -51,5 +60,9 @@ func (d Decoration) Merge(other Decoration) Decoration {
|
||||
d.reverse = true
|
||||
}
|
||||
|
||||
if other.strikethrough {
|
||||
d.strikethrough = true
|
||||
}
|
||||
|
||||
return d
|
||||
}
|
||||
|
@ -98,6 +98,12 @@ func (b TextStyle) SetReverse() TextStyle {
|
||||
return b
|
||||
}
|
||||
|
||||
func (b TextStyle) SetStrikethrough() TextStyle {
|
||||
b.decoration.SetStrikethrough()
|
||||
b.Style = b.deriveStyle()
|
||||
return b
|
||||
}
|
||||
|
||||
func (b TextStyle) SetBg(color Color) TextStyle {
|
||||
b.bg = &color
|
||||
b.Style = b.deriveStyle()
|
||||
|
@ -17,6 +17,8 @@ func GetTextStyle(keys []string, background bool) style.TextStyle {
|
||||
s = s.SetReverse()
|
||||
case "underline":
|
||||
s = s.SetUnderline()
|
||||
case "strikethrough":
|
||||
s = s.SetStrikethrough()
|
||||
default:
|
||||
value, present := style.ColorMap[key]
|
||||
if present {
|
||||
|
Loading…
Reference in New Issue
Block a user