Skip to content

Instantly share code, notes, and snippets.

@rokuyama
Created October 25, 2022 11:49
Show Gist options
  • Save rokuyama/1a7ea9f534805a302cc23c453cbf01fa to your computer and use it in GitHub Desktop.
Save rokuyama/1a7ea9f534805a302cc23c453cbf01fa to your computer and use it in GitHub Desktop.
Index: lib/libcurses/clrtoeol.c
===================================================================
RCS file: /home/netbsd/src/lib/libcurses/clrtoeol.c,v
retrieving revision 1.35
diff -p -u -r1.35 clrtoeol.c
--- lib/libcurses/clrtoeol.c 12 May 2022 22:25:38 -0000 1.35
+++ lib/libcurses/clrtoeol.c 25 Oct 2022 09:18:37 -0000
@@ -113,9 +113,9 @@ wclrtoeol(WINDOW *win)
#endif
}
- __CTRACE(__CTRACE_ERASE, "CLRTOEOL: y = %d, minx = %d, maxx = %d, "
+ __CTRACE(__CTRACE_ERASE, "CLRTOEOL: y = %d, x = %d, minx = %d, maxx = %d, "
"firstch = %d, lastch = %d\n",
- y, minx, (int)(maxx - win->alines[y]->line),
+ y, x, minx, (int)(maxx - win->alines[y]->line),
*win->alines[y]->firstchp, *win->alines[y]->lastchp);
/* Update firstch and lastch for the line. */
__touchline(win, y, x, (int)win->maxx - 1);
Index: lib/libcurses/getyx.c
===================================================================
RCS file: /home/netbsd/src/lib/libcurses/getyx.c,v
retrieving revision 1.7
diff -p -u -r1.7 getyx.c
--- lib/libcurses/getyx.c 8 Apr 2022 10:27:04 -0000 1.7
+++ lib/libcurses/getyx.c 25 Oct 2022 11:27:25 -0000
@@ -83,6 +83,10 @@ int
getcury(WINDOW *win)
{
+#ifdef DEBUG
+ if (win->cury >= win->maxy)
+ __CTRACE(__CTRACE_MISC, "%s: %d\n", __func__, win->cury);
+#endif
return win->cury;
}
@@ -94,6 +98,10 @@ int
getcurx(WINDOW *win)
{
+#ifdef DEBUG
+ if (win->curx >= win->maxx)
+ __CTRACE(__CTRACE_MISC, "%s: %d\n", __func__, win->curx);
+#endif
return win->curx;
}
Index: lib/libcurses/move.c
===================================================================
RCS file: /home/netbsd/src/lib/libcurses/move.c,v
retrieving revision 1.24
diff -p -u -r1.24 move.c
--- lib/libcurses/move.c 27 Apr 2022 22:04:04 -0000 1.24
+++ lib/libcurses/move.c 25 Oct 2022 11:26:37 -0000
@@ -65,8 +65,10 @@ wmove(WINDOW *win, int y, int x)
__CTRACE(__CTRACE_MISC, "wmove: win %p, (%d, %d)\n", win, y, x);
if (x < 0 || y < 0)
return ERR;
- if (x >= win->maxx || y >= win->maxy)
+ if (x >= win->maxx || y >= win->maxy) {
+ __CTRACE(__CTRACE_MISC, "%s: y %d x %d\n", __func__, y, x);
return ERR;
+ }
/* clear the EOL flags for both where we were and where we are going */
win->alines[win->cury]->flags &= ~ __ISPASTEOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment