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

Adding more movement keys #153

Merged
merged 3 commits into from
Jun 13, 2022
Merged

Conversation

matheusfillipe
Copy link
Contributor

Implemented a min function
Added actions for Home, End, PageUp and PageDown
Fixes #125

Implemented a min function
Added actions for Home, End, PageUp and PageDown
Fixes ktr0731#125
Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I left some comments.

fuzzyfinder.go Outdated
@@ -415,6 +428,9 @@ func (f *finder) readKey() error {
f.stateMu.Lock()
defer f.stateMu.Unlock()

// Max number of lines to scroll by using PgUp and PgDn
const pageScrollBy = 15
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you scroll the list based on the actual screen size?

fuzzyfinder.go Outdated
case tcell.KeyPgDn:
f.state.y -= min(pageScrollBy, f.state.y)
f.state.cursorY -= min(pageScrollBy, f.state.cursorY)
case tcell.KeyHome:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the action of Home in fzf is beginning-of-line, go-fuzzyfinder's one should also be the same behavior.

fuzzyfinder.go Outdated
f.state.y = len(f.state.matched) - 1
_, height := f.term.Size()
f.state.cursorY = min(height-3, len(f.state.matched)-1)
case tcell.KeyEnd:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as the above comment. This should be the same behavior of end-of-line.

@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #153 (d816e99) into master (df4cd55) will decrease coverage by 0.52%.
The diff coverage is 72.00%.

@@            Coverage Diff             @@
##           master     #153      +/-   ##
==========================================
- Coverage   85.67%   85.15%   -0.53%     
==========================================
  Files           5        5              
  Lines         775      795      +20     
==========================================
+ Hits          664      677      +13     
- Misses         97      104       +7     
  Partials       14       14              

@matheusfillipe
Copy link
Contributor Author

That should be it

Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ktr0731 ktr0731 merged commit 76fb6bd into ktr0731:master Jun 13, 2022
@matheusfillipe matheusfillipe deleted the new-move-keys branch June 13, 2022 03:07
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.

Implement Home/End/PageUp/PageDown support
2 participants