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

Fix scrolling when header is present #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicula-stripe
Copy link

Reproducing the bug

  • Apply the following patch on a clean master:
diff --git a/example/cli/main.go b/example/cli/main.go
index 7b9b8d2..3baf694 100644
--- a/example/cli/main.go
+++ b/example/cli/main.go
@@ -29,7 +29,8 @@ func main() {
                slice,
                func(i int) string {
                        return slice[i]
-               })
+               },
+               fuzzyfinder.WithHeader("header"))
        if err != nil {
                log.Fatal(err)
        }
  • Run printf 'a\nb\nc\nd\ne\nf' | go run example/cli/main.go.
  • Reduce the height of the terminal such that not all items fit on the screen.
  • Scroll all the way up in the list and notice how the cursor is one position above what you can actually see. Demo:
bug.mov

Fixing the bug

If the prompt has a header, increment the number of already-occupied lines (the other ones being the line with the search input, and the line with the result count).

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.

None yet

1 participant