gyim / vim-boxdraw

An ASCII box drawing plugin for Vim
MIT License
194 stars 18 forks source link

Empty document after drawing #3

Closed treuss closed 5 years ago

treuss commented 5 years ago

Hi,

lately, boxdraw would empty my whole files after I used any of the boxdraw commands. When using +O I can enter a label, but vim show the following message:

Shell returned 1
x lines filtered

My setup:

Since I've run out of ideas why this happens, maybe you can give me a hint?

Best regards and thanks in advance Thomas

gyim commented 5 years ago

Hi Thomas,

The plugin works by sending the buffer contents to a Python script via stdin, and replacing it with the script output. The script has no external dependencies, only Python. So I think something basic is missing, and the script cannot start.

Try executing the script from a shell:

cd ~/.vim/bundle/vim-boxdraw/python
./boxdraw.py +O 0 0 2 10 hello

Enter a few empty lines, then press Ctrl-D (maybe it's Ctrl-Z in Windows, the point is to stop stdin).

It should return something like this:

+---------+
|  hello  |
+---------+

I haven't tested the plugin in Windows, maybe it should execute Python differently there (e.g. run python.exe boxdraw.py instead of just boxdraw.py). This is the part that calls the script, maybe it should be modified a bit: https://github.com/gyim/vim-boxdraw/blob/dc2800086356be09c41876e8c67b4de8fca71b45/plugin/boxdraw.vim#L25-L35

treuss commented 5 years ago

Hi Akos,

thanks for your reply!

When I execute the script as you show above, it immediately returns to the shell (cmd and powershell) without any output. I don't even have the occasion to enter CTRL-D/CTRL-Z.

Update to python 3.7.1 also didn't bring any success.

Thomas

On Thu, Dec 13, 2018 at 8:41 AM Akos Gyimesi notifications@github.com wrote:

Hi Thomas,

The plugin works by sending the buffer contents to a Python script via stdin, and replacing it with the script output. The script has no external dependencies, only Python. So I think something basic is missing, and the script cannot start.

Try executing the script from a shell:

cd ~/.vim/bundle/vim-boxdraw/python ./boxdraw.py +O 0 0 2 10 hello

Enter a few empty lines, then press Ctrl-D (maybe it's Ctrl-Z in Windows, the point is to stop stdin).

It should return something like this:

+---------+ | hello | +---------+

I haven't tested the plugin in Windows, maybe it should execute Python differently there (e.g. run python.exe boxdraw.py instead of just boxdraw.py). This is the part that calls the script, maybe it should be modified a bit: https://github.com/gyim/vim-boxdraw/blob/dc2800086356be09c41876e8c67b4de8fca71b45/plugin/boxdraw.vim#L25-L35

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gyim/vim-boxdraw/issues/3#issuecomment-446871777, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXepYsZSfbm0b3u5W5IXaDLHnUxysyGks5u4gSwgaJpZM4ZQDYU .

--

threema://add?id=TD2J9FS2

XMPP/Jabber: treuss@jabber.de

PGP fingerprint:

7EF9 C540 E713 E081 90E5 3913 0F01 8742 F245 D553

Find me on https://keybase.io/treuss

treuss commented 5 years ago

Hi Akos,

sorry for disturbing you again.

I found the root cause while experimenting with the Python script. It cannot be run using the SheBang-Line, like in Linux. Windows does not execute the python script the right way. I don't know why, but if I modify your plugin code, boxdraw works again:

let s:drawscript = "python " . expand(':p:h:h') . "/python/boxdraw.py"

Best regards Thomas

On Thu, Dec 13, 2018 at 8:41 AM Akos Gyimesi notifications@github.com wrote:

Hi Thomas,

The plugin works by sending the buffer contents to a Python script via stdin, and replacing it with the script output. The script has no external dependencies, only Python. So I think something basic is missing, and the script cannot start.

Try executing the script from a shell:

cd ~/.vim/bundle/vim-boxdraw/python ./boxdraw.py +O 0 0 2 10 hello

Enter a few empty lines, then press Ctrl-D (maybe it's Ctrl-Z in Windows, the point is to stop stdin).

It should return something like this:

+---------+ | hello | +---------+

I haven't tested the plugin in Windows, maybe it should execute Python differently there (e.g. run python.exe boxdraw.py instead of just boxdraw.py). This is the part that calls the script, maybe it should be modified a bit: https://github.com/gyim/vim-boxdraw/blob/dc2800086356be09c41876e8c67b4de8fca71b45/plugin/boxdraw.vim#L25-L35

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gyim/vim-boxdraw/issues/3#issuecomment-446871777, or mute the thread https://github.com/notifications/unsubscribe-auth/ADXepYsZSfbm0b3u5W5IXaDLHnUxysyGks5u4gSwgaJpZM4ZQDYU .

--

threema://add?id=TD2J9FS2

XMPP/Jabber: treuss@jabber.de

PGP fingerprint:

7EF9 C540 E713 E081 90E5 3913 0F01 8742 F245 D553

Find me on https://keybase.io/treuss

gyim commented 5 years ago

Hi @treuss,

Sorry, I forgot about this ticket. Can you test it with PR #9? It will hopefully fix the problem.

treuss commented 5 years ago

Hi @gyim ,

looks like the issue is gone 👍 I did a :PluginUpdate in Vundle.

Thanks and best regards Thomas

gyim commented 5 years ago

Thank you for the test! I'll close this ticket then.