aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tedit/display/curses/clrtobot.x
blob: da60b805dbd8dc1c69afcb68182d4e5513af8dd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
include "../curses.h"
include "window.h"

# CLRTOBOT -- Clear window to bottom
#
# B.Simon	28-Sep-90	Original

procedure clrtobot ()

#--

begin
	call wclrtobot (STDSCR)
end

procedure wclrtobot (win)

int	win		# i: Window descriptor
#--
include "window.com"

int	blank, rect[RSIZE]
pointer	pwin

data	blank	/ ' ' /

begin
	pwin = warray[win]

	# First line may be partial, so it must be handled separately

	if (WIN_CURCOL(pwin) == 1) {
	    RTOP(rect) = WIN_TOP(pwin) + WIN_CURROW(pwin) - 1
	} else {
	    RTOP(rect) = WIN_TOP(pwin) + WIN_CURROW(pwin) - 1
	    RLEFT(rect) = WIN_LEFT(pwin) + WIN_CURCOL(pwin) - 1
	    RBOT(rect) = RTOP(rect)
	    RRIGHT(rect) = WIN_RIGHT(pwin)
	    call ps_fill (rect, blank, WIN_ATRIB(pwin))

	    RTOP(rect) = min (RBOT(rect), RTOP(rect)+1)
	}

	# Remaining lines form a rectangle

	RLEFT(rect) = WIN_LEFT(pwin)
	RBOT(rect) = WIN_BOT(pwin)
	RRIGHT(rect) =  WIN_RIGHT(pwin)

	call ps_fill (rect, blank, WIN_ATRIB(pwin))
	if (WIN_LEAVE(pwin) == NO) {
	    call ps_setcur (WIN_TOP(pwin)+WIN_CURROW(pwin)-1,
			    WIN_LEFT(pwin)+WIN_CURCOL(pwin)-1)
	}

end