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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rspotify::spotify::oauth2::{SpotifyClientCredentials, SpotifyOAuth, TokenInf
use rspotify::spotify::util::get_token;
use rspotify::spotify::util::process_token;
use rspotify::spotify::util::request_token;
use std::cmp::min;
use std::cmp::{max, min};
use std::io::{self, Write};
use std::panic::{self, PanicInfo};
use std::time::{Duration, Instant};
Expand Down Expand Up @@ -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 = max((app.size.height as u32) - 13, 50);
app.large_search_limit = min((f32::from(size.height) / 1.4) as u32, max_limit);
app.small_search_limit =
min((f32::from(size.height) / 2.85) as u32, max_limit / 2);
};

let current_route = app.get_current_route();
Expand Down