diff --git a/ruamoko/qwaq/qwaq-curses.c b/ruamoko/qwaq/qwaq-curses.c index 3306af584..02368edc8 100644 --- a/ruamoko/qwaq/qwaq-curses.c +++ b/ruamoko/qwaq/qwaq-curses.c @@ -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; } diff --git a/ruamoko/qwaq/qwaq-editbuffer-bi.c b/ruamoko/qwaq/qwaq-editbuffer-bi.c index 70bb64fa5..2f3f560e9 100644 --- a/ruamoko/qwaq/qwaq-editbuffer-bi.c +++ b/ruamoko/qwaq/qwaq-editbuffer-bi.c @@ -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;