mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Merge pull request #325 from chrisvest/faster-with_color-ncurses
Use a single hashmap lookup instead of two for resolving ncurses colours.
This commit is contained in:
commit
af566dd57f
@ -153,12 +153,13 @@ impl Backend {
|
|||||||
let mut pairs = self.pairs.borrow_mut();
|
let mut pairs = self.pairs.borrow_mut();
|
||||||
|
|
||||||
// Find if we have this color in stock
|
// Find if we have this color in stock
|
||||||
let (front, back) = find_closest_pair(pair);
|
let result = find_closest_pair(pair);
|
||||||
if pairs.contains_key(&(front, back)) {
|
let lookup = pairs.get(&result);
|
||||||
|
if lookup.is_some() {
|
||||||
// We got it!
|
// We got it!
|
||||||
pairs[&(front, back)]
|
*lookup.unwrap()
|
||||||
} else {
|
} else {
|
||||||
self.insert_color(&mut *pairs, (front, back))
|
self.insert_color(&mut *pairs, result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user