Restore cursor when exiting alt mode.

If the mouse cursor is changed to a bar or an underline then st will use that
when the terminal is first opened. When an application that changes the cursor
via escape sequences is executed, e.g. vim which uses a block cursor by default,
then that cursor will remain after exiting the program.

This change sets the cursor back to default when exiting alt mode.
This commit is contained in:
bakkeby 2021-05-11 10:12:23 +02:00
parent 78e025a0e7
commit 52900255d9
3 changed files with 13 additions and 0 deletions

2
st.c
View File

@ -1379,6 +1379,8 @@ tswapscreen(void)
term.images_alt = im;
#endif // SIXEL_PATCH
term.mode ^= MODE_ALTSCREEN;
if (!IS_SET(MODE_ALTSCREEN))
xsetdefaultcursor();
tfulldirt();
}

1
win.h
View File

@ -43,6 +43,7 @@ int xsetcolorname(int, const char *);
void xseticontitle(char *);
void xsettitle(char *);
int xsetcursor(int);
void xsetdefaultcursor(void);
void xsetmode(int, unsigned int);
void xsetpointermotion(int);
void xsetsel(char *);

10
x.c
View File

@ -2414,6 +2414,16 @@ xsetcursor(int cursor)
return 0;
}
void
xsetdefaultcursor(void)
{
#if BLINKING_CURSOR_PATCH
xsetcursor(cursorstyle);
#else
xsetcursor(cursorshape);
#endif // BLINKING_CURSOR_PATCH
}
void
xseturgency(int add)
{