insanum / sncli

Simplenote CLI
MIT License
397 stars 34 forks source link

Cursor not displayed when using VIM as editor. #78

Open ZaxonXP opened 5 years ago

ZaxonXP commented 5 years ago

When I open sncli in uxterm I have a nice colors of the notes. However when I start editing the note in my VIM editor, then I do not see the cursor, so it is hard to edit.

If I close sncli and open VIM in the same terminal I can see the cursor. Is this sncli issue or do I need to change something somewhere else?

I tried with nano and xfce4-terminal I had the same issue.

samuelallan72 commented 5 years ago

Yeah I've had that issue before. Unfortunately I can't remember what caused it. I believe it's related to how the sncli ui hides the terminal cursor and for some reason it doesn't get reset when launching the editor. I'll let you know if I find anything more.

N0ury commented 5 years ago

@ZaxonXP What colors are you talking about ? I have colors only in:

ZaxonXP commented 5 years ago

@nbenm If I hit e on any note in order to edit it my editor will load (vim) but the cursor is hidden, so it is hard to edit anything without seeing the cursor.

samuelallan72 commented 5 years ago

@ZaxonXP which version of urwid do you have installed? Apparently older versions are known to have that behaviour.

EDIT: pip show urwid from the same environment as sncli should get the version

ZaxonXP commented 5 years ago
pip3 install urwid
Requirement already satisfied: urwid in /usr/local/lib/python3.5/dist-packages (2.0.1)
samuelallan72 commented 5 years ago

Hmm that's the latest version. Not sure what is going on. :/

ZaxonXP commented 5 years ago

Is there any other action I can do to help to debug it?

Debian GNU/Linux 9.6 (stretch)

N0ury commented 5 years ago

I don't have this issue on Mac. I have tried uxterm with XQuartz, and OsX Terminal app In both cases I can see the cursor in edit mode. I use urwid 2.0.1 too.

ZaxonXP commented 5 years ago

For the time being is there a way to use GUI editor somehow?

Currently if I set up EDITOR=gvim and edit a note then editors open with an empty temp file and sncli goes back to displaying the list of notes.

N0ury commented 5 years ago

@ZaxonXP if you have a .vimrc file, you can try to rename it and try again

ZaxonXP commented 5 years ago

Renamed .vimrc file, but this did not change anything. :(

N0ury commented 5 years ago

Renamed .vimrc file, but this did not change anything. :(

Yes, I didn't see that you have the same issue with nano... I'll try on a debian unstable tomorrow and tell you how it works.

samuelallan72 commented 5 years ago

Currently if I set up EDITOR=gvim and edit a note then editors open with an empty temp file and sncli goes back to displaying the list of notes.

Yes sncli isn't compatible with editors that fork. You can use gvim if you pass the -f flag (stay in foreground):

cfg_editor = gvim -f
N0ury commented 5 years ago

I have just tried on Debian (unstable) with uxterm. It works fine, cursor is visible in edit mode with vim.

ZaxonXP commented 5 years ago

But I do not want to use unstable version. :(

Haikyy commented 5 years ago

I'm on a stable Ubuntu, when I hit space for editing, the red highlight disappears to enter in editor mode but the cursor is not appearing because it is not entered in vim edition mode, every key like q for quit or j and k to move up/down are still activated

samuelallan72 commented 5 years ago

@Haikyy What terminal emulator are you using? Also can you post the output of echo $TERM?

ZaxonXP commented 5 years ago

@swalladge: In my case echo $TERM shows xterm-color and in all terminals I use (xterm, uxterm, xfce4-terminal) cursor is not visible when I edit (Debian 9.9 x64).

N0ury commented 5 years ago

@ZaxonXP Debian 10 has been released. Maybe you can upgrade and try again.

Haikyy commented 5 years ago

@swalladge it's the default gnome terminal on Ubuntu 18.04. echo $TERM-> xterm-256color

ZaxonXP commented 5 years ago

@ZaxonXP Debian 10 has been released. Maybe you can upgrade and try again.

@nbenm : I just upgraded to Debian 10 and indeed it is working correctly (cursor is visible in vim). :)