[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] light line draw aliases, clean up tests
From: |
Nick Black |
Subject: |
[PATCH] light line draw aliases, clean up tests |
Date: |
Thu, 24 Oct 2019 07:22:23 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
I had added *_L_* variants of the wide box drawing characters
before realizing that they aliased the "unadorned" box drawing
characters (aka WACS_VLINE == WACS_L_VLINE). With that said,
someone coming from a Unicode table might be forgiven for
expecting _L_ variants:
[schwarzgerat](0) $ unicode --brief 2500 2501 2550
─ U+2500 BOX DRAWINGS LIGHT HORIZONTAL
━ U+2501 BOX DRAWINGS HEAVY HORIZONTAL
═ U+2550 BOX DRAWINGS DOUBLE HORIZONTAL
[schwarzgerat](0) $
So I like these for orthogonality's sake if nothing else. If you
don't agree, I'd at least take the refactoring in
test/ncurses.c. Thanks!
diff -ur ncurses-6.1-20191019/doc/html/man/curs_add_wch.3x.html
ncurses-6.1-20191019-dank/doc/html/man/curs_add_wch.3x.html
--- ncurses-6.1-20191019/doc/html/man/curs_add_wch.3x.html 2019-03-16
15:34:43.000000000 -0400
+++ ncurses-6.1-20191019-dank/doc/html/man/curs_add_wch.3x.html 2019-10-24
06:59:33.425959857 -0400
@@ -155,6 +155,23 @@
WACS_D_URCORNER 0x2557 + B double upper right corner
WACS_D_VLINE 0x2551 | Y double vertical line
+ for light lines:
+
+ <STRONG>ACS</STRONG> <STRONG>Unicode</STRONG>
<STRONG>ASCII</STRONG> <STRONG>acsc</STRONG> <STRONG>Glyph</STRONG>
+ <STRONG>Name</STRONG> <STRONG>Default</STRONG>
<STRONG>Default</STRONG> <STRONG>char</STRONG> <STRONG>Name</STRONG>
+ -----------------------------------------------------------------------
+ WACS_L_BTEE 0x2534 + v light tee pointing up
+ WACS_L_HLINE 0x2500 - q light horizontal line
+ WACS_L_LLCORNER 0x2514 + m light lower left corner
+ WACS_L_LRCORNER 0x2518 + j light lower right corner
+ WACS_L_LTEE 0x2524 + t light tee pointing right
+ WACS_L_PLUS 0x253c + n light large plus
+ WACS_L_RTEE 0x251c + u light tee pointing left
+ WACS_L_TTEE 0x252c + w light tee pointing down
+ WACS_L_ULCORNER 0x250c + l light upper left corner
+ WACS_L_URCORNER 0x2510 + k light upper right corner
+ WACS_L_VLINE 0x2502 | x light vertical line
+
and for thick lines:
<STRONG>ACS</STRONG> <STRONG>Unicode</STRONG>
<STRONG>ASCII</STRONG> <STRONG>acsc</STRONG> <STRONG>Glyph</STRONG>
diff -ur ncurses-6.1-20191019/include/curses.wide
ncurses-6.1-20191019-dank/include/curses.wide
--- ncurses-6.1-20191019/include/curses.wide 2017-03-26 12:05:21.000000000
-0400
+++ ncurses-6.1-20191019-dank/include/curses.wide 2019-10-24
07:16:16.051908518 -0400
@@ -62,6 +62,31 @@
#define WACS_NEQUAL NCURSES_WACS('|') /* not equal */
#define WACS_STERLING NCURSES_WACS('}') /* UK pound sign */
+ /* light lines */
+#define WACS_BLLB NCURSES_WACS('l')
+#define WACS_LLBB NCURSES_WACS('m')
+#define WACS_BBLL NCURSES_WACS('k')
+#define WACS_LBBL NCURSES_WACS('j')
+#define WACS_LBLL NCURSES_WACS('u')
+#define WACS_LLLB NCURSES_WACS('t')
+#define WACS_LLBL NCURSES_WACS('v')
+#define WACS_BLLL NCURSES_WACS('w')
+#define WACS_BLBL NCURSES_WACS('l')
+#define WACS_LBLB NCURSES_WACS('x')
+#define WACS_LLLL NCURSES_WACS('n')
+
+#define WACS_L_ULCORNER WACS_BLLB
+#define WACS_L_LLCORNER WACS_LLBB
+#define WACS_L_URCORNER WACS_BBLL
+#define WACS_L_LRCORNER WACS_LBBL
+#define WACS_L_RTEE WACS_LBLL
+#define WACS_L_LTEE WACS_LLLB
+#define WACS_L_BTEE WACS_LLBL
+#define WACS_L_TTEE WACS_BLLL
+#define WACS_L_HLINE WACS_BLBL
+#define WACS_L_VLINE WACS_LBLB
+#define WACS_L_PLUS WACS_LLLL
+
/* double lines */
#define WACS_BDDB NCURSES_WACS('C')
#define WACS_DDBB NCURSES_WACS('D')
diff -ur ncurses-6.1-20191019/man/curs_add_wch.3x
ncurses-6.1-20191019-dank/man/curs_add_wch.3x
--- ncurses-6.1-20191019/man/curs_add_wch.3x 2017-11-18 18:47:37.000000000
-0500
+++ ncurses-6.1-20191019-dank/man/curs_add_wch.3x 2019-10-24
06:59:03.510385424 -0400
@@ -177,6 +177,28 @@
WACS_D_VLINE 0x2551 | Y double vertical line
.TE
.PP
+for light lines:
+.TS
+l l l l l
+l l l l l
+_ _ _ _ _
+lw(1.5i) lw5 lw5 lw5 lw20.
+\fBACS\fR \fBUnicode\fP \fBASCII\fR \fBacsc\fP \fBGlyph\fR
+\fBName\fR \fBDefault\fP \fBDefault\fR \fBchar\fP \fBName\fR
+WACS_L_BTEE 0x2534 + v light tee pointing up
+WACS_L_HLINE 0x2500 \- q light horizontal line
+WACS_L_LLCORNER 0x2514 + m light lower left corner
+WACS_L_LRCORNER 0x2518 + j light lower right corner
+WACS_L_LTEE 0x2524 + t light tee pointing right
+WACS_L_PLUS 0x253c + n light large plus
+WACS_L_RTEE 0x251c + u light tee pointing left
+WACS_L_TTEE 0x252c + w light tee pointing down
+WACS_L_ULCORNER 0x250c + l light upper left corner
+WACS_L_URCORNER 0x2510 + k light upper right corner
+WACS_L_VLINE 0x2502 | x light vertical line
+.TE
+.SH RETURN VALUE
+.PP
and for thick lines:
.TS
l l l l l
diff -ur ncurses-6.1-20191019/test/ncurses.c
ncurses-6.1-20191019-dank/test/ncurses.c
--- ncurses-6.1-20191019/test/ncurses.c 2019-09-22 15:12:40.000000000 -0400
+++ ncurses-6.1-20191019-dank/test/ncurses.c 2019-10-24 07:12:23.907134120
-0400
@@ -4067,17 +4067,40 @@
#define MERGE_ATTR(wch) merge_wide_attr(&temp, wch, attr, pair)
+/*#define BOTH2(name) #name, &(name) */
+#define BOTH2(name) #name, MERGE_ATTR(name)
+
+#ifdef CURSES_WACS_ARRAY
+static int
+show_wacs_array(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
+{
+ cchar_t temp;
+
+ int n = 0;
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
+
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_PI));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_S1));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_S3));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_S7));
+ n |= show_1_wacs(n, repeat, BOTH2(WACS_S9));
+ return n;
+}
+#else
+#define show_wacs_array(repeat, attr, pair)
+#endif
+
static void
show_wacs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
-/* display the wide-ACS character set */
+/* display the wide-ACS character set (aka the "light" box drawing chars) */
{
cchar_t temp;
int n;
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
erase();
attron(A_BOLD);
MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4112,18 +4135,7 @@
n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
n = show_1_wacs(n, repeat, BOTH2(WACS_PLUS));
-#ifdef CURSES_WACS_ARRAY
- n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
- n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
- n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
- (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+ (void)show_wacs_array(repeat, attr, pair);
}
#ifdef WACS_D_PLUS
@@ -4135,9 +4147,6 @@
int n;
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
erase();
attron(A_BOLD);
MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4172,18 +4181,7 @@
n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
n = show_1_wacs(n, repeat, BOTH2(WACS_D_PLUS));
-#ifdef CURSES_WACS_ARRAY
- n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
- n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
- n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
- (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+ (void)show_wacs_array(repeat, attr, pair);
}
#endif
@@ -4196,9 +4194,6 @@
int n;
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
erase();
attron(A_BOLD);
MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4233,18 +4228,7 @@
n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
n = show_1_wacs(n, repeat, BOTH2(WACS_T_PLUS));
-#ifdef CURSES_WACS_ARRAY
- n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
- n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
- n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
- n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
- n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
- (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+ (void)show_wacs_array(repeat, attr, pair);
}
#endif
--
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.
0004-add-light-boxdrawingchars.diff
Description: Text Data
- [PATCH] light line draw aliases, clean up tests,
Nick Black <=