Skip to content

Add wrap-around navigation option#246

Open
bitounu wants to merge 2 commits into
philj56:masterfrom
bitounu:wrap
Open

Add wrap-around navigation option#246
bitounu wants to merge 2 commits into
philj56:masterfrom
bitounu:wrap

Conversation

@bitounu

@bitounu bitounu commented Apr 11, 2026

Copy link
Copy Markdown

This PR adds a boolean option wrap to enable wrapping around the result list when navigating past the first or last entry.

Why:

Useful when creating custom scripts with a limited list of items; allows for fast navigation.

Testing:

  1. Test wrap=false (default)
    printf 'a\nb\nc\nd\ne' | ./build/tofi --num-results 3
    Navigate to the end of the list using the down arrow —
    the cursor should stop.
    Navigate to the beginning using the up arrow —
    the cursor should also stop.

  2. Test wrap=true
    printf 'a\nb\nc\nd\ne' | ./build/tofi --num-results 3 --wrap=true

  • On the last item, pressing the down arrow → moves to the first item
  • On the first item, pressing the up arrow → moves to the last item
  1. Pagination test
    printf 'a\nb\nc\nd\ne\nf\ng\nh' | ./build/tofi --num-results 3 --wrap=true
    Navigate up/down through all pages and verify that wrapping only occurs after reaching the very end or beginning
    of the full list.

  2. Config file test, create a file 'test.conf' with content:
    wrap = true
    printf 'a\nb\nc' | ./build/tofi --config ./test.conf
    Test.
    Change content of file to:
    wrap = false
    Run again as above and test.

bitounu added 2 commits April 11, 2026 09:01
Add a boolean option `wrap` (default: false) to enable wrapping around
the result list when navigating past the first or last entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant