commit: 780bd5f927ef20cada29665554d2d3968fd6f9dd
parent 57dd586471765d2dcc81502dd7bfcc6aeab9a462
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 6 Jun 2021 19:18:34 -0700
netbsd-curses: Update to latest git
Diffstat:
6 files changed, 228 insertions(+), 94 deletions(-)
diff --git a/pkg/netbsd-curses/patch/0003-Don-t-wrap-when-adding-past-last-line-in-non-scrolli.patch b/pkg/netbsd-curses/patch/0003-Don-t-wrap-when-adding-past-last-line-in-non-scrolli.patch
@@ -1,65 +0,0 @@
-From 5b5cbce58a6ff85174abbdf57ba56db501fe816d Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Thu, 3 Jun 2021 00:32:57 -0700
-Subject: [PATCH] Don't wrap when adding past last line in non-scrolling window
-
-X/Open curses says
-
-> If scrolling is disabled, any characters that would extend beyond
-> the last column of the last line are truncated.
-
-However, currently libcurses wraps the cursor back to the beginning
-of the last line.
-
-To fix this, when we try to add a character that would go past the
-end of the last line, leave the cursor where it is. If the character
-goes exactly to the end of the last line, add the character but set
-the cursor to the last column (to match ncurses behavior).
-
-[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/intov.html#tag_001_004_002_002
----
- lib/libcurses/addbytes.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
-index 9fd917c..7f88487 100644
---- a/lib/libcurses/addbytes.c
-+++ b/lib/libcurses/addbytes.c
-@@ -459,7 +459,6 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
- if (newx > *(*lnp)->lastchp)
- *(*lnp)->lastchp = newx;
- __touchline(win, *y, sx, (int) win->maxx - 1);
-- sx = *x = 0;
- if (*y == win->scr_b) {
- if (!(win->flags & __SCROLLOK))
- return ERR;
-@@ -467,6 +466,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
- } else {
- (*y)++;
- }
-+ sx = *x = 0;
- lp = &win->alines[*y]->line[0];
- (*lnp) = win->alines[*y];
- }
-@@ -547,14 +547,16 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
- if (newx > *(*lnp)->lastchp)
- *(*lnp)->lastchp = newx;
- __touchline(win, *y, sx, (int) win->maxx - 1);
-- *x = sx = 0;
- if (*y == win->scr_b) {
-- if (!(win->flags & __SCROLLOK))
-+ if (!(win->flags & __SCROLLOK)) {
-+ *x = win->maxx - 1;
- return ERR;
-+ }
- scroll(win);
- } else {
- (*y)++;
- }
-+ *x = sx = 0;
- lp = &win->alines[*y]->line[0];
- (*lnp) = win->alines[*y];
- } else {
---
-2.31.1
-
diff --git a/pkg/netbsd-curses/patch/0003-Revert-Fix-for-PR-lib-56224.patch b/pkg/netbsd-curses/patch/0003-Revert-Fix-for-PR-lib-56224.patch
@@ -0,0 +1,80 @@
+From 6e3a7ba743db0e7e22ef50d038690b3f1e46bba3 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Tue, 8 Jun 2021 20:00:53 -0700
+Subject: [PATCH] Revert "Fix for PR lib/56224"
+
+This reverts commit deeb100e95f3d981cbe4ece4744fe6c34a5a2f05.
+---
+ lib/libcurses/addbytes.c | 38 +-------------------------------------
+ 1 file changed, 1 insertion(+), 37 deletions(-)
+
+diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
+index a678939f..9fd917ca 100644
+--- a/lib/libcurses/addbytes.c
++++ b/lib/libcurses/addbytes.c
+@@ -1,4 +1,4 @@
+-/* $NetBSD: addbytes.c,v 1.55 2021/06/06 05:06:44 blymn Exp $ */
++/* $NetBSD: addbytes.c,v 1.54 2021/02/13 14:30:37 rillig Exp $ */
+
+ /*
+ * Copyright (c) 1987, 1993, 1994
+@@ -161,15 +161,6 @@ _cursesi_waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr,
+ } else if (wc == 0) {
+ break;
+ }
+-
+- /* if scrollok is false and we are at the bottom of
+- * screen and this character would take us past the
+- * end of the line then we are done.
+- */
+- if ((win->curx + n >= win->maxx) &&
+- (!(win->flags & __SCROLLOK)) &&
+- (win->cury == win->scr_b))
+- break;
+ #ifdef DEBUG
+ __CTRACE(__CTRACE_INPUT,
+ "ADDBYTES WIDE(0x%x [%s], %x) at (%d, %d), ate %d bytes\n",
+@@ -214,19 +205,6 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
+ case '\t':
+ tabsize = win->screen->TABSIZE;
+ newx = tabsize - (*x % tabsize);
+- /* if at the bottom of the window and
+- not allowed to scroll then just do
+- what we can */
+- if ((*y == win->scr_b) &&
+- !(win->flags & __SCROLLOK)) {
+- if ((*lp)->flags & __ISPASTEOL) {
+- return OK;
+- }
+-
+- if (*x + newx > win->maxx - 1)
+- newx = win->maxx - *x - 1;
+- }
+-
+ for (i = 0; i < newx; i++) {
+ if (waddbytes(win, blank, 1) == ERR)
+ return ERR;
+@@ -379,20 +357,6 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ cc.attributes = win->wattr;
+ tabsize = win->screen->TABSIZE;
+ newx = tabsize - (*x % tabsize);
+-
+- /* if at the bottom of the window and
+- not allowed to scroll then just do
+- what we can */
+- if ((*y == win->scr_b) &&
+- !(win->flags & __SCROLLOK)) {
+- if ((*lnp)->flags & __ISPASTEOL) {
+- return OK;
+- }
+-
+- if (*x + newx > win->maxx - 1)
+- newx = win->maxx - *x - 1;
+- }
+-
+ for (i = 0; i < newx; i++) {
+ if (wadd_wch(win, &cc) == ERR)
+ return ERR;
+--
+2.31.1
+
diff --git a/pkg/netbsd-curses/patch/0004-Don-t-wrap-when-adding-past-last-line-in-non-scrolli.patch b/pkg/netbsd-curses/patch/0004-Don-t-wrap-when-adding-past-last-line-in-non-scrolli.patch
@@ -0,0 +1,119 @@
+From de7a1acf3168a35c19a569cc7f6f572c39e96c82 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 3 Jun 2021 00:32:57 -0700
+Subject: [PATCH] Don't wrap when adding past last line in non-scrolling window
+
+X/Open curses says
+
+> If scrolling is disabled, any characters that would extend beyond
+> the last column of the last line are truncated.
+
+However, currently libcurses wraps the cursor back to the beginning
+of the last line.
+
+To fix this, when we try to add a character that would go past the
+end of the last line, leave the cursor where it is. If the character
+goes exactly to the end of the last line, add the character but set
+the cursor to the last column (to match ncurses behavior).
+
+[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/intov.html#tag_001_004_002_002
+---
+ lib/libcurses/addbytes.c | 20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
+index 9fd917ca..e52dc310 100644
+--- a/lib/libcurses/addbytes.c
++++ b/lib/libcurses/addbytes.c
+@@ -232,8 +232,6 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
+ #endif
+
+ if (char_interp && ((*lp)->flags & __ISPASTEOL)) {
+- *x = 0;
+- (*lp)->flags &= ~__ISPASTEOL;
+ if (*y == win->scr_b) {
+ #ifdef DEBUG
+ __CTRACE(__CTRACE_INPUT,
+@@ -246,6 +244,8 @@ _cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c,
+ } else {
+ (*y)++;
+ }
++ *x = 0;
++ (*lp)->flags &= ~__ISPASTEOL;
+ *lp = win->alines[*y];
+ if (c == '\n')
+ return OK;
+@@ -341,8 +341,6 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ return OK;
+ case L'\n':
+ wclrtoeol(win);
+- *x = 0;
+- (*lnp)->flags &= ~__ISPASTEOL;
+ if (*y == win->scr_b) {
+ if (!(win->flags & __SCROLLOK))
+ return ERR;
+@@ -350,6 +348,8 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ } else {
+ (*y)++;
+ }
++ *x = 0;
++ (*lnp)->flags &= ~__ISPASTEOL;
+ return OK;
+ case L'\t':
+ cc.vals[0] = L' ';
+@@ -395,8 +395,6 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ }
+ /* check for new line first */
+ if (char_interp && ((*lnp)->flags & __ISPASTEOL)) {
+- *x = 0;
+- (*lnp)->flags &= ~__ISPASTEOL;
+ if (*y == win->scr_b) {
+ if (!(win->flags & __SCROLLOK))
+ return ERR;
+@@ -404,6 +402,8 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ } else {
+ (*y)++;
+ }
++ *x = 0;
++ (*lnp)->flags &= ~__ISPASTEOL;
+ (*lnp) = win->alines[*y];
+ lp = &win->alines[*y]->line[*x];
+ }
+@@ -459,7 +459,6 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ if (newx > *(*lnp)->lastchp)
+ *(*lnp)->lastchp = newx;
+ __touchline(win, *y, sx, (int) win->maxx - 1);
+- sx = *x = 0;
+ if (*y == win->scr_b) {
+ if (!(win->flags & __SCROLLOK))
+ return ERR;
+@@ -467,6 +466,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ } else {
+ (*y)++;
+ }
++ sx = *x = 0;
+ lp = &win->alines[*y]->line[0];
+ (*lnp) = win->alines[*y];
+ }
+@@ -547,14 +547,16 @@ _cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x,
+ if (newx > *(*lnp)->lastchp)
+ *(*lnp)->lastchp = newx;
+ __touchline(win, *y, sx, (int) win->maxx - 1);
+- *x = sx = 0;
+ if (*y == win->scr_b) {
+- if (!(win->flags & __SCROLLOK))
++ if (!(win->flags & __SCROLLOK)) {
++ *x = win->maxx - 1;
+ return ERR;
++ }
+ scroll(win);
+ } else {
+ (*y)++;
+ }
++ *x = sx = 0;
+ lp = &win->alines[*y]->line[0];
+ (*lnp) = win->alines[*y];
+ } else {
+--
+2.31.1
+
diff --git a/pkg/netbsd-curses/patch/0004-Return-early-from-_cursesi_waddbytes-if-_cursesi_add.patch b/pkg/netbsd-curses/patch/0004-Return-early-from-_cursesi_waddbytes-if-_cursesi_add.patch
@@ -1,28 +0,0 @@
-From afe19e9450015024e51f3e694c866fc1e1c20c8f Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Thu, 3 Jun 2021 00:42:45 -0700
-Subject: [PATCH] Return early from _cursesi_waddbytes if _cursesi_addwchar
- fails
-
-This error may indicate that scrolling was required in a non-scrolling
-window, in which case the rest of the string should be truncated.
----
- lib/libcurses/addbytes.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
-index 7f88487..6d50bdf 100644
---- a/lib/libcurses/addbytes.c
-+++ b/lib/libcurses/addbytes.c
-@@ -132,7 +132,7 @@ _cursesi_waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr,
- #ifdef HAVE_WCHAR
- (void)memset(&st, 0, sizeof(st));
- #endif
-- while (count > 0) {
-+ while (count > 0 && err == OK) {
- #ifndef HAVE_WCHAR
- c = *bytes++;
- #ifdef DEBUG
---
-2.31.1
-
diff --git a/pkg/netbsd-curses/patch/0005-Return-early-from-_cursesi_waddbytes-if-_cursesi_add.patch b/pkg/netbsd-curses/patch/0005-Return-early-from-_cursesi_waddbytes-if-_cursesi_add.patch
@@ -0,0 +1,28 @@
+From c977aac84ce6c6e2737a8a072cb4116b8ee4278e Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 3 Jun 2021 00:42:45 -0700
+Subject: [PATCH] Return early from _cursesi_waddbytes if _cursesi_addwchar
+ fails
+
+This error may indicate that scrolling was required in a non-scrolling
+window, in which case the rest of the string should be truncated.
+---
+ lib/libcurses/addbytes.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
+index e52dc310..5d783df8 100644
+--- a/lib/libcurses/addbytes.c
++++ b/lib/libcurses/addbytes.c
+@@ -132,7 +132,7 @@ _cursesi_waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr,
+ #ifdef HAVE_WCHAR
+ (void)memset(&st, 0, sizeof(st));
+ #endif
+- while (count > 0) {
++ while (count > 0 && err == OK) {
+ #ifndef HAVE_WCHAR
+ c = *bytes++;
+ #ifdef DEBUG
+--
+2.31.1
+
diff --git a/pkg/netbsd-curses/ver b/pkg/netbsd-curses/ver
@@ -1 +1 @@
-05dcddbb5c r0
+2636fd982a r0