refactor: move reverse into the State

This commit is contained in:
graelo 2020-05-30 22:23:33 +02:00
parent 56106f4e38
commit 7e96bef522
3 changed files with 45 additions and 33 deletions

View file

@ -19,7 +19,7 @@ pub mod view;
pub fn run(buffer: String, opt: &CliOpt) -> Option<(String, bool)> {
let lines: Vec<&str> = buffer.split('\n').collect();
let mut state = state::State::new(&lines, &opt.alphabet, &opt.custom_regex);
let mut state = state::State::new(&lines, &opt.alphabet, &opt.custom_regex, opt.reverse);
let hint_style = match &opt.hint_style {
None => None,
@ -37,7 +37,6 @@ pub fn run(buffer: String, opt: &CliOpt) -> Option<(String, bool)> {
let selection: Option<(String, bool)> = {
let mut viewbox = view::View::new(
&mut state,
opt.reverse,
opt.unique_hint,
&opt.hint_alignment,
&opt.colors,