joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

Cursor becomes invisible after exiting notebook #30

Closed remifan closed 1 year ago

remifan commented 1 year ago

Very impressive repo!

This minor issue is annoying that I have to enter then exit Tmux to recover the cursor.

This behaviour has been confirmed in Kitty, iTem2 and Windows Terminal, so I believe it is not Terminal Emulator-related issue.

joouha commented 1 year ago

Thanks! And thanks for reporting this.

It seems that the terminal cursor is being left hidden when euporie exits, which shouldn't be happening.

When you exit tmux, it will set the terminal cursor to visible, which is done using a DECTCEM escape sequence. You could also set the cursor to visible with the following:

echo -e "\e[25h"

In prompt_toolkit (which euporie uses to interact with the terminal), the renderer should show the cursor when the application exits (here). But for some reason this does not seem to be working.

I shall investigate further!

joouha commented 1 year ago

I've found the problem - I had erase_when_done set to True for the notebook app. It looks like prompt_toolkit will not reset the terminal if an application is full-screen and erase_when_done is set to True. I reckon this is a bug in prompt_toolkit - I think erase_when_done should be ignored for full-screen applications. I've sumitted a PR for this upstream.

I the mean-time, I've fixed this by setting erase_when_done to False in euporie-notebook. If you'd like to test this fix in v2.0.3, I'd be grateful to hear if this has sorted the problem for you.

remifan commented 1 year ago

Thanks for this quick fix! This problem is solved in the v2.0.5 release