Add NetBSD support

This commit is contained in:
Justine Tunney 2021-02-05 06:16:20 -08:00
parent 2fdc19e7a7
commit 23ae9dfceb
4020 changed files with 8955 additions and 8128 deletions

View file

@ -958,7 +958,7 @@ static void DrawHr(struct Panel *p, const char *s) {
long i, wp, ws, wl, wr;
if (p->bottom - p->top < 1) return;
wp = p->right - p->left;
ws = strwidth(s);
ws = strwidth(s, 0);
wl = wp / 4 - ws / 2;
wr = wp - (wl + ws);
for (i = 0; i < wl; ++i) AppendWide(&p->lines[0], u'');

View file

@ -113,7 +113,7 @@ void *FormatStringTableAsAssembly(long yn, long xn, const char *const T[yn][xn],
EmitSection(yn, xn, w, GetArrayAlignment(yn, xn, w, align), emit, a);
emit(name, a);
emit(":", a);
if (strwidth(name) >= 8) emit("\n", a);
if (strwidth(name, 0) >= 8) emit("\n", a);
FormatStringTable(yn, xn, T, emit, a, gc(xstrcat("\t.", storage, "\t")), ",",
"\n");
emit("\t.endobj\t", a);

View file

@ -35,7 +35,7 @@ static unsigned GetBiggestCellWidth(long yn, long xn,
long w, y, x;
for (w = y = 0; y < yn; ++y) {
for (x = 0; x < xn; ++x) {
w = max(w, strwidth(T[y][x]));
w = max(w, strwidth(T[y][x], 0));
}
}
return w;
@ -50,7 +50,7 @@ void *FormatStringTable(long yn, long xn, const char *const T[yn][xn],
emit(startrow, a);
for (x = 0; x < xn; ++x) {
if (x) emit(comma, a);
for (n = w - strwidth(T[y][x]), i = 0; i < n; ++i) emit(" ", a);
for (n = w - strwidth(T[y][x], 0), i = 0; i < n; ++i) emit(" ", a);
emit(T[y][x], a);
}
emit(endrow, a);

View file

@ -1057,7 +1057,7 @@ static void Draw(void) {
AppendStr("\e[0;7m");
GenerateStatusLine();
AppendStr(statusline);
n = txn - strwidth(statusline);
n = txn - strwidth(statusline, 0);
for (i = 0; i < n; ++i) {
AppendStr(" ");
}

View file

@ -726,20 +726,20 @@ static void RenderIt(void) {
if (HasAdjustments()) {
DescribeAdjustments(status_[6]);
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 7,
HALF(xn) - strwidth(status_[6]), status_[6]);
HALF(xn) - strwidth(status_[6], 0), status_[6]);
}
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 6,
HALF(xn) - strwidth(status_[4]), status_[4]);
HALF(xn) - strwidth(status_[4], 0), status_[4]);
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 5,
HALF(xn) - strwidth(status_[5]), status_[5]);
HALF(xn) - strwidth(status_[5], 0), status_[5]);
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 4,
HALF(xn) - strwidth(status_[1]), status_[1]);
HALF(xn) - strwidth(status_[1], 0), status_[1]);
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 3,
HALF(xn) - strwidth(status_[0]), status_[0]);
HALF(xn) - strwidth(status_[0], 0), status_[0]);
p += sprintf(p, "\e[%d;%dH%30s", lastrow_ - 2,
HALF(xn) - strwidth(status_[2]), status_[2]);
HALF(xn) - strwidth(status_[2], 0), status_[2]);
p += sprintf(p, "\e[%d;%dH%s", lastrow_ - 1,
HALF(xn) - strwidth(status_[3]), status_[3]);
HALF(xn) - strwidth(status_[3], 0), status_[3]);
p += sprintf(p, "\e[%d;%dH %s %s ", lastrow_ - 2, 2,
program_invocation_name, "");
p += sprintf(p, "\e[%d;%dH %s ", lastrow_ - 1, 2,

View file

@ -137,7 +137,7 @@ void processfile(void) {
if (len < USHRT_MAX) {
if ((p = strstr(line_, delim_))) {
off = p - line_;
col = strnwidth(line_, off);
col = strnwidth(line_, off, 0);
if (col < USHRT_MAX) {
col_ = max(col_, col);
append(&lines_, &((struct Line){.line = s, .off = off, .col = col}));