summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-11-15 23:57:32 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-11-15 23:57:32 +0900
commit4b332d831e3b5cb6dc70484b1a621eae9b162317 (patch)
tree627cc7921f490e6f102110b9435670c9f88db3ca
parent22487810ba8484b2e2c64874bcbdc3e854c6be99 (diff)
Add --no-bold option
-rw-r--r--src/options.go7
-rw-r--r--src/terminal.go26
-rw-r--r--src/tui/ncurses.go10
-rw-r--r--src/tui/tcell.go10
4 files changed, 33 insertions, 20 deletions
diff --git a/src/options.go b/src/options.go
index a3ed22d9..6e63d4e6 100644
--- a/src/options.go
+++ b/src/options.go
@@ -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":
diff --git a/src/terminal.go b/src/terminal.go
index 6d1a1ab5..5d4eef87 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -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(" ")
}
diff --git a/src/tui/ncurses.go b/src/tui/ncurses.go
index 16a29fc3..1e77c891 100644
--- a/src/tui/ncurses.go
+++ b/src/tui/ncurses.go
@@ -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 (
diff --git a/src/tui/tcell.go b/src/tui/tcell.go
index da104b3d..0fe066d3 100644
--- a/src/tui/tcell.go
+++ b/src/tui/tcell.go
@@ -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 (