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

Adjust search limits #154

Merged
merged 1 commit into from Nov 18, 2019
Merged

Adjust search limits #154

merged 1 commit into from Nov 18, 2019

Conversation

ghost
Copy link

@ghost ghost commented Nov 18, 2019

When terminal size is changed, some contents are not showed in the table. Additionally, regardless terminal size, search returns only 4 contents.

Here, I tried to fix these problem, i adjust search limits depending on the terminal size. However, parameters I used here are not led deductively but empirically.

If you know the way to get height of each block, preferable implementation can be available. For me, my implementation is not smart and if you have any idea, please tell me it.

src/main.rs Outdated
@@ -173,8 +173,10 @@ fn main() -> Result<(), failure::Error> {
app.size = size;

// Based on the size of the terminal, adjust the search limit.
let max_limit = 50;
app.large_search_limit = min((f32::from(size.height) / 1.5) as u32, max_limit);
let max_limit = (app.size.height as u32) - 13;
Copy link
Owner

Choose a reason for hiding this comment

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

The max limit of 50 is imposed on us by Spotify, sending more than this will give as a bad response from the API.

Copy link
Owner

Choose a reason for hiding this comment

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

So you could do

max(app.size.height as u32 - 13, 50);

Copy link
Author

Choose a reason for hiding this comment

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

thanks! fixed it.

@Rigellute Rigellute merged commit 75c2287 into Rigellute:master Nov 18, 2019
@ghost ghost mentioned this pull request Nov 22, 2019
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