Applied Phil Endecott's patch, which adds support for additional SGR
[apps/madtty.git] / inject.c
index 9d3c431..f9f40e8 100644 (file)
--- a/inject.c
+++ b/inject.c
@@ -75,17 +75,17 @@ static void cursor_line_up(RoteTerm *rt) {
 }
 
 static inline void put_normal_char(RoteTerm *rt, char c) {
+   if (rt->ccol >= rt->cols) {
+      rt->ccol = 0;
+      cursor_line_down(rt);
+   }
+
    rt->cells[rt->crow][rt->ccol].ch = c;
    rt->cells[rt->crow][rt->ccol].attr = rt->curattr;
    rt->ccol++;
 
    rt->line_dirty[rt->crow] = true;
    rt->curpos_dirty = true;
-
-   if (rt->ccol >= rt->cols) {
-      rt->ccol = 0;
-      cursor_line_down(rt);
-   }
 }
 
 static inline void put_graphmode_char(RoteTerm *rt, char c) {