mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 19:39:07 +00:00
Add --no-bold option
This commit is contained in:
parent
22487810ba
commit
4b332d831e
@ -57,6 +57,7 @@ const usage = `usage: fzf [options]
|
||||
--ansi Enable processing of ANSI color codes
|
||||
--tabstop=SPACES Number of spaces for a tab character (default: 8)
|
||||
--color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors
|
||||
--no-bold Do not use bold text
|
||||
|
||||
History
|
||||
--history=FILE History file
|
||||
@ -144,6 +145,7 @@ type Options struct {
|
||||
Mouse bool
|
||||
Theme *tui.ColorTheme
|
||||
Black bool
|
||||
Bold bool
|
||||
Reverse bool
|
||||
Cycle bool
|
||||
Hscroll bool
|
||||
@ -189,6 +191,7 @@ func defaultOptions() *Options {
|
||||
Mouse: true,
|
||||
Theme: tui.EmptyTheme(),
|
||||
Black: false,
|
||||
Bold: true,
|
||||
Reverse: false,
|
||||
Cycle: false,
|
||||
Hscroll: true,
|
||||
@ -910,6 +913,10 @@ func parseOptions(opts *Options, allArgs []string) {
|
||||
opts.Black = true
|
||||
case "--no-black":
|
||||
opts.Black = false
|
||||
case "--bold":
|
||||
opts.Bold = true
|
||||
case "--no-bold":
|
||||
opts.Bold = false
|
||||
case "--reverse":
|
||||
opts.Reverse = true
|
||||
case "--no-reverse":
|
||||
|
@ -70,6 +70,7 @@ type Terminal struct {
|
||||
header0 []string
|
||||
ansi bool
|
||||
margin [4]sizeSpec
|
||||
strong tui.Attr
|
||||
window *tui.Window
|
||||
bwindow *tui.Window
|
||||
pwindow *tui.Window
|
||||
@ -256,6 +257,10 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
if len(opts.Preview.command) > 0 {
|
||||
previewBox = util.NewEventBox()
|
||||
}
|
||||
strongAttr := tui.Bold
|
||||
if !opts.Bold {
|
||||
strongAttr = tui.AttrRegular
|
||||
}
|
||||
return &Terminal{
|
||||
initDelay: delay,
|
||||
inlineInfo: opts.InlineInfo,
|
||||
@ -279,6 +284,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
printQuery: opts.PrintQuery,
|
||||
history: opts.History,
|
||||
margin: opts.Margin,
|
||||
strong: strongAttr,
|
||||
cycle: opts.Cycle,
|
||||
header: header,
|
||||
header0: header,
|
||||
@ -532,24 +538,24 @@ func (t *Terminal) placeCursor() {
|
||||
|
||||
func (t *Terminal) printPrompt() {
|
||||
t.move(0, 0, true)
|
||||
t.window.CPrint(tui.ColPrompt, tui.Bold, t.prompt)
|
||||
t.window.CPrint(tui.ColNormal, tui.Bold, string(t.input))
|
||||
t.window.CPrint(tui.ColPrompt, t.strong, t.prompt)
|
||||
t.window.CPrint(tui.ColNormal, t.strong, string(t.input))
|
||||
}
|
||||
|
||||
func (t *Terminal) printInfo() {
|
||||
if t.inlineInfo {
|
||||
t.move(0, displayWidth([]rune(t.prompt))+displayWidth(t.input)+1, true)
|
||||
if t.reading {
|
||||
t.window.CPrint(tui.ColSpinner, tui.Bold, " < ")
|
||||
t.window.CPrint(tui.ColSpinner, t.strong, " < ")
|
||||
} else {
|
||||
t.window.CPrint(tui.ColPrompt, tui.Bold, " < ")
|
||||
t.window.CPrint(tui.ColPrompt, t.strong, " < ")
|
||||
}
|
||||
} else {
|
||||
t.move(1, 0, true)
|
||||
if t.reading {
|
||||
duration := int64(spinnerDuration)
|
||||
idx := (time.Now().UnixNano() % (duration * int64(len(_spinner)))) / duration
|
||||
t.window.CPrint(tui.ColSpinner, tui.Bold, _spinner[idx])
|
||||
t.window.CPrint(tui.ColSpinner, t.strong, _spinner[idx])
|
||||
}
|
||||
t.move(1, 2, false)
|
||||
}
|
||||
@ -627,17 +633,17 @@ func (t *Terminal) printItem(result *Result, i int, current bool) {
|
||||
} else if current {
|
||||
label = ">"
|
||||
}
|
||||
t.window.CPrint(tui.ColCursor, tui.Bold, label)
|
||||
t.window.CPrint(tui.ColCursor, t.strong, label)
|
||||
if current {
|
||||
if selected {
|
||||
t.window.CPrint(tui.ColSelected, tui.Bold, ">")
|
||||
t.window.CPrint(tui.ColSelected, t.strong, ">")
|
||||
} else {
|
||||
t.window.CPrint(tui.ColCurrent, tui.Bold, " ")
|
||||
t.window.CPrint(tui.ColCurrent, t.strong, " ")
|
||||
}
|
||||
t.printHighlighted(result, tui.Bold, tui.ColCurrent, tui.ColCurrentMatch, true)
|
||||
t.printHighlighted(result, t.strong, tui.ColCurrent, tui.ColCurrentMatch, true)
|
||||
} else {
|
||||
if selected {
|
||||
t.window.CPrint(tui.ColSelected, tui.Bold, ">")
|
||||
t.window.CPrint(tui.ColSelected, t.strong, ">")
|
||||
} else {
|
||||
t.window.Print(" ")
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ type Attr C.int
|
||||
type WindowImpl C.WINDOW
|
||||
|
||||
const (
|
||||
Bold = C.A_BOLD
|
||||
Dim = C.A_DIM
|
||||
Blink = C.A_BLINK
|
||||
Reverse = C.A_REVERSE
|
||||
Underline = C.A_UNDERLINE
|
||||
Bold Attr = C.A_BOLD
|
||||
Dim = C.A_DIM
|
||||
Blink = C.A_BLINK
|
||||
Reverse = C.A_REVERSE
|
||||
Underline = C.A_UNDERLINE
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -43,11 +43,11 @@ type WindowTcell struct {
|
||||
type WindowImpl WindowTcell
|
||||
|
||||
const (
|
||||
Bold = Attr(tcell.AttrBold)
|
||||
Dim = Attr(tcell.AttrDim)
|
||||
Blink = Attr(tcell.AttrBlink)
|
||||
Reverse = Attr(tcell.AttrReverse)
|
||||
Underline = Attr(tcell.AttrUnderline)
|
||||
Bold Attr = Attr(tcell.AttrBold)
|
||||
Dim = Attr(tcell.AttrDim)
|
||||
Blink = Attr(tcell.AttrBlink)
|
||||
Reverse = Attr(tcell.AttrReverse)
|
||||
Underline = Attr(tcell.AttrUnderline)
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user