Skip to content
Myr

Add --info=inline-right

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Close #3322

authored by Junegunn Choi · committed by Junegunn Choi · parent c97172b · Browse files · 4 files+28 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+28 added−6 removed

  • other:+28 added−6 removed

4 files+28 added−6 removed

modified:man/man1/fzf.1+2 added
359 unmodified lines
360.BR inline " Display on the same line with the default separator ' < '"361.br362.BR inline:SEPARATOR " Display on the same line with a non-default separator"363.br364.BR inline-right " Display on the right end of the same line365.br366.BR hidden " Do not display finder info"367.br368369.TP
929 unmodified lines
modified:src/options.go+5 added-2 removed
70 unmodified lines
71 NEGATIVE_INTEGER: columns from right][:bottom]72 (default: 0 or center)73 --margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)74 --padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)75 --info=STYLE Finder info style [default|hidden|inline|inline:SEPARATOR]75 --info=STYLE Finder info style [default|hidden|inline[:SEPARATOR]|inline-right]76 --separator=STR String to form horizontal separator on info line77 --no-separator Hide info line separator78 --scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)79 --no-scrollbar Hide scrollbar
114 unmodified lines
194195const (196 infoDefault infoStyle = iota197 infoInline198 infoInlineRight199 infoHidden200)201202type labelOpts struct {
1175 unmodified lines
1378 case "default":1379 return infoDefault, ""1380 case "inline":1381 return infoInline, defaultInfoSep1382 case "inline-right":1383 return infoInlineRight, ""1384 case "hidden":1385 return infoHidden, ""1386 default:1387 prefix := "inline:"1388 if strings.HasPrefix(str, prefix) {1389 return infoInline, strings.ReplaceAll(str[len(prefix):], "\n", " ")1390 }1388 errorExit("invalid info style (expected: default|hidden|inline|inline:SEPARATOR)")1391 errorExit("invalid info style (expected: default|hidden|inline[:SEPARATOR]|inline-right)")1392 }1393 return infoDefault, ""1394}1395
713 unmodified lines
modified:src/terminal.go+19 added-3 removed
1462 unmodified lines
14631464func (t *Terminal) printInfo() {1465 pos := 01466 line := t.promptLine()1467 switch t.infoStyle {1468 case infoDefault:1469 t.move(line+1, 0, t.separatorLen == 0)1467 printSpinner := func() {1468 if t.reading {1469 duration := int64(spinnerDuration)1470 idx := (time.Now().UnixNano() % (duration * int64(len(t.spinner)))) / duration1471 t.window.CPrint(tui.ColSpinner, t.spinner[idx])1472 } else {1473 t.window.Print(" ") // Clear spinner1474 }1475 }1476 switch t.infoStyle {1477 case infoDefault:1478 t.move(line+1, 0, t.separatorLen == 0)1479 printSpinner()1480 t.move(line+1, 2, false)1481 pos = 21482 case infoInlineRight:1483 pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 11484 t.move(line, pos, true)1485 case infoInline:1486 pos = t.promptLen + t.queryLen[0] + t.queryLen[1] + 11487 str := t.infoSep1488 maxWidth := t.window.Width() - pos
39 unmodified lines
1528 }1529 if t.failed != nil && t.count == 0 {1530 output = fmt.Sprintf("[Command failed: %s]", *t.failed)1531 }1532 if t.infoStyle == infoInlineRight {1533 pos = util.Max(pos, t.window.Width()-util.StringWidth(output)-3)1534 if pos >= t.window.Width() {1535 return1536 }1537 t.move(line, pos, false)1538 printSpinner()1539 t.window.Print(" ")1540 pos += 21541 }1542 maxWidth := t.window.Width() - pos1543 output = t.trimMessage(output, maxWidth)1544 t.window.CPrint(tui.ColInfo, output)1545
2188 unmodified lines
modified:CHANGELOG.md+2 added-1 removed
1CHANGELOG2=========340.41.240.42.05------6- Added new info style: `--info=inline-right`7- Added new border style `thinblock` which uses symbols for legacy computing8 [one eighth block elements](https://en.wikipedia.org/wiki/Symbols_for_Legacy_Computing)9 - Similarly to `block`, this style is suitable when using a different10 background color because the window is completely contained within the border.
1656 unmodified lines