Skip to content

Commit

Permalink
Merge pull request #154 from echoSayonara/search-result
Browse files Browse the repository at this point in the history
Adjust search limits
  • Loading branch information
Rigellute committed Nov 18, 2019
2 parents ed228c5 + aaf94c5 commit 75c2287
Showing 1 changed file with 5 additions and 3 deletions.
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

0 comments on commit 75c2287

Please sign in to comment.