mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2025-01-09 09:50:26 +00:00
parent
c97172bdd4
commit
e627ca6bd7
@ -1,8 +1,9 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
0.41.2
|
0.42.0
|
||||||
------
|
------
|
||||||
|
- Added new info style: `--info=inline-right`
|
||||||
- Added new border style `thinblock` which uses symbols for legacy computing
|
- Added new border style `thinblock` which uses symbols for legacy computing
|
||||||
[one eighth block elements](https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing)
|
[one eighth block elements](https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing)
|
||||||
- Similarly to `block`, this style is suitable when using a different
|
- Similarly to `block`, this style is suitable when using a different
|
||||||
|
@ -361,6 +361,8 @@ Determines the display style of finder info (match counters).
|
|||||||
.br
|
.br
|
||||||
.BR inline:SEPARATOR " Display on the same line with a non-default separator"
|
.BR inline:SEPARATOR " Display on the same line with a non-default separator"
|
||||||
.br
|
.br
|
||||||
|
.BR inline-right " Display on the right end of the same line
|
||||||
|
.br
|
||||||
.BR hidden " Do not display finder info"
|
.BR hidden " Do not display finder info"
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ const usage = `usage: fzf [options]
|
|||||||
(default: 0 or center)
|
(default: 0 or center)
|
||||||
--margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
--margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||||
--padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
--padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
||||||
--info=STYLE Finder info style [default|hidden|inline|inline:SEPARATOR]
|
--info=STYLE Finder info style [default|hidden|inline[:SEPARATOR]|inline-right]
|
||||||
--separator=STR String to form horizontal separator on info line
|
--separator=STR String to form horizontal separator on info line
|
||||||
--no-separator Hide info line separator
|
--no-separator Hide info line separator
|
||||||
--scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)
|
--scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)
|
||||||
@ -195,6 +195,7 @@ type infoStyle int
|
|||||||
const (
|
const (
|
||||||
infoDefault infoStyle = iota
|
infoDefault infoStyle = iota
|
||||||
infoInline
|
infoInline
|
||||||
|
infoInlineRight
|
||||||
infoHidden
|
infoHidden
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1378,6 +1379,8 @@ func parseInfoStyle(str string) (infoStyle, string) {
|
|||||||
return infoDefault, ""
|
return infoDefault, ""
|
||||||
case "inline":
|
case "inline":
|
||||||
return infoInline, defaultInfoSep
|
return infoInline, defaultInfoSep
|
||||||
|
case "inline-right":
|
||||||
|
return infoInlineRight, ""
|
||||||
case "hidden":
|
case "hidden":
|
||||||
return infoHidden, ""
|
return infoHidden, ""
|
||||||
default:
|
default:
|
||||||
@ -1385,7 +1388,7 @@ func parseInfoStyle(str string) (infoStyle, string) {
|
|||||||
if strings.HasPrefix(str, prefix) {
|
if strings.HasPrefix(str, prefix) {
|
||||||
return infoInline, strings.ReplaceAll(str[len(prefix):], "\n", " ")
|
return infoInline, strings.ReplaceAll(str[len(prefix):], "\n", " ")
|
||||||
}
|
}
|
||||||
errorExit("invalid info style (expected: default|hidden|inline|inline:SEPARATOR)")
|
errorExit("invalid info style (expected: default|hidden|inline[:SEPARATOR]|inline-right)")
|
||||||
}
|
}
|
||||||
return infoDefault, ""
|
return infoDefault, ""
|
||||||
}
|
}
|
||||||
|
@ -1464,9 +1464,7 @@ func (t *Terminal) trimMessage(message string, maxWidth int) string {
|
|||||||
func (t *Terminal) printInfo() {
|
func (t *Terminal) printInfo() {
|
||||||
pos := 0
|
pos := 0
|
||||||
line := t.promptLine()
|
line := t.promptLine()
|
||||||
switch t.infoStyle {
|
printSpinner := func() {
|
||||||
case infoDefault:
|
|
||||||
t.move(line+1, 0, t.separatorLen == 0)
|
|
||||||
if t.reading {
|
if t.reading {
|
||||||
duration := int64(spinnerDuration)
|
duration := int64(spinnerDuration)
|
||||||
idx := (time.Now().UnixNano() % (duration * int64(len(t.spinner)))) / duration
|
idx := (time.Now().UnixNano() % (duration * int64(len(t.spinner)))) / duration
|
||||||
@ -1474,8 +1472,16 @@ func (t *Terminal) printInfo() {
|
|||||||
} else {
|
} else {
|
||||||
t.window.Print(" ") // Clear spinner
|
t.window.Print(" ") // Clear spinner
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
switch t.infoStyle {
|
||||||
|
case infoDefault:
|
||||||
|
t.move(line+1, 0, t.separatorLen == 0)
|
||||||
|
printSpinner()
|
||||||
t.move(line+1, 2, false)
|
t.move(line+1, 2, false)
|
||||||
pos = 2
|
pos = 2
|
||||||
|
case infoInlineRight:
|
||||||
|
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
||||||
|
t.move(line, pos, true)
|
||||||
case infoInline:
|
case infoInline:
|
||||||
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 1
|
||||||
str := t.infoSep
|
str := t.infoSep
|
||||||
@ -1523,6 +1529,16 @@ func (t *Terminal) printInfo() {
|
|||||||
if t.failed != nil && t.count == 0 {
|
if t.failed != nil && t.count == 0 {
|
||||||
output = fmt.Sprintf("[Command failed: %s]", *t.failed)
|
output = fmt.Sprintf("[Command failed: %s]", *t.failed)
|
||||||
}
|
}
|
||||||
|
if t.infoStyle == infoInlineRight {
|
||||||
|
pos = util.Max(pos, t.window.Width()-util.StringWidth(output)-3)
|
||||||
|
if pos >= t.window.Width() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.move(line, pos, false)
|
||||||
|
printSpinner()
|
||||||
|
t.window.Print(" ")
|
||||||
|
pos += 2
|
||||||
|
}
|
||||||
maxWidth := t.window.Width() - pos
|
maxWidth := t.window.Width() - pos
|
||||||
output = t.trimMessage(output, maxWidth)
|
output = t.trimMessage(output, maxWidth)
|
||||||
t.window.CPrint(tui.ColInfo, output)
|
t.window.CPrint(tui.ColInfo, output)
|
||||||
|
Loading…
Reference in New Issue
Block a user