Limited number of iterations in rote_vt_update to avoid infinite loop with ever-avail...
[apps/madtty.git] / inject.c
index 0ba7d69..f9f40e8 100644 (file)
--- a/inject.c
+++ b/inject.c
@@ -1,3 +1,24 @@
+/*
+LICENSE INFORMATION:
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License (LGPL) as published by the Free Software Foundation.
+
+Please refer to the COPYING file for more information.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+
+Copyright (c) 2004 Bruno T. C. de Oliveira
+*/
+
+
 #include "rote.h"
 #include "roteprivate.h"
 #include "inject_csi.h"
@@ -54,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) {