Upper limit of mousechar start is UCHAR_MAX - 3, not UCHAR_MAX - 4

Restore original characters when mousechar start changes, not always 0-3

PR:		24437
Submitted by:	Cejka Rudolf <cejkar@dcse.fee.vutbr.cz>
This commit is contained in:
Andrey A. Chernov 2001-04-21 14:11:48 +00:00
parent 4d98b7a61b
commit 475693945d

View File

@ -876,13 +876,15 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
if (mouse->u.mouse_char < 0) { if (mouse->u.mouse_char < 0) {
mouse->u.mouse_char = scp->sc->mouse_char; mouse->u.mouse_char = scp->sc->mouse_char;
} else { } else {
if (mouse->u.mouse_char >= UCHAR_MAX - 4) if (mouse->u.mouse_char > UCHAR_MAX - 3)
return EINVAL; return EINVAL;
s = spltty(); s = spltty();
sc_remove_all_mouse(scp->sc); sc_remove_all_mouse(scp->sc);
#ifndef SC_NO_FONT_LOADING #ifndef SC_NO_FONT_LOADING
if (ISTEXTSC(cur_scp) && (cur_scp->font != NULL)) if (ISTEXTSC(cur_scp) && (cur_scp->font != NULL))
sc_load_font(cur_scp, 0, cur_scp->font_size, cur_scp->font, sc_load_font(cur_scp, 0, cur_scp->font_size,
cur_scp->font + cur_scp->font_size
* cur_scp->sc->mouse_char,
cur_scp->sc->mouse_char, 4); cur_scp->sc->mouse_char, 4);
#endif #endif
scp->sc->mouse_char = mouse->u.mouse_char; scp->sc->mouse_char = mouse->u.mouse_char;