Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal behavior of down at the end of the list in the presence of multi-line items #4083

Closed
junegunn opened this issue Nov 11, 2024 · 2 comments
Assignees
Labels

Comments

@junegunn
Copy link
Owner

There is still a problem at the very end (the last page), where abnormal behavior can occur, but only when --wrap is on, even if there is no line to wrap.

In this example (with no line to wrap):

{ for i in {1..25}; do printf "item $i, line 1\0"; done; printf 'item 26, line 1\n         line 2\n         line 3\n         line 4\0'; for i in {27..58}; do printf "item $i, line 1\0"; done; } | fzf --read0 --reverse --height=35 --wrap

we get the following behaviour:

  1. At the beginning we see items 1-30, item 1 selected.
  2. After one page-down, we instantaneously see items 7-36, item 33 selected.
  3. After a second page-down, after a sensible delay, we see items 26-55, with no visible item selected.
  4. Further page-downs don’t have any effect. But doing down once leads to seeing items 29-58, with item 58 selected.
  5. Doing down again leads back to the state after step 3. Doing up repeatedly leads to oscillations.

If we remove --wrap (or toggle it), everything is fine. If we add --scroll-off=12, it seems to me that the delay is more sensible.

Originally posted by @vejkse in #4069 (comment)

@junegunn junegunn added the bug label Nov 11, 2024
@junegunn junegunn self-assigned this Nov 11, 2024
@junegunn
Copy link
Owner Author

@vejkse I believe the problem is fixed now. Thanks again.

@vejkse
Copy link

vejkse commented Nov 13, 2024

Thank you! It does look fixed.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this issue Nov 22, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [junegunn/fzf](https://github.com/junegunn/fzf) | minor | `v0.55.0` -> `v0.56.3` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>junegunn/fzf (junegunn/fzf)</summary>

### [`v0.56.3`](https://github.com/junegunn/fzf/releases/tag/v0.56.3): 0.56.3

[Compare Source](junegunn/fzf@v0.56.2...v0.56.3)

-   Bug fixes in zsh scripts
    -   fix(zsh): handle backtick trigger edge case ([#&#8203;4090](junegunn/fzf#4090))
    -   revert(zsh): remove 'fc -RI' call in the history widget ([#&#8203;4093](junegunn/fzf#4093))
    -   Thanks to [@&#8203;LangLangBart](https://github.com/LangLangBart) for the contributions

### [`v0.56.2`](https://github.com/junegunn/fzf/releases/tag/v0.56.2): 0.56.2

[Compare Source](junegunn/fzf@v0.56.1...v0.56.2)

-   Bug fixes
    -   Fixed abnormal scrolling behavior when `--wrap` is set ([#&#8203;4083](junegunn/fzf#4083))
    -   \[zsh] Fixed warning message when `ksh_arrays` is set ([#&#8203;4084](junegunn/fzf#4084))

### [`v0.56.1`](https://github.com/junegunn/fzf/releases/tag/v0.56.1): 0.56.1

[Compare Source](junegunn/fzf@v0.56.0...v0.56.1)

-   Bug fixes and improvements
    -   Fixed a race condition which would cause fzf to present stale results after `reload` ([#&#8203;4070](junegunn/fzf#4070))
    -   `page-up` and `page-down` actions now work correctly with multi-line items ([#&#8203;4069](junegunn/fzf#4069))
    -   `{n}` is allowed in `SCROLL` expression in `--preview-window` ([#&#8203;4079](junegunn/fzf#4079))
    -   \[zsh] Fixed regression in history loading with shared option ([#&#8203;4071](junegunn/fzf#4071))
    -   \[zsh] Better command extraction in zsh completion ([#&#8203;4082](junegunn/fzf#4082))
-   Thanks to [@&#8203;LangLangBart](https://github.com/LangLangBart), [@&#8203;jaydee-coder](https://github.com/jaydee-coder), [@&#8203;alex-huff](https://github.com/alex-huff), and [@&#8203;vejkse](https://github.com/vejkse) for the contributions

### [`v0.56.0`](https://github.com/junegunn/fzf/releases/tag/v0.56.0): 0.56.0

[Compare Source](junegunn/fzf@v0.55.0...v0.56.0)

-   Added `--gap[=N]` option to display empty lines between items.
    -   This can be useful to visually separate adjacent multi-line items.
        ```sh
        ```

### All bash functions, highlighted

      declare -f | perl -0777 -pe 's/^}\n/}\0/gm' |
        bat --plain --language bash --color always |
        fzf --read0 --ansi --reverse --multi --highlight-line --gap
      ```
      <img width="855" alt="image" src="https://github.com/user-attachments/assets/b3d2eaf2-bf44-4e3a-8d7b-9878629dd9be">
    - Or just to make the list easier to read. For single-line items, you probably want to set `--color gutter:-1` as well to hide the gutter.
      ```sh
      fzf --info inline-right --gap --color gutter:-1
      ```
      <img width="855" alt="image" src="https://github.com/user-attachments/assets/113757a1-ccfd-42a6-b946-83533f408e69">

-   Added `noinfo` option to `--preview-window` to hide the scroll indicator in the preview window
-   Bug fixes
    -   Thanks to [@&#8203;LangLangBart](https://github.com/LangLangBart), [@&#8203;akinomyoga](https://github.com/akinomyoga), and [@&#8203;charlievieth](https://github.com/charlievieth) for fixing the bugs

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants