From df2d9ec9d169626cdc2a23829bb2831738215722 Mon Sep 17 00:00:00 2001 From: Igor Burago Date: Thu, 17 May 2018 16:18:10 -0700 Subject: fontsrv: omit box-drawing characters from line struts on macOS For some fonts, using box-drawing characters in the representative text for computing the line height results in it being uncomfortably high. Replace them with accented capitals and tall lower-case letters which lead to a more conservative increase in the line height. Fixes #162. --- src/cmd/fontsrv/osx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/cmd/fontsrv/osx.c b/src/cmd/fontsrv/osx.c index 4d969290..b28ee252 100644 --- a/src/cmd/fontsrv/osx.c +++ b/src/cmd/fontsrv/osx.c @@ -104,7 +104,7 @@ static char *lines[] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz", "g", - "┌┬┐├┼┤└┴┘│─", + "ÁĂÇÂÄĊÀČĀĄÅÃĥľƒ", "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει.", "私はガラスを食べられます。それは私を傷つけません。", "Aš galiu valgyti stiklą ir jis manęs nežeidžia", -- cgit v1.2.3 From a82a8b6368274d77d42f526e379b74e79c137e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20K=C3=BChl?= Date: Wed, 19 Sep 2018 15:19:36 +0200 Subject: acme: Apply each -/+ only once (#156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When plumbing an address like `3-`, Acme selects line 1, and similarly `3+` selects line 5. The same problem can be observed for character addresses (`#123+`) but _not_ for ones like `+`, `.+` or `/foo/+`: The problem only occurs when a number is followed by a direction (`-`/`+`). Following along with the example `3-` through `address` (in addr.c): We read `3` into `c` and match the `case` on line 239. The `while` loop on line 242ff reads additional digits into `c` and puts the first non-digit back by decrementing the index `q`. Then we find the range for line 3 on line 251 and continue. On the next iteration, we set `prevc` to the last `c`, but since that part read ahead _into `c`_, `c` is currently the _next_ character we will read, `-`, and now `prevc` is too. Then in the case block (line 210) the condition on line 211 holds and Acme believes that it has read two `-` in sequence and modifies the range to account for the “first” `-`. The “second” `-` gets applied after the loop is done, on line 292. So the general problem is: While reading numbers, Acme reads the next character after the number into `c`. It decrements the counter to ensure it will read it again on the next iteration, but it still uses it to update `prevc`. This change solves the problem by reading digits into `nc` instead. This variable is used to similar effect in the block for directions (line 212) and fills the role of “local `c` that we can safely use to read ahead” nicely. --- src/cmd/acme/addr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cmd/acme/addr.c b/src/cmd/acme/addr.c index 2ccae960..6aee8993 100644 --- a/src/cmd/acme/addr.c +++ b/src/cmd/acme/addr.c @@ -240,12 +240,12 @@ address(uint showerr, Text *t, Range lim, Range ar, void *a, uint q0, uint q1, i case '5': case '6': case '7': case '8': case '9': n = c -'0'; while(q Date: Sat, 29 Sep 2018 15:59:31 +0200 Subject: libregexp: include stddef.h in lib9.std.h Commit 2d82ef9d98 added ptrdiff_t in regcomp.c. However, this change broke the build of the Unix package because ptrdiff_t is defined in stddef.h. --- src/libregexp/lib9.std.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/libregexp/lib9.std.h b/src/libregexp/lib9.std.h index 0cefdde7..1d7aaa62 100644 --- a/src/libregexp/lib9.std.h +++ b/src/libregexp/lib9.std.h @@ -3,6 +3,7 @@ #include #include #include +#include #define exits(x) exit(x && *x ? 1 : 0) -- cgit v1.2.3 From 93c75d2bad341af383520409fd354dcff3f2c279 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Mon, 1 Oct 2018 17:20:35 +0200 Subject: grep: update from Plan 9 This change fixes a segfault in grep -e when no argument has been provided. Thanks to Sean Hinchee for reporting this issue. Fixes #186. --- src/cmd/grep/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cmd/grep/main.c b/src/cmd/grep/main.c index d37aeb10..a847d73f 100644 --- a/src/cmd/grep/main.c +++ b/src/cmd/grep/main.c @@ -5,7 +5,7 @@ char *validflags = "bchiLlnsv"; void usage(void) { - fprint(2, "usage: grep [-%s] [-f file] [-e expr] [file ...]\n", validflags); + fprint(2, "usage: grep [-%s] [-e pattern] [-f patternfile] [file ...]\n", validflags); exits("usage"); } @@ -31,12 +31,12 @@ main(int argc, char *argv[]) case 'e': flags['e']++; lineno = 0; - str2top(ARGF()); + str2top(EARGF(usage())); break; case 'f': flags['f']++; - filename = ARGF(); + filename = EARGF(usage()); rein = Bopen(filename, OREAD); if(rein == 0) { fprint(2, "grep: can't open %s: %r\n", filename); -- cgit v1.2.3