From d071cabce612d0b30ba4cd5aba0c376dd72be06c Mon Sep 17 00:00:00 2001 From: daa Date: Tue, 3 May 2016 13:34:36 +0300 Subject: [PATCH] Code style update --- src/input.rs | 9 +++++---- src/ui.rs | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/input.rs b/src/input.rs index 97267ae..1fe0e2d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -30,13 +30,14 @@ pub fn convert_key(ev: &EventKey) -> Option { return Some(keyval_to_input_string(cnvt, state)); } } + if let Some(ch) = gdk::keyval_to_unicode(keyval) { - return Some(if !state.is_empty() { + Some(if !state.is_empty() { keyval_to_input_string(&ch.to_string(), state) } else { ch.to_string() - }); + }) + } else { + None } - - None } diff --git a/src/ui.rs b/src/ui.rs index 15b8fd7..24c7d19 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -220,8 +220,7 @@ fn draw(ui: &Ui, ctx: &cairo::Context) { } let fg = if let Some(ref fg) = cell.attrs.foreground { fg - } - else { + } else { &ui.fg_color }; ctx.set_source_rgb(fg.0, fg.1, fg.2); @@ -313,8 +312,7 @@ impl RedrawEvents for Ui { fn on_update_bg(&mut self, bg: i64) { if bg >= 0 { self.bg_color = split_color(bg as u64); - } - else { + } else { self.bg_color = COLOR_BLACK; } } @@ -322,12 +320,10 @@ impl RedrawEvents for Ui { fn on_update_fg(&mut self, fg: i64) { if fg >= 0 { self.fg_color = split_color(fg as u64); - } - else { + } else { self.fg_color = COLOR_WHITE; } } - } fn split_color(indexed_color: u64) -> Color {