Fix popup colors not being reversed

This commit is contained in:
Christopher Lübbemeier 2017-12-24 15:11:37 +01:00
parent f5c86868fe
commit 09b8253745

View File

@ -57,10 +57,14 @@ fn get_hl_colors(nvim: &mut Neovim, hl: &str) -> (Option<Color>, Option<Color>)
nvim.get_hl_by_name(hl, true)
.ok_and_report()
.and_then(|m| if let Some(m) = m.to_attrs_map_report() {
Some((
get_hl_color(&m, "background"),
get_hl_color(&m, "foreground"),
))
let reverse = m.get("reverse").and_then(|v| v.as_bool()).unwrap_or(false);
let bg = get_hl_color(&m, "background");
let fg = get_hl_color(&m, "foreground");
if reverse {
Some((fg, bg))
} else {
Some((bg, fg))
}
} else {
None
})