caleb-allen / VimBindings.jl

Vim bindings for the Julia REPL
https://caleb-allen.github.io/VimBindings.jl/
MIT License
111 stars 3 forks source link

return cursor to normal mode upon exiting #72

Closed bjarthur closed 1 year ago

bjarthur commented 1 year ago

my cursor in bash is a rectangle. when i start julia with VimBindings, it changes to a vertical line. insert mode. if i then exit julia in this state, my bash cursor is now a vertical line. if before exiting julia i hit escape to enter normal mode, the cursor becomes a rectangle. if i then exit julia, my bash cursor is now a rectangle.

is there a way to retain the previous bash cursor shape irrespective of the state of the julia cursor when you exit?

thanks for this pkg btw! i'm loving it!!

caleb-allen commented 1 year ago

Thank you for the report!

This sounds similar to #51 - I'm fairly certain that I that what needs to be done is to print a "revert cursor to default" control sequence to the terminal. I haven't dug into exactly where to do that—Julia provides the atreplinit hook for hooking into the start behavior, so I'll need to find a way to get something like atreplexit behavior. Probably will end up being a fairly simple change.

I'm curious, what terminal and OS are you running? I'm still learning where the responsibility of cursor control lies, and I see a lot of different behavior. I observe the same behavior that you report when I use bash (in the terminal alacritty), but not fish, so I thought it was under the control of the shell, but it appears that when I use fish within the embedded terminal of vs-code I see this behavior there too, so it must not just be the shell alone?

Regardless, the fix is to print the "revert" sequence to the terminal upon exiting the REPL.

As a temporary (and annoying) fix, I believe this command can be used to reset the cursor to its default state:

printf "\e[0 q"
caleb-allen commented 1 year ago

Well what do you know! There is a function for exit callback, atexit. Makes this much easier than I thought!

bjarthur commented 1 year ago

great! to answer your question, i'm using the MacOS Terminal app.

caleb-allen commented 1 year ago

@bjarthur the package now reverts the cursor to block style when exiting. I've just published version 0.3.6, if you update the package this should be fixed.

Let me know if you still see this issue!

Thanks

bjarthur commented 1 year ago

works, thanks!