mojibake: don't stomp right side of boxes

This commit is contained in:
nick black 2020-07-05 13:39:48 -04:00
parent 8afd25fef6
commit da765ebdaa
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
3 changed files with 21 additions and 5 deletions

15
TERMS.md Normal file
View File

@ -0,0 +1,15 @@
# Terminals and `TERM`
| Terminal | Recommended `TERM` | Notes |
| -------- | ------ | ----- |
| Linux console | `linux` | 8 (512 glyph fonts) or 16 (256 glyph fonts) colors max. |
| FBterm | | |
| kmscon | | |
| XTerm | | |
| XFCE4 Terminal | | |
| Gnome Terminal | | |
| Konsole | | |
| Alacritty | | |
| Kitty | | |
| GNU Screen | `screen-256colors` | Must be compiled with `--enable-256color`. |
| tmux | | |

View File

@ -3458,7 +3458,7 @@ unicode52(struct ncplane* title, int y){
"\xf0\x9f\x85\xbf \xf0\x9f\x85\xbf\ufe0f"
"\xf0\x9f\x88\xaf \xf0\x9f\x88\xaf\ufe0f"
"\xf0\x9f\x88\x9a \xf0\x9f\x88\x9a\ufe0f"
"\u3299 \u3299\ufe0f \U0001F41D");
"\u3299 \u3299\ufe0f");
return n;
}
@ -3511,10 +3511,10 @@ unicode7emoji2(struct ncplane* title, int y){
struct ncplane*
makegroup(struct ncplane* title, int y, const char* emoji, const char* name){
int cols = mbswidth(emoji);
if(cols < 0){
cols = 1;
if(cols < 0){ // take a wild guess on mbswidth() error.
cols = strlen(emoji) * 3 / 5; // best by test
}
struct ncplane* n = mojiplane(title, y, 2 + (cols + (planewidth - 1)) / planewidth, name);
struct ncplane* n = mojiplane(title, y, 2 + (cols + (planewidth - 3)) / (planewidth - 2), name);
if(n == NULL){
return NULL;
}
@ -3537,7 +3537,7 @@ makegroup(struct ncplane* title, int y, const char* emoji, const char* name){
}
emoji += bytes;
x += w;
if(x >= planewidth - 1){
if(x >= planewidth - 2){
++y;
x = 1;
}

View File

@ -1,3 +1,4 @@
#include <stddef.h>
#include "internal.h"
static const unsigned char zeroes[] = "\x00\x00\x00\x00";