rockorager/libvaxis

Cursor Reset

karlseguin opened this issue · 3 comments

Thanks for the library.

This might just be something I'm doing wrong, but if I take the starter example and add:

win.setCursorShape(.beam_blink);
win.showCursor(1, 1);`

at the end of the draw method. When I exit the app (ctrl-c), the cursor shape doesn't get reset. From the documentation, I feel that the call to self.vx.deinit() should be good enough since it "Resets the terminal to it's original state".

There is no way to get the state of the cursor shape from the terminal. Some terminals implement \x1B[ q to set the shape to the user configured default, but not all. I think a decent fallback would be to just reset it using that sequence, but this will still break for some people. The best way to handle this currently is for your shell to always set the cursor shape after the command has run (I believe fish already does this, for example).

Thanks for the answer, it helps