mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-08 08:02:06 -07:00
@@ -147,6 +147,7 @@ type labelPrinter func(tui.Window, int)
|
||||
type Terminal struct {
|
||||
initDelay time.Duration
|
||||
infoStyle infoStyle
|
||||
infoSep string
|
||||
separator labelPrinter
|
||||
separatorLen int
|
||||
spinner []string
|
||||
@@ -579,6 +580,7 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
|
||||
t := Terminal{
|
||||
initDelay: delay,
|
||||
infoStyle: opts.InfoStyle,
|
||||
infoSep: opts.InfoSep,
|
||||
separator: nil,
|
||||
spinner: makeSpinner(opts.Unicode),
|
||||
queryLen: [2]int{0, 0},
|
||||
@@ -1393,16 +1395,21 @@ func (t *Terminal) printInfo() {
|
||||
pos = 2
|
||||
case infoInline:
|
||||
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
||||
if pos+len(" < ") > t.window.Width() {
|
||||
return
|
||||
str := t.infoSep
|
||||
maxWidth := t.window.Width() - pos
|
||||
width := runewidth.StringWidth(str)
|
||||
if width > maxWidth {
|
||||
trimmed, _ := t.trimRight([]rune(str), maxWidth)
|
||||
str = string(trimmed)
|
||||
width = maxWidth
|
||||
}
|
||||
t.move(line, pos, t.separatorLen == 0)
|
||||
if t.reading {
|
||||
t.window.CPrint(tui.ColSpinner, " < ")
|
||||
t.window.CPrint(tui.ColSpinner, str)
|
||||
} else {
|
||||
t.window.CPrint(tui.ColPrompt, " < ")
|
||||
t.window.CPrint(tui.ColPrompt, str)
|
||||
}
|
||||
pos += len(" < ")
|
||||
pos += width
|
||||
case infoHidden:
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user