-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: recover nvim-ghost buffer #47
Comments
Okay, two ways come to my mind -
BTW, sorry for the late reply. These last few months were pretty hectic for me. |
Thanks, happy to see this move forward. Think I'd prefer way number 2 so wouldn't have to worry about remembering to run |
Note to self (Implementation details)
TIPS
|
Try the |
@mikaraunio Have you tried the |
@subnut Sorry for the delay. I Trying it now and seeing the following:
|
Personal note (sample log) -
Buffer stays (ie. isn't deleted) but the text is gone. |
Further investigation needed.
Probable race condition or what? |
Correction to my comment above, confirm I'm seeing the same thing as you: the buffer stays, but the text is gone. |
Hello, fellow Neovimers. I found out about this project from another person and so far this project looks promising. Even though some things are a hustle to do, but in the end the advantages are so worth it (for some use cases). Anyway, I wanted to share my patch that I successfully made and it works great. This probably should go into the code base, but since I've made it more Unix-like (I'm using Linux btw), it just not at the cross-platform level yet to be a proper PR. Here is the patch: patchdiff --git a/binary.py b/binary.py
index 6d12314..0e8e34b 100644
--- a/binary.py
+++ b/binary.py
@@ -1,3 +1,4 @@
+import datetime
import json
import os
import random
@@ -341,9 +342,10 @@ class GhostWebSocket(WebSocket):
global FOCUSED_NVIM_ADDRESS
self.neovim_address = FOCUSED_NVIM_ADDRESS
self.neovim_handle = pynvim.attach("socket", path=self.neovim_address)
- self.buffer_handle = self.neovim_handle.api.create_buf(False, True)
+ basename = datetime.datetime.now().isoformat(timespec='seconds')
+ self.neovim_handle.command(f"tabe /tmp/GhostText_message_{basename}.md")
+ self.buffer_handle = self.neovim_handle.api.get_current_buf()
self.neovim_handle.api.buf_set_option(self.buffer_handle, "bufhidden", "wipe")
- self.neovim_handle.command(f"tabe | {self.buffer_handle.number}buffer")
self.handle_neovim_notifications = True
self._start_neovim_listener()
So it basically changes how it previously created a buffer and what you can do with it. Initially it would've created 2 buffers one of which isn't used, and the other is the used one, but it is unnamed, and therefore can't be used with LSP servers like ltex-ls for grammar checking (LanguageTool wrapper). And also it's harder to save the message in case you need to save it and/or go back to it. So this patch also saves all messages "just in case" (and creates only 1 new buffer). I thought that it's better to use The only nifty features that I would like to add is a URL-based file name. It's like screenshots that you can find in Android that are named with app's name in the file name, because it was taken while that app was opened on the screen. So it will be just like that, but instead there will be just URLs. It can be only domain-based or a full URL, so that you can go back and see where exactly did you write that message (combined with a timestamp it would be a perfect combo). Since you can add Oh, and also the command from the workflow didn't work locally (with an active venv dir), so instead I had to add pyinstaller --onefile --distpath . --paths .venv/lib/python3.10/site-packages binary.py --name nvim-ghost-binary And the binary went from 20.4 MiB to 12.43 MiB compared to the release binary. (Of course this comment was written with GhostText and the patched version.) |
It seems that currently, nvim-ghost buffers are permanently deleted when the browser disconnects.
I'd love to have a way to recover their content, in case of a server error on form submit, browser crash etc.
The text was updated successfully, but these errors were encountered: