diff src/de/mud/terminal/VDUBuffer.java @ 123:446dbcf606eb

add more 5250 config items; ignore drawing outside the screen
author Carl Byington <carl@five-ten-sg.com>
date Thu, 19 Jun 2014 08:28:23 -0700
parents bf01d1eec5c6
children 6eab98e58bed
line wrap: on
line diff
--- a/src/de/mud/terminal/VDUBuffer.java	Wed Jun 18 19:00:34 2014 -0700
+++ b/src/de/mud/terminal/VDUBuffer.java	Thu Jun 19 08:28:23 2014 -0700
@@ -158,8 +158,10 @@
      */
 
     public void putChar(int c, int l, char ch, int attributes) {
-        charArray[screenBase + l][c] = ch;
-        charAttributes[screenBase + l][c] = attributes;
+        int ll = screenBase + l;
+        if ((ll >= bufSize) || (c >= width)) return;    // ignore characters outside our buffer
+        charArray[ll][c] = ch;
+        charAttributes[ll][c] = attributes;
 
         if (l < height)
             update[l + 1] = true;
@@ -586,8 +588,8 @@
      * @param l line
      */
     public void setCursorPosition(int c, int l) {
-        cursorX = c;
-        cursorY = l;
+        cursorX = min(width-1, c);
+        cursorY = min(height-1, l);
     }
 
     /**