launcher: rustfmt
This commit is contained in:
+17
-8
@@ -64,7 +64,11 @@ impl Launcher {
|
|||||||
buf.memset(bg);
|
buf.memset(bg);
|
||||||
|
|
||||||
let mut x_off = if self.input.len() > 0 {
|
let mut x_off = if self.input.len() > 0 {
|
||||||
let c = if self.matches.len() == 0 { Color::new(1.0, 0.5, 0.5, 1.0) } else { Color::new(1.0, 1.0, 1.0, 1.0) };
|
let c = if self.matches.len() == 0 {
|
||||||
|
Color::new(1.0, 0.5, 0.5, 1.0)
|
||||||
|
} else {
|
||||||
|
Color::new(1.0, 1.0, 1.0, 1.0)
|
||||||
|
};
|
||||||
let dim = self.font.borrow_mut().auto_draw_text(
|
let dim = self.font.borrow_mut().auto_draw_text(
|
||||||
&mut buf.subdimensions((0, 0, 1232, 32))?,
|
&mut buf.subdimensions((0, 0, 1232, 32))?,
|
||||||
bg,
|
bg,
|
||||||
@@ -77,11 +81,9 @@ impl Launcher {
|
|||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let mut width_remaining: i32 = 1232 - x_off as i32;
|
let mut width_remaining: i32 = 1232 - x_off as i32;
|
||||||
for (idx, m) in self.matches.iter().enumerate() {
|
for (idx, m) in self.matches.iter().enumerate() {
|
||||||
let mut b =
|
let mut b = match buf.subdimensions((x_off, 0, width_remaining as u32, 32)) {
|
||||||
match buf.subdimensions((x_off, 0, width_remaining as u32, 32)) {
|
|
||||||
Ok(b) => b,
|
Ok(b) => b,
|
||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
};
|
};
|
||||||
@@ -141,7 +143,7 @@ impl Launcher {
|
|||||||
|
|
||||||
if let Some(result) = &self.result {
|
if let Some(result) = &self.result {
|
||||||
self.font.borrow_mut().auto_draw_text(
|
self.font.borrow_mut().auto_draw_text(
|
||||||
&mut buf.subdimensions((x_off, 0, 1232-x_off, 32))?,
|
&mut buf.subdimensions((x_off, 0, 1232 - x_off, 32))?,
|
||||||
bg,
|
bg,
|
||||||
&Color::new(0.75, 0.75, 0.75, 1.0),
|
&Color::new(0.75, 0.75, 0.75, 1.0),
|
||||||
&format!(" = {:}", result),
|
&format!(" = {:}", result),
|
||||||
@@ -207,13 +209,18 @@ impl ModuleImpl for Launcher {
|
|||||||
Err(_) => self.result = None,
|
Err(_) => self.result = None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Some('!') => (),
|
Some('!') => (),
|
||||||
_ => {
|
_ => {
|
||||||
let mut m = self
|
let mut m = self
|
||||||
.options
|
.options
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| (fuzzy_match(&x.to_lowercase(), &self.input.to_lowercase()), x))
|
.map(|x| {
|
||||||
|
(
|
||||||
|
fuzzy_match(&x.to_lowercase(), &self.input.to_lowercase()),
|
||||||
|
x,
|
||||||
|
)
|
||||||
|
})
|
||||||
.filter(|(x, _)| x.is_some())
|
.filter(|(x, _)| x.is_some())
|
||||||
.map(|(x, y)| (x.unwrap(), y.to_string()))
|
.map(|(x, y)| (x.unwrap(), y.to_string()))
|
||||||
.collect::<Vec<(i64, String)>>();
|
.collect::<Vec<(i64, String)>>();
|
||||||
@@ -261,10 +268,12 @@ impl ModuleImpl for Launcher {
|
|||||||
println!("{}", self.input.chars().skip(1).collect::<String>());
|
println!("{}", self.input.chars().skip(1).collect::<String>());
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
_ => if self.matches.len() > self.offset {
|
_ => {
|
||||||
|
if self.matches.len() > self.offset {
|
||||||
println!("{}", self.matches[self.offset]);
|
println!("{}", self.matches[self.offset]);
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
keysyms::XKB_KEY_Right => {
|
keysyms::XKB_KEY_Right => {
|
||||||
|
|||||||
Reference in New Issue
Block a user