Merge pull request #148 from TristanCrawford/api-fix

Modified 'setup_changed_listeners' for compatibility with 0.4.2
macos-click-through
Keith Simmons 5 years ago committed by GitHub
commit 16d2d75f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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