aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-25 00:39:10 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-25 00:39:10 -0400
commitc59379881c47b5b803fb14865cfe7d04a536e6f2 (patch)
treea05c42f392812fd381203d534666dfacfff96e09
parentc34883a6bbc3fdc15adfea50e9e58efa7b783bc7 (diff)
downloadrunes-c59379881c47b5b803fb14865cfe7d04a536e6f2.tar.gz
runes-c59379881c47b5b803fb14865cfe7d04a536e6f2.zip
lines shouldn't wrap until the next character is actually drawn
-rw-r--r--src/screen.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/screen.c b/src/screen.c
index 459f136..5014474 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -53,17 +53,19 @@ void runes_screen_show_string_ascii(RunesTerm *t, char *buf, size_t len)
size_t i;
for (i = 0; i < len; ++i) {
- struct runes_cell *cell = &scr->rows[scr->cur.row].cells[scr->cur.col];
+ struct runes_cell *cell;
+
+ if (scr->cur.col >= scr->max.col) {
+ scr->cur.col = 0;
+ scr->cur.row++;
+ }
+ cell = &scr->rows[scr->cur.row].cells[scr->cur.col];
cell->contents[0] = buf[i];
cell->contents[1] = '\0';
cell->len = 1;
scr->cur.col++;
- if (scr->cur.col >= scr->max.col) {
- scr->cur.col = 0;
- scr->cur.row++;
- }
}
}