aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/tedit/display/curses/inch.x
blob: 9d80df3b02d8296a021fd126e7c4dad06e64516e (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
include "../curses.h"
include "window.h"

# INCH -- Get character at current cursor position
#
# B.Simon	02-Oct-90	Original

char procedure inch ()

#--
char	winch()

begin
	return (winch (STDSCR))
end

char procedure winch (win)

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

char	ch
int	rect[RSIZE]
pointer	pwin, buf

begin
	pwin = warray[win]

	# Create a box containing the character

	if (WIN_BOXED(pwin) == NO) {
	    RTOP(rect) = WIN_TOP(pwin) + WIN_CURROW(pwin) - 1
	    RLEFT(rect) = WIN_LEFT(pwin) + WIN_CURCOL(pwin) - 1
	} else {
	    RTOP(rect) = WIN_TOP(pwin) + WIN_CURROW(pwin)
	    RLEFT(rect) = WIN_LEFT(pwin) + WIN_CURCOL(pwin)
	}
	RBOT(rect) = RTOP(rect)
	RRIGHT(rect) = RLEFT(rect)

	# Get the character under the cursor

	call getscreen (rect, buf)
	ch = Memc[buf]
	call freescreen (buf)

	return (ch)
end