Modified 'setup_changed_listeners' for compatibility with neovim versions < 0.4.3

macos-click-through
Tristan C 5 years ago
parent b337d83548
commit b25e86aebe

@ -130,12 +130,16 @@ impl Settings {
pub async fn setup_changed_listeners(&self, nvim: &Neovim<Compat<ChildStdin>>) { pub async fn setup_changed_listeners(&self, nvim: &Neovim<Compat<ChildStdin>>) {
let keys : Vec<String> = self.settings.lock().keys().cloned().collect(); let keys : Vec<String> = self.settings.lock().keys().cloned().collect();
for name in keys { for name in keys {
let vimscript = let vimscript = format!(
format!("function NeovideNotify{}Changed(d, k, z)\n", name) + concat!(
&format!(" call rpcnotify(1, \"setting_changed\", \"{}\", g:neovide_{})\n", name, name) + "exe \"",
"endfunction\n" + "fun! NeovideNotify{0}Changed(d, k, z)\n",
&format!("call dictwatcheradd(g:, \"neovide_{}\", \"NeovideNotify{}Changed\")", name, name); "call rpcnotify(1, 'setting_changed', '{0}', g:neovide_{0})\n",
nvim.exec(&vimscript, false).await "endf\n",
"call dictwatcheradd(g:, 'neovide_{0}', 'NeovideNotify{0}Changed')\"",
)
, name);
nvim.command(&vimscript).await
.unwrap_or_explained_panic(&format!("Could not setup setting notifier for {}", name)); .unwrap_or_explained_panic(&format!("Could not setup setting notifier for {}", name));
} }
} }

Loading…
Cancel
Save