Hi Daniel,
On 2018-11-24, Daniel Cegiełka <daniel.cegielka_AT_gmail.com> wrote:
> Hi,
>
> https://lists.suckless.org/dev/1811/33025.html
>
> I prepared a more detailed description of how to compile vis +
> netbsd-curses.
>
> 1) copy from ncurses/ncurses/names.c strnames & strfnames:
>
> DCL(strnames) = {
> "cbt",
> "bel",
> (...)
> "box1",
> (NCURSES_CONST char *)0,
> };
>
> DCL(strfnames) = {
> "back_tab",
> "bell",
> (...)
> "box_chars_1",
> (NCURSES_CONST char *)0,
> };
>
>
> 2) replace ncurses macros (DCL etc.) with C declarations:
>
> const char *strnames[] = {
> "cbt",
> "bel",
> (...)
> "box1",
> NULL,
> };
>
> const char *strfnames[] = {
> "back_tab",
> "bell",
> (...)
> "box_chars_1",
> NULL,
> };
When I looked into this, I went with a slightly different approach.
Instead of copying from ncurses, I generated the arrays from term.h
and an awk script.
awk '
/TICODE_[a-z]+,/ {
names[++numnames] = substr($1, 8, length($1) - 8)
}
/^#define t_[a-z_]+(t)/ {
fnames[++numfnames] = substr($2, 3, length($2) - 5)
}
END {
print "const char *const strnames[] = {"
for (i = 1; i <= numnames; ++i)
print("\t\"" names[i] "\",")
print "\t(void *)0"
print "};"
print "const char *const strfnames[] = {"
for (i = 1; i <= numfnames; ++i)
print("\t\"" fnames[i] "\",")
print "\t(void *)0"
print "};"
}
' libterminfo/term.h > libterminfo/names.c
>
> 3) edit driver-ti.c (libtermkey) and include names.c:
>
> #ifdef HAVE_UNIBILIUM
> # include <unibilium.h>
> #else
> # include <curses.h>
> # include <term.h>
>
> /* strnames and strfnames */
> #include "names.c"
>
> /* curses.h has just poluted our namespace. We want this back */
> # undef buttons
> #endif
You don't need to include the whole names.c in term.h, just declare the arrays:
diff --git a/libterminfo/term.h b/libterminfo/term.h
index 884cfe9..8345a7f 100644
--- a/libterminfo/term.h
+++ b/libterminfo/term.h
_AT_@ -1944,6 +1944,8 @@ extern "C" {
#endif
extern TERMINAL *cur_term;
+extern const char *const strfnames[];
+extern const char *const strnames[];
/* setup functions */
int setupterm(const char *, int, int *);
> vis works fine, however, there is a problem when I use ':!' or ':e *'.
> I think that the terminal settings are not restored. Does anyone have
> an idea here how it can be solved?
I can confirm the issue here. No idea about how to solve it though.
Compared to ncurses, I also notice a bit of flickering when scrolling
fast (status bar occasionally blinks). I remember this problem being
more severe back when I looked into this, so I had decided to stick
with ncurses for oasis for the time being.
Received on Sat Nov 24 2018 - 20:22:31 CET