mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-09 16:00:35 +00:00
Hint position
This commit is contained in:
parent
5002e5643f
commit
925462703d
10
src/main.rs
10
src/main.rs
@ -59,12 +59,18 @@ fn app_args<'a> () -> clap::ArgMatches<'a> {
|
||||
.help("Don't show duplicated hints for the same match")
|
||||
.long("unique")
|
||||
.short("u"))
|
||||
.arg(Arg::with_name("position")
|
||||
.help("Hint position")
|
||||
.long("position")
|
||||
.default_value("left")
|
||||
.short("p"))
|
||||
.get_matches();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = app_args();
|
||||
let alphabet = args.value_of("alphabet").unwrap();
|
||||
let position = args.value_of("position").unwrap();
|
||||
let reverse = args.is_present("reverse");
|
||||
let unique = args.is_present("unique");
|
||||
|
||||
@ -131,7 +137,9 @@ fn main() {
|
||||
rustbox.print(offset, mat.y as usize, rustbox::RB_NORMAL, selected_color, background_color, mat.text);
|
||||
|
||||
if let Some(ref hint) = mat.hint {
|
||||
rustbox.print(offset, mat.y as usize, rustbox::RB_BOLD, hint_foreground_color, hint_background_color, hint.as_str());
|
||||
let extra_position = if position == "left" { 0 } else { mat.text.len() - mat.hint.clone().unwrap().len() };
|
||||
|
||||
rustbox.print(offset + extra_position, mat.y as usize, rustbox::RB_BOLD, hint_foreground_color, hint_background_color, hint.as_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user