Better resizing under ptypipe
[fanfix.git] / src / jexer / TTerminalWindow.java
index 89280fd1d4d18d1b0a4ff0c05139dc916bb8c56a..165ab713119dfdf3cb81b6e9e03a2f7a590ebcf7 100644 (file)
@@ -202,8 +202,7 @@ public class TTerminalWindow extends TScrollableWindow
             pb.redirectErrorStream(true);
             shell = pb.start();
             emulator = new ECMA48(deviceType, shell.getInputStream(),
-                shell.getOutputStream());
-            emulator.setListener(this);
+                shell.getOutputStream(), this);
         } catch (IOException e) {
             messageBox("Error", "Error launching shell: " + e.getMessage());
         }
@@ -349,6 +348,24 @@ public class TTerminalWindow extends TScrollableWindow
         doRepaint();
     }
 
+    /**
+     * Function to call to obtain the display width.
+     *
+     * @return the number of columns in the display
+     */
+    public int getDisplayWidth() {
+        return getWidth() - 2;
+    }
+
+    /**
+     * Function to call to obtain the display height.
+     *
+     * @return the number of rows in the display
+     */
+    public int getDisplayHeight() {
+        return getHeight() - 2;
+    }
+
     /**
      * Handle window close.
      */