|
@@ -1,6 +1,12 @@
|
1
|
1
|
#include <curses.h>
|
2
|
2
|
#include "core.h"
|
3
|
3
|
|
|
4
|
+/** @file
|
|
5
|
+ *
|
|
6
|
+ * MuCurses core functions
|
|
7
|
+ *
|
|
8
|
+ */
|
|
9
|
+
|
4
|
10
|
WINDOW _stdscr = {
|
5
|
11
|
.attrs = A_DEFAULT,
|
6
|
12
|
.ori_y = 0,
|
|
@@ -10,8 +16,6 @@ WINDOW _stdscr = {
|
10
|
16
|
.scr = curscr,
|
11
|
17
|
};
|
12
|
18
|
|
13
|
|
-struct _softlabelkeys *slks;
|
14
|
|
-
|
15
|
19
|
/*
|
16
|
20
|
* Primitives
|
17
|
21
|
*/
|
|
@@ -29,14 +33,14 @@ void _wputch ( WINDOW *win, chtype ch, int wrap ) {
|
29
|
33
|
win->scr->movetoyx( win->scr, win->ori_y + win->curs_y,
|
30
|
34
|
win->ori_x + win->curs_x );
|
31
|
35
|
win->scr->putc(win->scr, ch);
|
32
|
|
- if ( ++(win->curs_x) == win->width ) {
|
|
36
|
+ if ( ++(win->curs_x) - win->width == 0 ) {
|
33
|
37
|
if ( wrap == WRAP ) {
|
34
|
38
|
win->curs_x = 0;
|
35
|
39
|
/* specification says we should really scroll,
|
36
|
40
|
but we have no buffer to scroll with, so we
|
37
|
41
|
can only overwrite back at the beginning of
|
38
|
42
|
the window */
|
39
|
|
- if ( ++(win->curs_y) == win->height )
|
|
43
|
+ if ( ++(win->curs_y) - win->height == 0 )
|
40
|
44
|
win->curs_y = 0;
|
41
|
45
|
} else {
|
42
|
46
|
(win->curs_x)--;
|
|
@@ -82,8 +86,8 @@ void _wputstr ( WINDOW *win, const char *str, int wrap, int n ) {
|
82
|
86
|
*/
|
83
|
87
|
int wmove ( WINDOW *win, int y, int x ) {
|
84
|
88
|
/* chech for out-of-bounds errors */
|
85
|
|
- if ( ( ( (unsigned)x - win->ori_x ) > win->width ) ||
|
86
|
|
- ( ( (unsigned)y - win->ori_y ) > win->height ) ) {
|
|
89
|
+ if ( ( (unsigned)y >= win->height ) ||
|
|
90
|
+ ( (unsigned)x >= win->width ) ) {
|
87
|
91
|
return ERR;
|
88
|
92
|
}
|
89
|
93
|
|