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
@ -88,7 +88,7 @@ git:
|
|||||||
# displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`)
|
# displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`)
|
||||||
showWholeGraph: false
|
showWholeGraph: false
|
||||||
skipHookPrefix: WIP
|
skipHookPrefix: WIP
|
||||||
# The main branches. We colour commits green if they belong to one of these branches,
|
# The main branches. We colour commits green if they belong to one of these branches,
|
||||||
# so that you can easily see which commits are unique to your branch (coloured in yellow)
|
# so that you can easily see which commits are unique to your branch (coloured in yellow)
|
||||||
mainBranches: [master, main]
|
mainBranches: [master, main]
|
||||||
autoFetch: true
|
autoFetch: true
|
||||||
@ -347,6 +347,7 @@ The available attributes are:
|
|||||||
- default
|
- default
|
||||||
- reverse # useful for high-contrast
|
- reverse # useful for high-contrast
|
||||||
- underline
|
- underline
|
||||||
|
- strikethrough
|
||||||
|
|
||||||
## Highlighting the selected line
|
## Highlighting the selected line
|
||||||
|
|
||||||
|
@ -3,9 +3,10 @@ package style
|
|||||||
import "github.com/gookit/color"
|
import "github.com/gookit/color"
|
||||||
|
|
||||||
type Decoration struct {
|
type Decoration struct {
|
||||||
bold bool
|
bold bool
|
||||||
underline bool
|
underline bool
|
||||||
reverse bool
|
reverse bool
|
||||||
|
strikethrough bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Decoration) SetBold() {
|
func (d *Decoration) SetBold() {
|
||||||
@ -20,6 +21,10 @@ func (d *Decoration) SetReverse() {
|
|||||||
d.reverse = true
|
d.reverse = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Decoration) SetStrikethrough() {
|
||||||
|
d.strikethrough = true
|
||||||
|
}
|
||||||
|
|
||||||
func (d Decoration) ToOpts() color.Opts {
|
func (d Decoration) ToOpts() color.Opts {
|
||||||
opts := make([]color.Color, 0, 3)
|
opts := make([]color.Color, 0, 3)
|
||||||
|
|
||||||
@ -35,6 +40,10 @@ func (d Decoration) ToOpts() color.Opts {
|
|||||||
opts = append(opts, color.OpReverse)
|
opts = append(opts, color.OpReverse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.strikethrough {
|
||||||
|
opts = append(opts, color.OpStrikethrough)
|
||||||
|
}
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,5 +60,9 @@ func (d Decoration) Merge(other Decoration) Decoration {
|
|||||||
d.reverse = true
|
d.reverse = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if other.strikethrough {
|
||||||
|
d.strikethrough = true
|
||||||
|
}
|
||||||
|
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,12 @@ func (b TextStyle) SetReverse() TextStyle {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (b TextStyle) SetStrikethrough() TextStyle {
|
||||||
|
b.decoration.SetStrikethrough()
|
||||||
|
b.Style = b.deriveStyle()
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
func (b TextStyle) SetBg(color Color) TextStyle {
|
func (b TextStyle) SetBg(color Color) TextStyle {
|
||||||
b.bg = &color
|
b.bg = &color
|
||||||
b.Style = b.deriveStyle()
|
b.Style = b.deriveStyle()
|
||||||
|
@ -17,6 +17,8 @@ func GetTextStyle(keys []string, background bool) style.TextStyle {
|
|||||||
s = s.SetReverse()
|
s = s.SetReverse()
|
||||||
case "underline":
|
case "underline":
|
||||||
s = s.SetUnderline()
|
s = s.SetUnderline()
|
||||||
|
case "strikethrough":
|
||||||
|
s = s.SetStrikethrough()
|
||||||
default:
|
default:
|
||||||
value, present := style.ColorMap[key]
|
value, present := style.ColorMap[key]
|
||||||
if present {
|
if present {
|
||||||
|
Loading…
Reference in New Issue
Block a user