wrong cursor position in c_show
[unix-history] / usr / src / usr.bin / window / cmd4.c
CommitLineData
ce28727e 1#ifndef lint
54277872 2static char *sccsid = "@(#)cmd4.c 3.3 83/08/22";
ce28727e
EW
3#endif
4
5#include "defs.h"
6
85af59e4 7c_show()
ce28727e
EW
8{
9 register i;
10 register struct ww *w = 0;
11 char done_it = 0;
12
85af59e4
EW
13 for (i = 0; i < NWINDOW; i++) {
14 if ((w = window[i]) == 0)
ce28727e
EW
15 continue;
16 done_it++;
85af59e4
EW
17 if (!terse && cmdwin->ww_order < framewin->ww_order) {
18 wwdelete(cmdwin);
19 wwadd(cmdwin, framewin);
20 }
21 wwdelete(w);
22 wwadd(w, framewin);
23 reframe();
54277872 24 wwsetcursor(w->ww_w.t - 1, w->ww_w.l + 1);
ce28727e
EW
25 for (;;) {
26 switch (bgetc()) {
27 case '\r':
28 case '\n':
29 break;
30 case CTRL([):
31 setselwin(w);
8c4fb896 32 goto out;
ce28727e
EW
33 case -1:
34 bread();
35 continue;
36 default:
85af59e4
EW
37 wwbell();
38 if (!terse) {
39 (void) wwputs("\rType return to continue, escape to select.", cmdwin);
40 wwdelete(cmdwin);
41 wwadd(cmdwin, &wwhead);
42 }
ce28727e
EW
43 continue;
44 }
45 break;
46 }
47 }
8c4fb896 48out:
101acab4 49 if (!done_it) {
85af59e4 50 error("No windows.");
101acab4 51 } else {
85af59e4
EW
52 if (!terse) {
53 wwdelete(cmdwin);
54 wwadd(cmdwin, &wwhead);
55 (void) wwputs("\r\n", cmdwin);
56 }
ce28727e
EW
57 }
58}
101acab4 59
85af59e4 60c_colon()
101acab4
EW
61{
62 char buf[512];
63
64 if (terse)
85af59e4
EW
65 wwadd(cmdwin, &wwhead);
66 (void) wwputc(':', cmdwin);
101acab4 67 bgets(buf, wwncol - 3, cmdwin);
85af59e4 68 (void) wwputs("\r\n", cmdwin);
101acab4 69 if (terse)
85af59e4 70 wwdelete(cmdwin);
d56e1607
EW
71 else
72 wwcurtowin(cmdwin);
101acab4
EW
73 dolongcmd(buf);
74}