aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-13 19:03:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-13 19:03:43 -0700
commit7614514f0b7cd17e1f65eb691a1a21c14afa3353 (patch)
tree77a1cedcc66bf1a259610497f5e1f493ebaaf559
parent297cf626809f27e3543576cb3547eb1868b663c8 (diff)
downloadpw-7614514f0b7cd17e1f65eb691a1a21c14afa3353.tar.gz
pw-7614514f0b7cd17e1f65eb691a1a21c14afa3353.tar.bz2
pw-7614514f0b7cd17e1f65eb691a1a21c14afa3353.zip
drawline: move integer index pos, not line pointer.
-rw-r--r--pw.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pw.c b/pw.c
index 1abe3d0..ae6545d 100644
--- a/pw.c
+++ b/pw.c
@@ -432,13 +432,13 @@ static void drawline(pwstate *pw, const char *line, int lineno)
putchar(' ');
columns -= vsplit1;
}
- line += len;
+ pos += len;
len = 0;
} else {
for (int i = 0; i < vsplit1; i++)
putchar(line[i]);
len -= vsplit1;
- line += vsplit1;
+ pos += vsplit1;
columns -= vsplit1;
endmark = 1;
}
@@ -466,11 +466,11 @@ static void drawline(pwstate *pw, const char *line, int lineno)
putchar(' ');
columns -= vsplit2;
- line += vsplit2;
+ pos += vsplit2;
len -= vsplit2;
endmark = 1;
} else {
- line += len;
+ pos += len;
len = 0;
endmark = (i == width);
}
@@ -478,17 +478,17 @@ static void drawline(pwstate *pw, const char *line, int lineno)
if (pw->hpos < len) {
if (pw->hpos || vsplit1 || vsplit2) {
- line += pw->hpos + 1;
+ pos += pw->hpos + 1;
len -= pw->hpos + 1;
hlchar(pw, '>');
columns--;
}
if (len < columns) {
- fputs(line, stdout);
+ fputs(line + pos, stdout);
clreol(1);
} else {
for (int i = 0; i < columns - 1; i++)
- putchar(line[i]);
+ putchar(line[pos + i]);
hlchar(pw, '<');
putchar('\n');
}