[qwaq] Fix some more formatLine cases

I think this is all of them. Scrolling around in a file, including
having the end of file visible in the window, seems to work well.
This commit is contained in:
Bill Currie 2020-03-22 23:50:27 +09:00
parent 16c60655e7
commit bde3124533
2 changed files with 6 additions and 4 deletions

View file

@ -152,7 +152,7 @@ get_window (qwaq_resources_t *res, const char *name, int handle)
window_t *window = window_get (res, handle);
if (!window || !window->win) {
PR_RunError (res->pr, "invalid window passed to %s", name + 3);
PR_RunError (res->pr, "invalid window passed to %s", name + 5);
}
return window;
}

View file

@ -469,10 +469,12 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos,
ptr++;
}
col = ptr >= sels && ptr < sele ? cols : coln;
while (xpos < pos && length-- > 0) {
while (xpos < pos && length > 0) {
*dst++ = col | ' ';
length--;
xpos++;
}
while (length > 0) {
while (length > 0 && ptr < buffer->textSize) {
col = ptr >= sels && ptr < sele ? cols : coln;
c = getChar (buffer, ptr++);
if (c == '\n') {
@ -489,7 +491,7 @@ formatLine (txtbuffer_t *buffer, unsigned linePtr, unsigned xpos,
length--;
}
}
while (c != '\n') {
while (c != '\n' && ptr < buffer->textSize) {
c = getChar (buffer, ptr++);
}
col = ptr >= sels && ptr < sele ? cols : coln;