cargo-fmt, version update
This commit is contained in:
parent
f41d3dd55a
commit
b49d93dc96
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "neovim-gtk"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["daa84 <daa84@inbox.ru>"]
|
||||
build = "build.rs"
|
||||
|
||||
|
27
src/nvim.rs
27
src/nvim.rs
@ -75,7 +75,7 @@ pub fn initialize(ui: &mut Ui) -> Result<()> {
|
||||
nvim.session.start_event_loop_cb(move |m, p| nvim_cb(m, p));
|
||||
// fix neovim --embed bug to start embed mode
|
||||
nvim.input("i").unwrap();
|
||||
try!(nvim.ui_attach(80, 24, true).map_err(|e| Error::new(ErrorKind::Other, e)));
|
||||
nvim.ui_attach(80, 24, true).map_err(|e| Error::new(ErrorKind::Other, e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -139,19 +139,9 @@ fn call(method: &str, args: Vec<Value>) {
|
||||
safe_call(move |ui| {
|
||||
if let Value::Map(ref attrs) = args[0] {
|
||||
let attrs_map: HashMap<String, Value> = attrs.iter()
|
||||
.map(|v| {
|
||||
match v {
|
||||
&(Value::String(ref key),
|
||||
ref value) => {
|
||||
(key.clone(),
|
||||
value.clone())
|
||||
}
|
||||
_ => {
|
||||
panic!("attribute \
|
||||
key must be \
|
||||
string")
|
||||
}
|
||||
}
|
||||
.map(|v| match v {
|
||||
&(Value::String(ref key), ref value) => (key.clone(), value.clone()),
|
||||
_ => panic!("attribute key must be string"),
|
||||
})
|
||||
.collect();
|
||||
ui.on_highlight_set(&attrs_map);
|
||||
@ -169,7 +159,10 @@ fn call(method: &str, args: Vec<Value>) {
|
||||
}
|
||||
"set_scroll_region" => {
|
||||
safe_call(move |ui| {
|
||||
ui.on_set_scroll_region(try_uint!(args[0]), try_uint!(args[1]), try_uint!(args[2]), try_uint!(args[3]));
|
||||
ui.on_set_scroll_region(try_uint!(args[0]),
|
||||
try_uint!(args[1]),
|
||||
try_uint!(args[2]),
|
||||
try_uint!(args[3]));
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
@ -217,10 +210,8 @@ fn safe_call<F>(cb: F)
|
||||
where F: Fn(&mut Ui) -> result::Result<(), String> + 'static + Send
|
||||
{
|
||||
glib::idle_add(move || {
|
||||
ui::UI.with(|ui_cell| {
|
||||
if let Err(msg) = cb(&mut *ui_cell.borrow_mut()) {
|
||||
ui::UI.with(|ui_cell| if let Err(msg) = cb(&mut *ui_cell.borrow_mut()) {
|
||||
println!("Error call function: {}", msg);
|
||||
}
|
||||
});
|
||||
glib::Continue(false)
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user