daa84 / neovim-gtk

gtk ui for neovim
GNU General Public License v3.0
718 stars 56 forks source link

GTK clipboard part 2 #42

Closed valpackett closed 6 years ago

valpackett commented 6 years ago

Actually, register type should be stored in the GTK clipboard, like in good old GVim. I'm looking into this, including https://github.com/gtk-rs/gtk/issues/591

daa84 commented 6 years ago

Ok, thanks i test it later Another problem i find in part 1 is paste with toolbar button make neovimgtk freeze. Looks like some problem with combination of call to neovim rpc with paste processing.

valpackett commented 6 years ago

oh. Does it say anything about mutexes being already locked on the console?

daa84 commented 6 years ago

Ok for me primary clipboard works ok :+1:

About freeze: it does not print anything in console. I think problem that to paste nvim_command function is used - and this is function 'sync', so it waits for response. While it wait - main thread is locked, so function that get clipboard content also wait. nvim_input - that used for user input is 'async', so it does not wait for execution and in this case all works without problem.

So i see a number of possible solutions:

  1. rewrite paste code from command to input function
  2. implement special wait code for function call that does not stop main thread, but check lock and execute gtk_main_iteration_do in loop.
  3. generate async versions of all functions in neovim-lib, so we don't wait for response

i like 2 solution :smile: because it prevent future bugs with same problem also return value of call still can be used.

daa84 commented 6 years ago

Think I implement fix 2 as it also must fix some other issue

daa84 commented 6 years ago

Solution 2 was bad because of all this RefCell stuff. So i implement 3 and looks like it works :smiley: So now it works