logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 808bcbe30b822e0af1aa8f2981516d84bbfbe68a
parent 6f64b3f4765ae2e4527d970a6b274b99f42fbca5
Author: Michael Forney <mforney@mforney.org>
Date:   Thu,  3 Jun 2021 00:56:17 -0700

catgirl: Switch to netbsd-curses

Diffstat:

Mpkg/catgirl/gen.lua6+++---
Apkg/catgirl/patch/0002-Avoid-writing-past-the-end-of-the-status-bar.patch57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apkg/catgirl/patch/0003-Break-out-of-input-loop-when-UI-is-hidden.patch27+++++++++++++++++++++++++++
Apkg/catgirl/patch/0004-Resize-status-window-explicitly-during-resize.patch27+++++++++++++++++++++++++++
Apkg/catgirl/patch/0005-HACK-Disable-colorized-output-in-M-l-window-list.patch34++++++++++++++++++++++++++++++++++
Mpkg/catgirl/ver2+-
6 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/pkg/catgirl/gen.lua b/pkg/catgirl/gen.lua @@ -3,12 +3,12 @@ cflags{ '-Wno-maybe-uninitialized', '-D _GNU_SOURCE', '-isystem $builddir/pkg/libtls-bearssl/include', - '-isystem $builddir/pkg/ncurses/include', + '-isystem $builddir/pkg/netbsd-curses/include', } pkg.deps = { 'pkg/libtls-bearssl/headers', - 'pkg/ncurses/headers', + 'pkg/netbsd-curses/headers', } exe('catgirl', [[ @@ -26,7 +26,7 @@ exe('catgirl', [[ url.c xdg.c $builddir/pkg/libtls-bearssl/libtls.a.d - $builddir/pkg/ncurses/libncurses.a + $builddir/pkg/netbsd-curses/libcurses.a.d ]]) file('bin/catgirl', '755', '$outdir/catgirl') man{'catgirl.1'} diff --git a/pkg/catgirl/patch/0002-Avoid-writing-past-the-end-of-the-status-bar.patch b/pkg/catgirl/patch/0002-Avoid-writing-past-the-end-of-the-status-bar.patch @@ -0,0 +1,57 @@ +From a1592df2eedd841ef8b5ad7edcaabf251f3ab04f Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 30 May 2021 23:29:26 -0700 +Subject: [PATCH] Avoid writing past the end of the status bar + +When waddnstr is called with a string that would extend past the +end of the window, the string is truncated, the cursor remains at +the last column, and ERR is returned. If this error is ignored and +the loop continues, the next call to waddnstr overwrites the character +at this column, resulting in a slight visual artifact. When the +window is too small to fit the full status line, it is effectively +truncated by one space on the right, since the string shown for +each channel begins with a space. Additionally, if the last window +is the current window, the space is shown with a colored background. + +To fix this, when waddnstr returns ERR, exit the loop in styleAdd() +early return -1 to propogate this error down to the caller. +--- + ui.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/ui.c b/ui.c +index aa8c376..2d02ef4 100644 +--- a/ui.c ++++ b/ui.c +@@ -374,14 +374,16 @@ static short stylePair(struct Style style) { + return colorPair(Colors[style.fg], Colors[style.bg]); + } + +-static void styleAdd(WINDOW *win, const char *str) { ++static int styleAdd(WINDOW *win, const char *str) { + struct Style style = StyleDefault; + while (*str) { + size_t len = styleParse(&style, &str); + wattr_set(win, styleAttr(style), stylePair(style), NULL); +- waddnstr(win, str, len); ++ if (waddnstr(win, str, len) == ERR) ++ return -1; + str += len; + } ++ return 0; + } + + static void statusUpdate(void) { +@@ -420,7 +422,8 @@ static void statusUpdate(void) { + if (window->scroll) { + catf(&cat, "~%d ", window->scroll); + } +- styleAdd(status, buf); ++ if (styleAdd(status, buf)) ++ break; + } + wclrtoeol(status); + +-- +2.31.1 + diff --git a/pkg/catgirl/patch/0003-Break-out-of-input-loop-when-UI-is-hidden.patch b/pkg/catgirl/patch/0003-Break-out-of-input-loop-when-UI-is-hidden.patch @@ -0,0 +1,27 @@ +From 78230d9042639147907263f41d9824f917c5c686 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 31 May 2021 16:37:09 -0700 +Subject: [PATCH] Break out of input loop when UI is hidden + +Otherwise, wget_wch() is called immediately after hiding the UI +with M-l, which restores curses mode when using NetBSD's libcurses. +--- + ui.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ui.c b/ui.c +index 2d02ef4..ff87124 100644 +--- a/ui.c ++++ b/ui.c +@@ -1074,7 +1074,7 @@ void uiRead(void) { + + wint_t ch; + static bool paste, style, literal; +- for (int ret; ERR != (ret = wget_wch(input, &ch));) { ++ for (int ret; !hidden && ERR != (ret = wget_wch(input, &ch));) { + if (ret == KEY_CODE_YES && ch == KeyPasteOn) { + paste = true; + } else if (ret == KEY_CODE_YES && ch == KeyPasteOff) { +-- +2.31.1 + diff --git a/pkg/catgirl/patch/0004-Resize-status-window-explicitly-during-resize.patch b/pkg/catgirl/patch/0004-Resize-status-window-explicitly-during-resize.patch @@ -0,0 +1,27 @@ +From 3568a01d610e33073aa39f4cfadfcacd97509af4 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Mon, 31 May 2021 16:40:28 -0700 +Subject: [PATCH] Resize status window explicitly during resize() + +Although ncurses automatically resizes windows that extend to the +previous screen limits, NetBSD's libcurses does not, so resize the +status window explicitly. +--- + ui.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/ui.c b/ui.c +index ff87124..6819d0a 100644 +--- a/ui.c ++++ b/ui.c +@@ -642,6 +642,7 @@ static void windowReflow(struct Window *window) { + + static void resize(void) { + wclear(main); ++ wresize(status, 1, COLS); + wresize(main, MAIN_LINES, COLS); + for (uint num = 0; num < windows.len; ++num) { + windowReflow(windows.ptrs[num]); +-- +2.31.1 + diff --git a/pkg/catgirl/patch/0005-HACK-Disable-colorized-output-in-M-l-window-list.patch b/pkg/catgirl/patch/0005-HACK-Disable-colorized-output-in-M-l-window-list.patch @@ -0,0 +1,34 @@ +From 12f859151f0cc5376fbbac0b28a1193c20e26f7b Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Thu, 3 Jun 2021 00:54:30 -0700 +Subject: [PATCH] [HACK] Disable colorized output in M-l window list + +vid_attr is not supported by NetBSD's libcurses, and this is not +crucial feature. +--- + ui.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/ui.c b/ui.c +index 6819d0a..50b1559 100644 +--- a/ui.c ++++ b/ui.c +@@ -669,7 +669,6 @@ static void windowList(const struct Window *window) { + + char buf[TimeCap]; + strftime(buf, sizeof(buf), uiTime.format, localtime(&line->time)); +- vid_attr(colorAttr(Colors[Gray]), colorPair(Colors[Gray], -1), NULL); + printf("%s ", buf); + + bool align = false; +@@ -685,7 +684,6 @@ static void windowList(const struct Window *window) { + size_t tab = strcspn(str, "\t"); + if (tab < len) len = tab; + +- vid_attr(styleAttr(style), stylePair(style), NULL); + printf("%.*s", (int)len, str); + str += len; + } +-- +2.31.1 + diff --git a/pkg/catgirl/ver b/pkg/catgirl/ver @@ -1 +1 @@ -1.8 r0 +1.8 r1