junegunn / junegunn/fzf

--keep-right not keeping right on long lines with search term present

Open
#4,577 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
83.1k
Forks
3.1k
Avg merge
17h 8m
Merged PRs (30d)
10

Description

### Checklist

- [x] I have read through the manual page (`man fzf`)
- [x] I have searched through the existing issues
- [x] For bug reports, I have checked if the bug is reproducible in the latest version of fzf

### Output of `fzf --version`

0.66.1 (brew)

### OS

- [ ] Linux
- [x] macOS
- [ ] Windows
- [ ] Etc.

### Shell

- [ ] bash
- [x] zsh
- [ ] fish

### Problem / Steps to reproduce

When long lines are present the `--keep-right` option seems to lose effect as soon as a search term is entered and results are being highlighted.

Here's an example:

```bash
(cat < this ╰──────────────────────────────────────╯
```

As you can see the search term `this` has moved to the middle of the line, violating the `--keep-right` option, even though there would be enough room to show the entire rightmost part of the line while still keeping `this` in view.

(Of course ignoring keep-right is fine when the search term occurs so far on the left that it's not possible to keep the right edge in view.)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied fzf command in an 80x15 terminal, then start at the --keep-right option handling and the rendering path where highlighted matches affect horizontal positioning. Done means the rightmost portion remains visible when the search term is highlighted whenever there is enough room, with regression coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, zsh
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.