Don't update buffer on empty data (#91)

This commit is contained in:
daa 2018-04-26 22:20:19 +03:00
parent b44799bef7
commit be52075095

View File

@ -93,9 +93,7 @@ fn main() {
gtk::Application::new(Some("org.daa.NeovimGtk"), app_flags) gtk::Application::new(Some("org.daa.NeovimGtk"), app_flags)
}.expect("Failed to initialize GTK application"); }.expect("Failed to initialize GTK application");
app.connect_activate(move |app| { app.connect_activate(move |app| activate(app, input_data.replace(None)));
activate(app, input_data.replace(None))
});
app.connect_open(open); app.connect_open(open);
let new_window_action = gio::SimpleAction::new("new-window", None); let new_window_action = gio::SimpleAction::new("new-window", None);
@ -178,7 +176,8 @@ fn read_piped_input() -> Option<String> {
if atty::isnt(atty::Stream::Stdin) { if atty::isnt(atty::Stream::Stdin) {
let mut buf = String::new(); let mut buf = String::new();
match std::io::stdin().read_to_string(&mut buf) { match std::io::stdin().read_to_string(&mut buf) {
Ok(_) => Some(buf), Ok(size) if size > 0 => Some(buf),
Ok(_) => None,
Err(err) => { Err(err) => {
error!("Error read stdin {}", err); error!("Error read stdin {}", err);
None None