m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-17 07:43:39 -05:00

Avoid truncating ellipsis to avoid confusion

This commit is contained in:
Junegunn Choi
2025-11-13 23:00:32 +09:00
parent 1df99db0b2
commit 3f499f055e
2 changed files with 20 additions and 7 deletions

View File

@@ -3,21 +3,29 @@ CHANGELOG
0.67.0 0.67.0
------ ------
- Added `--freeze-left=N` option to keep the leftmost N columns visible. - Added `--freeze-left=N` option to keep the leftmost N columns always visible.
```sh ```sh
# Keeps the file name column fixed and always visible # Keep the file name column fixed and always visible
git grep --line-number --color=always -- '' | git grep --line-number --color=always -- '' |
fzf --ansi --delimiter : --freeze-left 1 fzf --ansi --delimiter : --freeze-left 1
# Used with --keep-right # Can be used with --keep-right
git grep --line-number --color=always -- '' | git grep --line-number --color=always -- '' |
fzf --ansi --delimiter : --freeze-left 1 --keep-right fzf --ansi --delimiter : --freeze-left 1 --keep-right
``` ```
- Also added `--freeze-right=N` option to keep the rightmost N columns visible. - Also added `--freeze-right=N` option to keep the rightmost N columns always visible.
```sh ```sh
# Stronger version of --keep-right that always keeps the right-end visible
fd | fzf --freeze-right 1
# Keep the base name always visible
fd | fzf --freeze-right 1 --delimiter / fd | fzf --freeze-right 1 --delimiter /
# Keep both leftmost and rightmost components visible
fd | fzf --freeze-left 1 --freeze-right 1 --delimiter / fd | fzf --freeze-left 1 --freeze-right 1 --delimiter /
``` ```
- Updated `--info=inline` to print the spinner (load indicator).
- Bug fixes
0.66.1 0.66.1
------ ------

View File

@@ -3745,9 +3745,14 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
offs[idx].offset[1] -= int32(shift) offs[idx].offset[1] -= int32(shift)
} }
maxe -= shift maxe -= shift
displayWidth = t.displayWidthWithLimit(runes, 0, maxWidth) ellipsis, ellipsisWidth := util.Truncate(t.ellipsis, maxWidth)
if !t.wrap && displayWidth > maxWidth { adjustedMaxWidth := maxWidth
ellipsis, ellipsisWidth := util.Truncate(t.ellipsis, maxWidth/2) if fidx < 2 {
// For frozen parts, reserve space for the ellipsis in the middle part
adjustedMaxWidth -= ellipsisWidth
}
displayWidth = t.displayWidthWithLimit(runes, 0, adjustedMaxWidth)
if !t.wrap && displayWidth > adjustedMaxWidth {
maxe = util.Constrain(maxe+util.Min(maxWidth/2-ellipsisWidth, t.hscrollOff), 0, len(runes)) maxe = util.Constrain(maxe+util.Min(maxWidth/2-ellipsisWidth, t.hscrollOff), 0, len(runes))
transformOffsets := func(diff int32, rightTrim bool) { transformOffsets := func(diff int32, rightTrim bool) {
for idx, offset := range offs { for idx, offset := range offs {