Skip to content

Commit

Permalink
Fix regression with setting UI options
Browse files Browse the repository at this point in the history
As @bellini666 [pointed
out](daa84#267 (comment))
it seems that I accidentally broke the ability to set UI options when
converting to nvim-rs. We both were using the wrong API call
(nvim.set_option() instead of nvim.ui_set_option()) and accidentally adding
a space between "ext_" and the name of the UI option. So, let's fix that.
  • Loading branch information
Lyude committed Oct 16, 2021
1 parent 95a92d9 commit 4e466e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nvim/redraw_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ macro_rules! set_ui_opts {
$ui.nvim()
.ok_or_else(|| "Nvim not initialized".to_owned())
.and_then(|nvim| {
set_ui_opt(&nvim, stringify!(ext_$first_opt), &$first_val)
$( $( ?; set_ui_opt(&nvim, stringify!(ext_$opt), &$val) )* )?
set_ui_opt(&nvim, concat!("ext_", stringify!($first_opt)), &$first_val)
$( $( ?; set_ui_opt(&nvim, concat!("ext_", stringify!($opt)), &$val) )* )?
})
};
}

fn set_ui_opt(nvim: &NvimSession, opt: &str, val: &Value) -> Result<(), String> {
nvim.block_timeout(nvim.set_option(opt, Value::from(try_uint!(val) == 1)))
nvim.block_timeout(nvim.ui_set_option(opt, Value::from(try_uint!(val) == 1)))
.map_err(|e| e.to_string())
}

Expand Down

0 comments on commit 4e466e3

Please sign in to comment.