should free token_str if not used
[unix-history] / usr / src / usr.bin / window / wwcursor.c
CommitLineData
120c3815 1#ifndef lint
35ffbdff 2static char *sccsid = "@(#)wwcursor.c 3.6 83/12/06";
120c3815
EW
3#endif
4
5#include "ww.h"
6
7wwcursor(w, on)
8register struct ww *w;
9{
10 register char *win;
120c3815
EW
11
12 if (on) {
13 if (w->ww_hascursor)
14 return;
15 w->ww_hascursor = 1;
16 } else {
17 if (!w->ww_hascursor)
18 return;
19 w->ww_hascursor = 0;
20 }
21 if (wwcursormodes != 0) {
22 win = &w->ww_win[w->ww_cur.r][w->ww_cur.c];
120c3815 23 *win ^= wwcursormodes;
f2a77fe1
EW
24 if (w->ww_cur.r < w->ww_i.t || w->ww_cur.r >= w->ww_i.b
25 || w->ww_cur.c < w->ww_i.l || w->ww_cur.c >= w->ww_i.r)
19f9784c 26 return;
f2a77fe1 27 if (wwsmap[w->ww_cur.r][w->ww_cur.c] == w->ww_index) {
84ad208b
EW
28 if (*win == 0)
29 w->ww_nvis[w->ww_cur.r]++;
30 else if (*win == wwcursormodes)
31 w->ww_nvis[w->ww_cur.r]--;
f2a77fe1 32 wwns[w->ww_cur.r][w->ww_cur.c].c_m ^= wwcursormodes;
04d70db4 33 wwtouched[w->ww_cur.r] |= WWU_TOUCHED;
19f9784c 34 }
120c3815
EW
35 }
36}
35ffbdff
EW
37
38wwsetcursormodes(new)
39register new;
40{
41 register i;
42 register struct ww *w;
43 register old = wwcursormodes;
44
45 new &= wwavailmodes;
46 if (new == wwcursormodes)
47 return;
48 for (i = 0; i < NWW; i++)
49 if (wwindex[i] != 0 && (w = wwindex[i])->ww_hascursor) {
50 wwcursor(w, 0);
51 wwcursormodes = new;
52 wwcursor(w, 1);
53 wwcursormodes = old;
54 }
55 wwcursormodes = new;
56}