Skip to content

Commit 931b33a

Browse files
authoredSep 8, 2021
Change param names and update documentation (rthornton128#61)
1 parent 1355ee0 commit 931b33a

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed
 

‎examples/pad/pad.go

+12-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ func main() {
3434
// Refresh the pad to show only a portion of the pad. Understanding
3535
// what these coordinates mean can be a bit tricky. The first two
3636
// coordinates are the position in the pad, in this case 0,5 (remember
37-
// the coordinates in ncurses are y,x). The second set of numbers are the
38-
// coordinates on the screen on which to display the content, so row 5,
39-
// column 10. The last set of numbers tell how high and how wide the
40-
// rectangle to displayed should be, in this case 15 rows long and 25
41-
// columns wide.
37+
// the coordinates in ncurses are y,x). The next four set of numbers
38+
// are the coordinates of the pad on the screen (y1, x1, y2, x2):
39+
//
40+
// (y1,x1) +-------------+
41+
// | |
42+
// | |
43+
// | |
44+
// | |
45+
// | |
46+
// | |
47+
// +-------------+ (y2, x2)
48+
//
4249
pad.Refresh(0, 5, 5, 10, 15, 25)
4350
pad.GetChar()
4451
}

‎pad.go

+19-8
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,25 @@ func (p *Pad) NoutRefresh(py, px, sy, sx, h, w int) error {
4343
// Refresh will calculate how to update the physical screen in the most
4444
// efficient manor and update it. See Window.Refresh for more details.
4545
// The coordinates py, px specify the location on the pad from which the
46-
// characters we want to display are located. sy and sx specify the location
47-
// on the screen where this data should be displayed. h and w are the height
48-
// and width of the rectangle to be displayed. The coordinates and the size
49-
// of the rectangle must be contained within both the Pad's and Window's
50-
// respective areas
51-
func (p *Pad) Refresh(py, px, sy, sx, h, w int) error {
52-
if C.prefresh(p.win, C.int(py), C.int(px), C.int(sy), C.int(sx),
53-
C.int(h), C.int(w)) != C.OK {
46+
// characters we want to display are located. sy1 and sx1 specify the location
47+
// on the screen where this data should be displayed, hence the upper left
48+
// corner of the display area on the screen. sy2 and sx2 specify the location
49+
// of the lower right corner of the display area on the screen:
50+
//
51+
// (y1,x1) +-------------+
52+
// | |
53+
// | |
54+
// | |
55+
// | |
56+
// | |
57+
// | |
58+
// +-------------+ (y2, x2)
59+
//
60+
// The coordinates of the rectangle must be contained within both the Pad's
61+
// and Window's respective areas.
62+
func (p *Pad) Refresh(py, px, sy1, sx1, sy2, sx2 int) error {
63+
if C.prefresh(p.win, C.int(py), C.int(px), C.int(sy1), C.int(sx1),
64+
C.int(sy2), C.int(sx2)) != C.OK {
5465
return errors.New("Failed to refresh pad")
5566
}
5667
return nil

0 commit comments

Comments
 (0)
Please sign in to comment.