2 * Copyright (c) 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
13 static const char sccsid
[] = "$Id: vs_split.c,v 10.39 2000/07/17 18:53:35 skimo Exp $ (Berkeley) $Date: 2000/07/17 18:53:35 $";
16 #include <sys/types.h>
17 #include <sys/queue.h>
20 #include <bitstring.h>
27 #include "../common/common.h"
30 typedef enum { HORIZ_FOLLOW
, HORIZ_PRECEDE
, VERT_FOLLOW
, VERT_PRECEDE
} jdir_t
;
32 static SCR
*vs_getbg
__P((SCR
*, char *));
33 static void vs_insert
__P((SCR
*sp
, WIN
*wp
));
34 static int vs_join
__P((SCR
*, SCR
**, jdir_t
*));
38 * Create a new screen, horizontally.
40 * PUBLIC: int vs_split __P((SCR *, SCR *, int));
43 vs_split(sp
, new, ccl
)
45 int ccl
; /* Colon-command line split. */
50 int issmallscreen
, splitup
;
54 /* Check to see if it's possible. */
55 /* XXX: The IS_ONELINE fix will change this, too. */
58 "222|Screen must be larger than %d lines to split", 4 - 1);
62 /* Wait for any messages in the screen. */
63 vs_resolve(sp
, NULL
, 1);
65 /* Get a new screen map. */
66 CALLOC(sp
, _HMAP(new), SMAP
*, SIZE_HMAP(sp
), sizeof(SMAP
));
67 if (_HMAP(new) == NULL
)
69 _HMAP(new)->lno
= sp
->lno
;
73 /* Split the screen in half. */
79 * Small screens: see vs_refresh.c section 6a. Set a flag so
80 * we know to fix the screen up later.
82 issmallscreen
= IS_SMALL(sp
);
84 /* The columns in the screen don't change. */
89 * Split the screen, and link the screens together. If creating a
90 * screen to edit the colon command line or the cursor is in the top
91 * half of the current screen, the new screen goes under the current
92 * screen. Else, it goes above the current screen.
94 * Recalculate current cursor position based on sp->lno, we're called
95 * with the cursor on the colon command line. Then split the screen
96 * in half and update the shared information.
99 !ccl
&& (vs_sm_cursor(sp
, &smp
) ? 0 : (smp
- HMAP
) + 1) >= half
;
100 if (splitup
) { /* Old is bottom half. */
101 new->rows
= sp
->rows
- half
; /* New. */
102 new->roff
= sp
->roff
;
103 sp
->rows
= half
; /* Old. */
104 sp
->roff
+= new->rows
;
107 * If the parent is the bottom half of the screen, shift
108 * the map down to match on-screen text.
110 memcpy(_HMAP(sp
), _HMAP(sp
) + new->rows
,
111 (sp
->t_maxrows
- new->rows
) * sizeof(SMAP
));
112 } else { /* Old is top half. */
113 new->rows
= half
; /* New. */
114 sp
->rows
-= half
; /* Old. */
115 new->roff
= sp
->roff
+ sp
->rows
;
118 /* Adjust maximum text count. */
119 sp
->t_maxrows
= IS_ONELINE(sp
) ? 1 : sp
->rows
- 1;
120 new->t_maxrows
= IS_ONELINE(new) ? 1 : new->rows
- 1;
123 * Small screens: see vs_refresh.c, section 6a.
125 * The child may have different screen options sizes than the parent,
126 * so use them. Guarantee that text counts aren't larger than the
130 /* Fix the text line count for the parent. */
132 sp
->t_rows
-= new->rows
;
134 /* Fix the parent screen. */
135 if (sp
->t_rows
> sp
->t_maxrows
)
136 sp
->t_rows
= sp
->t_maxrows
;
137 if (sp
->t_minrows
> sp
->t_maxrows
)
138 sp
->t_minrows
= sp
->t_maxrows
;
140 /* Fix the child screen. */
141 new->t_minrows
= new->t_rows
= O_VAL(sp
, O_WINDOW
);
142 if (new->t_rows
> new->t_maxrows
)
143 new->t_rows
= new->t_maxrows
;
144 if (new->t_minrows
> new->t_maxrows
)
145 new->t_minrows
= new->t_maxrows
;
147 sp
->t_minrows
= sp
->t_rows
= IS_ONELINE(sp
) ? 1 : sp
->rows
- 1;
150 * The new screen may be a small screen, even if the parent
151 * was not. Don't complain if O_WINDOW is too large, we're
152 * splitting the screen so the screen is much smaller than
155 new->t_minrows
= new->t_rows
= O_VAL(sp
, O_WINDOW
);
156 if (new->t_rows
> new->rows
- 1)
157 new->t_minrows
= new->t_rows
=
158 IS_ONELINE(new) ? 1 : new->rows
- 1;
161 /* Adjust the ends of the new and old maps. */
162 _TMAP(sp
) = IS_ONELINE(sp
) ?
163 _HMAP(sp
) : _HMAP(sp
) + (sp
->t_rows
- 1);
164 _TMAP(new) = IS_ONELINE(new) ?
165 _HMAP(new) : _HMAP(new) + (new->t_rows
- 1);
167 /* Reset the length of the default scroll. */
168 if ((sp
->defscroll
= sp
->t_maxrows
/ 2) == 0)
170 if ((new->defscroll
= new->t_maxrows
/ 2) == 0)
173 /* Fit the screen into the logical chain. */
174 vs_insert(new, sp
->wp
);
176 /* Tell the display that we're splitting. */
177 (void)gp
->scr_split(sp
, new);
180 * Initialize the screen flags:
182 * If we're in vi mode in one screen, we don't have to reinitialize.
183 * This isn't just a cosmetic fix. The path goes like this:
185 * return into vi(), SC_SSWITCH set
186 * call vs_refresh() with SC_STATUS set
187 * call vs_resolve to display the status message
188 * call vs_refresh() because the SC_SCR_VI bit isn't set
190 * Things go downhill at this point.
192 * Draw the new screen from scratch, and add a status line.
195 SC_SCR_REFORMAT
| SC_STATUS
|
196 F_ISSET(sp
, SC_EX
| SC_VI
| SC_SCR_VI
| SC_SCR_EX
));
202 * Create a new screen, vertically.
204 * PUBLIC: int vs_vsplit __P((SCR *, SCR *));
215 /* Check to see if it's possible. */
216 if (sp
->cols
/ 2 <= MINIMUM_SCREEN_COLS
) {
218 "288|Screen must be larger than %d columns to split",
219 MINIMUM_SCREEN_COLS
* 2);
223 /* Wait for any messages in the screen. */
224 vs_resolve(sp
, NULL
, 1);
226 /* Get a new screen map. */
227 CALLOC(sp
, _HMAP(new), SMAP
*, SIZE_HMAP(sp
), sizeof(SMAP
));
228 if (_HMAP(new) == NULL
)
230 _HMAP(new)->lno
= sp
->lno
;
231 _HMAP(new)->coff
= 0;
232 _HMAP(new)->soff
= 1;
235 * Split the screen in half; we have to sacrifice a column to delimit
239 * We always split to the right... that makes more sense to me, and
240 * I don't want to play the stupid games that I play when splitting
244 * We reserve a column for the screen, "knowing" that curses needs
245 * one. This should be worked out with the display interface.
248 new->cols
= sp
->cols
- cols
- 1;
250 new->coff
= sp
->coff
+ cols
+ 1;
253 /* Nothing else changes. */
254 new->rows
= sp
->rows
;
255 new->t_rows
= sp
->t_rows
;
256 new->t_maxrows
= sp
->t_maxrows
;
257 new->t_minrows
= sp
->t_minrows
;
258 new->roff
= sp
->roff
;
259 new->defscroll
= sp
->defscroll
;
260 _TMAP(new) = _HMAP(new) + (new->t_rows
- 1);
262 /* Fit the screen into the logical chain. */
263 vs_insert(new, sp
->wp
);
265 /* Tell the display that we're splitting. */
266 (void)gp
->scr_split(sp
, new);
268 /* Redraw the old screen from scratch. */
269 F_SET(sp
, SC_SCR_REFORMAT
| SC_STATUS
);
272 * Initialize the screen flags:
274 * If we're in vi mode in one screen, we don't have to reinitialize.
275 * This isn't just a cosmetic fix. The path goes like this:
277 * return into vi(), SC_SSWITCH set
278 * call vs_refresh() with SC_STATUS set
279 * call vs_resolve to display the status message
280 * call vs_refresh() because the SC_SCR_VI bit isn't set
282 * Things go downhill at this point.
284 * Draw the new screen from scratch, and add a status line.
287 SC_SCR_REFORMAT
| SC_STATUS
|
288 F_ISSET(sp
, SC_EX
| SC_VI
| SC_SCR_VI
| SC_SCR_EX
));
294 * Insert the new screen into the correct place in the logical
298 vs_insert(SCR
*sp
, WIN
*wp
)
307 /* Move past all screens with lower row numbers. */
308 for (tsp
= wp
->scrq
.cqh_first
;
309 tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
)
310 if (tsp
->roff
>= sp
->roff
)
313 * Move past all screens with the same row number and lower
316 for (; tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
)
317 if (tsp
->roff
!= sp
->roff
|| tsp
->coff
> sp
->coff
)
321 * If we reached the end, this screen goes there. Otherwise,
322 * put it before or after the screen where we stopped.
324 if (tsp
== (void *)&wp
->scrq
) {
325 CIRCLEQ_INSERT_TAIL(&wp
->scrq
, sp
, q
);
326 } else if (tsp
->roff
< sp
->roff
||
327 (tsp
->roff
== sp
->roff
&& tsp
->coff
< sp
->coff
)) {
328 CIRCLEQ_INSERT_AFTER(&wp
->scrq
, tsp
, sp
, q
);
330 CIRCLEQ_INSERT_BEFORE(&wp
->scrq
, tsp
, sp
, q
);
335 * Discard the screen, folding the real-estate into a related screen,
336 * if one exists, and return that screen.
338 * PUBLIC: int vs_discard __P((SCR *, SCR **));
345 SCR
*tsp
, **lp
, *list
[100];
351 * Save the old screen's cursor information.
354 * If called after file_end(), and the underlying file was a tmp
355 * file, it may have gone away.
357 if (sp
->frp
!= NULL
) {
358 sp
->frp
->lno
= sp
->lno
;
359 sp
->frp
->cno
= sp
->cno
;
360 F_SET(sp
->frp
, FR_CURSORSET
);
363 /* If no other screens to join, we're done. */
365 (void)gp
->scr_discard(sp
, NULL
);
373 * Find a set of screens that cover one of the screen's borders.
374 * Check the vertical axis first, for no particular reason.
377 * It's possible (I think?), to create a screen that shares no full
378 * border with any other set of screens, so we can't discard it. We
379 * just complain at the user until they clean it up.
381 if (vs_join(sp
, list
, &jdir
))
385 * Modify the affected screens. Redraw the modified screen(s) from
386 * scratch, setting a status line. If this is ever a performance
387 * problem we could play games with the map, but I wrote that code
388 * before and it was never clean or easy.
390 * Don't clean up the discarded screen's information. If the screen
391 * isn't exiting, we'll do the work when the user redisplays it.
396 for (lp
= &list
[0]; (tsp
= *lp
) != NULL
; ++lp
) {
398 * Small screens: see vs_refresh.c section 6a. Adjust
399 * text line info, unless it's a small screen.
401 * Reset the length of the default scroll.
403 * Reset the map references.
405 tsp
->rows
+= sp
->rows
;
407 tsp
->t_rows
= tsp
->t_minrows
= tsp
->rows
- 1;
408 tsp
->t_maxrows
= tsp
->rows
- 1;
410 tsp
->defscroll
= tsp
->t_maxrows
/ 2;
412 *(_HMAP(tsp
) + (tsp
->t_rows
- 1)) = *_TMAP(tsp
);
413 _TMAP(tsp
) = _HMAP(tsp
) + (tsp
->t_rows
- 1);
417 tsp
->roff
= sp
->roff
;
418 vs_sm_fill(tsp
, OOBLNO
, P_TOP
);
421 vs_sm_fill(tsp
, OOBLNO
, P_BOTTOM
);
426 F_SET(tsp
, SC_STATUS
);
431 for (lp
= &list
[0]; (tsp
= *lp
) != NULL
; ++lp
) {
432 if (jdir
== VERT_FOLLOW
)
433 tsp
->coff
= sp
->coff
;
434 tsp
->cols
+= sp
->cols
+ 1; /* XXX: DIVIDER */
435 vs_sm_fill(tsp
, OOBLNO
, P_TOP
);
436 F_SET(tsp
, SC_STATUS
);
443 /* Find the closest screen that changed and move to it. */
448 /* Tell the display that we're discarding a screen. */
449 (void)gp
->scr_discard(sp
, list
);
456 * Find a set of screens that covers a screen's border.
459 vs_join(sp
, listp
, jdirp
)
472 /* Check preceding vertical. */
473 for (lp
= listp
, tlen
= sp
->rows
,
474 tsp
= wp
->scrq
.cqh_first
;
475 tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
) {
478 /* Test if precedes the screen vertically. */
479 if (tsp
->coff
+ tsp
->cols
+ 1 != sp
->coff
)
482 * Test if a subset on the vertical axis. If overlaps the
483 * beginning or end, we can't join on this axis at all.
485 if (tsp
->roff
> sp
->roff
+ sp
->rows
)
487 if (tsp
->roff
< sp
->roff
) {
488 if (tsp
->roff
+ tsp
->rows
>= sp
->roff
)
492 if (tsp
->roff
+ tsp
->rows
> sp
->roff
+ sp
->rows
)
495 if (tlen
< tsp
->rows
)
503 *jdirp
= VERT_PRECEDE
;
507 /* Check following vertical. */
508 for (lp
= listp
, tlen
= sp
->rows
,
509 tsp
= wp
->scrq
.cqh_first
;
510 tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
) {
513 /* Test if follows the screen vertically. */
514 if (tsp
->coff
!= sp
->coff
+ sp
->cols
+ 1)
517 * Test if a subset on the vertical axis. If overlaps the
518 * beginning or end, we can't join on this axis at all.
520 if (tsp
->roff
> sp
->roff
+ sp
->rows
)
522 if (tsp
->roff
< sp
->roff
) {
523 if (tsp
->roff
+ tsp
->rows
>= sp
->roff
)
527 if (tsp
->roff
+ tsp
->rows
> sp
->roff
+ sp
->rows
)
530 if (tlen
< tsp
->rows
)
538 *jdirp
= VERT_FOLLOW
;
542 /* Check preceding horizontal. */
543 for (first
= 0, lp
= listp
, tlen
= sp
->cols
,
544 tsp
= wp
->scrq
.cqh_first
;
545 tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
) {
548 /* Test if precedes the screen horizontally. */
549 if (tsp
->roff
+ tsp
->rows
!= sp
->roff
)
552 * Test if a subset on the horizontal axis. If overlaps the
553 * beginning or end, we can't join on this axis at all.
555 if (tsp
->coff
> sp
->coff
+ sp
->cols
)
557 if (tsp
->coff
< sp
->coff
) {
558 if (tsp
->coff
+ tsp
->cols
>= sp
->coff
)
562 if (tsp
->coff
+ tsp
->cols
> sp
->coff
+ sp
->cols
)
565 if (tlen
< tsp
->cols
)
568 tlen
-= tsp
->cols
+ first
;
574 *jdirp
= HORIZ_PRECEDE
;
578 /* Check following horizontal. */
579 for (first
= 0, lp
= listp
, tlen
= sp
->cols
,
580 tsp
= wp
->scrq
.cqh_first
;
581 tsp
!= (void *)&wp
->scrq
; tsp
= tsp
->q
.cqe_next
) {
584 /* Test if precedes the screen horizontally. */
585 if (tsp
->roff
!= sp
->roff
+ sp
->rows
)
588 * Test if a subset on the horizontal axis. If overlaps the
589 * beginning or end, we can't join on this axis at all.
591 if (tsp
->coff
> sp
->coff
+ sp
->cols
)
593 if (tsp
->coff
< sp
->coff
) {
594 if (tsp
->coff
+ tsp
->cols
>= sp
->coff
)
598 if (tsp
->coff
+ tsp
->cols
> sp
->coff
+ sp
->cols
)
601 if (tlen
< tsp
->cols
)
604 tlen
-= tsp
->cols
+ first
;
610 *jdirp
= HORIZ_FOLLOW
;
618 * Background the current screen, and foreground a new one.
620 * PUBLIC: int vs_fg __P((SCR *, SCR **, CHAR_T *, int));
623 vs_fg(sp
, nspp
, name
, newscreen
)
638 INT2CHAR(sp
, name
, v_strlen(name
) + 1, np
, nlen
);
642 /* Get the specified background screen. */
643 nsp
= vs_getbg(sp
, np
);
646 if (vs_swap(sp
, &nsp
, np
))
649 if ((*nspp
= nsp
) == NULL
) {
650 msgq_wstr(sp
, M_ERR
, name
,
652 "223|There are no background screens" :
653 "224|There's no background screen editing a file named %s");
658 /* Remove the new screen from the background queue. */
659 CIRCLEQ_REMOVE(&gp
->hq
, nsp
, q
);
661 /* Split the screen; if we fail, hook the screen back in. */
662 if (vs_split(sp
, nsp
, 0)) {
663 CIRCLEQ_INSERT_TAIL(&gp
->hq
, nsp
, q
);
667 /* Move the old screen to the background queue. */
668 CIRCLEQ_REMOVE(&wp
->scrq
, sp
, q
);
669 CIRCLEQ_INSERT_TAIL(&gp
->hq
, sp
, q
);
677 * Background the screen, and switch to the next one.
679 * PUBLIC: int vs_bg __P((SCR *));
692 /* Try and join with another screen. */
693 if (vs_discard(sp
, &nsp
))
697 "225|You may not background your only displayed screen");
701 /* Move the old screen to the background queue. */
702 CIRCLEQ_REMOVE(&wp
->scrq
, sp
, q
);
703 CIRCLEQ_INSERT_TAIL(&gp
->hq
, sp
, q
);
706 /* Toss the screen map. */
710 /* Switch screens. */
712 F_SET(sp
, SC_SSWITCH
);
719 * Swap the current screen with a backgrounded one.
721 * PUBLIC: int vs_swap __P((SCR *, SCR **, char *));
724 vs_swap(sp
, nspp
, name
)
735 /* Get the specified background screen. */
736 if ((*nspp
= nsp
= vs_getbg(sp
, name
)) == NULL
)
740 * Save the old screen's cursor information.
743 * If called after file_end(), and the underlying file was a tmp
744 * file, it may have gone away.
746 if (sp
->frp
!= NULL
) {
747 sp
->frp
->lno
= sp
->lno
;
748 sp
->frp
->cno
= sp
->cno
;
749 F_SET(sp
->frp
, FR_CURSORSET
);
752 /* Switch screens. */
754 F_SET(sp
, SC_SSWITCH
);
756 /* Initialize terminal information. */
757 VIP(nsp
)->srows
= VIP(sp
)->srows
;
759 /* Initialize screen information. */
760 nsp
->cols
= sp
->cols
;
761 nsp
->rows
= sp
->rows
; /* XXX: Only place in vi that sets rows. */
762 nsp
->roff
= sp
->roff
;
765 * Small screens: see vs_refresh.c, section 6a.
767 * The new screens may have different screen options sizes than the
768 * old one, so use them. Make sure that text counts aren't larger
769 * than the new screen sizes.
772 nsp
->t_minrows
= nsp
->t_rows
= O_VAL(nsp
, O_WINDOW
);
773 if (nsp
->t_rows
> sp
->t_maxrows
)
774 nsp
->t_rows
= nsp
->t_maxrows
;
775 if (nsp
->t_minrows
> sp
->t_maxrows
)
776 nsp
->t_minrows
= nsp
->t_maxrows
;
778 nsp
->t_rows
= nsp
->t_maxrows
= nsp
->t_minrows
= nsp
->rows
- 1;
780 /* Reset the length of the default scroll. */
781 nsp
->defscroll
= nsp
->t_maxrows
/ 2;
783 /* Allocate a new screen map. */
784 CALLOC_RET(nsp
, _HMAP(nsp
), SMAP
*, SIZE_HMAP(nsp
), sizeof(SMAP
));
785 _TMAP(nsp
) = _HMAP(nsp
) + (nsp
->t_rows
- 1);
788 if (vs_sm_fill(nsp
, nsp
->lno
, P_FILL
))
792 * The new screen replaces the old screen in the parent/child list.
793 * We insert the new screen after the old one. If we're exiting,
794 * the exit will delete the old one, if we're foregrounding, the fg
795 * code will move the old one to the background queue.
797 CIRCLEQ_REMOVE(&gp
->hq
, nsp
, q
);
798 CIRCLEQ_INSERT_AFTER(&wp
->scrq
, sp
, nsp
, q
);
802 * Don't change the screen's cursor information other than to
803 * note that the cursor is wrong.
805 F_SET(VIP(nsp
), VIP_CUR_INVALID
);
807 /* Draw the new screen from scratch, and add a status line. */
808 F_SET(nsp
, SC_SCR_REDRAW
| SC_STATUS
);
810 list
[0] = nsp
; list
[1] = NULL
;
811 (void)gp
->scr_discard(sp
, list
);
818 * Change the absolute size of the current screen.
820 * PUBLIC: int vs_resize __P((SCR *, long, adj_t));
823 vs_resize(sp
, count
, adj
)
830 SCR
*g
, *s
, *prev
, *next
, *list
[3] = {NULL
, NULL
, NULL
};
837 * Figure out which screens will grow, which will shrink, and
838 * make sure it's possible.
843 if (sp
->t_maxrows
== count
)
845 if (sp
->t_maxrows
> count
) {
847 count
= sp
->t_maxrows
- count
;
850 count
= count
- sp
->t_maxrows
;
854 /* Find first overlapping screen */
855 for (next
= sp
->q
.cqe_next
;
856 next
!= (void *)&wp
->scrq
&&
857 (next
->coff
>= sp
->coff
+ sp
->cols
||
858 next
->coff
+ next
->cols
<= sp
->coff
);
859 next
= next
->q
.cqe_next
);
860 /* See if we can use it */
861 if (next
!= (void *)&wp
->scrq
&&
862 (sp
->coff
!= next
->coff
|| sp
->cols
!= next
->cols
))
863 next
= (void *)&wp
->scrq
;
864 for (prev
= sp
->q
.cqe_prev
;
865 prev
!= (void *)&wp
->scrq
&&
866 (prev
->coff
>= sp
->coff
+ sp
->cols
||
867 prev
->coff
+ prev
->cols
<= sp
->coff
);
868 prev
= prev
->q
.cqe_prev
);
869 if (prev
!= (void *)&wp
->scrq
&&
870 (sp
->coff
!= prev
->coff
|| sp
->cols
!= prev
->cols
))
871 prev
= (void *)&wp
->scrq
;
874 if (adj
== A_DECREASE
) {
878 if (s
->t_maxrows
< MINIMUM_SCREEN_ROWS
+ count
)
880 if ((g
= prev
) == (void *)&wp
->scrq
) {
881 if ((g
= next
) == (void *)&wp
->scrq
)
888 if ((s
= next
) != (void *)&wp
->scrq
&&
889 s
->t_maxrows
>= MINIMUM_SCREEN_ROWS
+ count
)
894 if ((s
= prev
) == (void *)&wp
->scrq
) {
895 toobig
: msgq(sp
, M_BERR
, adj
== A_DECREASE
?
896 "227|The screen cannot shrink" :
897 "228|The screen cannot grow");
900 if (s
->t_maxrows
< MINIMUM_SCREEN_ROWS
+ count
) {
901 toosmall
: msgq(sp
, M_BERR
,
902 "226|The screen can only shrink to %d rows",
903 MINIMUM_SCREEN_ROWS
);
911 * Fix up the screens; we could optimize the reformatting of the
912 * screen, but this isn't likely to be a common enough operation
913 * to make it worthwhile.
921 if (g
->t_minrows
== g
->t_maxrows
)
922 g
->t_minrows
+= count
;
923 g
->t_maxrows
+= count
;
925 F_SET(g
, SC_SCR_REFORMAT
| SC_STATUS
);
928 s
->t_maxrows
-= count
;
929 if (s
->t_minrows
> s
->t_maxrows
)
930 s
->t_minrows
= s
->t_maxrows
;
932 F_SET(s
, SC_SCR_REFORMAT
| SC_STATUS
);
935 list
[0] = g
; list
[1] = s
;
936 gp
->scr_discard(0, list
);
943 * Get the specified background screen, or, if name is NULL, the first
957 /* If name is NULL, return the first background screen on the list. */
959 nsp
= gp
->hq
.cqh_first
;
960 return (nsp
== (void *)&gp
->hq
? NULL
: nsp
);
963 /* Search for a full match. */
964 for (nsp
= gp
->hq
.cqh_first
;
965 nsp
!= (void *)&gp
->hq
; nsp
= nsp
->q
.cqe_next
)
966 if (!strcmp(nsp
->frp
->name
, name
))
968 if (nsp
!= (void *)&gp
->hq
)
971 /* Search for a last-component match. */
972 for (nsp
= gp
->hq
.cqh_first
;
973 nsp
!= (void *)&gp
->hq
; nsp
= nsp
->q
.cqe_next
) {
974 if ((p
= strrchr(nsp
->frp
->name
, '/')) == NULL
)
978 if (!strcmp(p
, name
))
981 if (nsp
!= (void *)&gp
->hq
)