Merge branch 'master' of https://github.com/daa84/neovim-gtk
This commit is contained in:
commit
df0f6a8478
@ -67,7 +67,6 @@ macro_rules! try_uint {
|
||||
|
||||
pub fn initialize(ui: &mut Ui, nvim_bin_path: Option<&String>) -> Result<()> {
|
||||
let session = if let Some(path) = nvim_bin_path {
|
||||
println!("{}", path);
|
||||
Session::new_child_path(path)?
|
||||
} else {
|
||||
Session::new_child()?
|
||||
@ -193,14 +192,13 @@ fn safe_call<F>(cb: F)
|
||||
}
|
||||
|
||||
pub trait ErrorReport {
|
||||
fn report_err(&self, nvim: &mut NeovimApi, ctx_msg: &str);
|
||||
fn report_err(&self, nvim: &mut NeovimApi);
|
||||
}
|
||||
|
||||
impl<T> ErrorReport for result::Result<T, String> {
|
||||
fn report_err(&self, _: &mut NeovimApi, ctx_msg: &str) {
|
||||
fn report_err(&self, _: &mut NeovimApi) {
|
||||
if let &Err(ref msg) = self {
|
||||
let err_msg = format!("{} {}", ctx_msg, msg);
|
||||
println!("{}", err_msg);
|
||||
println!("{}", msg);
|
||||
//nvim.report_error(&err_msg).expect("Error report error :)");
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ fn edit_paste() {
|
||||
};
|
||||
|
||||
let mut nvim = ui.nvim();
|
||||
nvim.input(paste_command).report_err(nvim, "Error paste from clipboard");
|
||||
nvim.input(paste_command).report_err(nvim);
|
||||
});
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ fn edit_save_all() {
|
||||
let mut ui = ui_cell.borrow_mut();
|
||||
|
||||
let mut nvim = ui.nvim();
|
||||
nvim.command(":wa").report_err(nvim, "Error save all files");
|
||||
nvim.command(":wa").report_err(nvim);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,17 @@ pub struct UiModel {
|
||||
|
||||
impl UiModel {
|
||||
pub fn empty() -> UiModel {
|
||||
UiModel::new(0, 0)
|
||||
UiModel {
|
||||
columns: 0,
|
||||
rows: 0,
|
||||
cur_row: 0,
|
||||
cur_col: 0,
|
||||
model: vec![],
|
||||
top: 0,
|
||||
bot: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new(rows: u64, columns: u64) -> UiModel {
|
||||
@ -94,9 +104,9 @@ impl UiModel {
|
||||
cur_col: 0,
|
||||
model: model,
|
||||
top: 0,
|
||||
bot: 0,
|
||||
bot: (rows - 1) as usize,
|
||||
left: 0,
|
||||
right: 0,
|
||||
right: (columns - 1) as usize,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user