+ /**
+ * Text window width getter.
+ *
+ * @return the window width
+ */
+ public int getWindowWidth() {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ // Always use 80x25 for Windows (same as DOS)
+ return 80;
+ }
+ return windowWidth;
+ }
+
+ /**
+ * Text window height getter.
+ *
+ * @return the window height
+ */
+ public int getWindowHeight() {
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ // Always use 80x25 for Windows (same as DOS)
+ return 25;
+ }
+ return windowHeight;
+ }
+
+ /**
+ * Re-query the text window size.
+ */
+ public void queryWindowSize() {
+ if (lastQueryWindowTime == 0) {
+ lastQueryWindowTime = System.currentTimeMillis();
+ } else {
+ long nowTime = System.currentTimeMillis();
+ if (nowTime - lastQueryWindowTime < 1000) {
+ // Don't re-spawn stty if it hasn't been a full second since
+ // the last time.
+ return;
+ }
+ }
+ if (System.getProperty("os.name").startsWith("Linux")
+ || System.getProperty("os.name").startsWith("Mac OS X")
+ || System.getProperty("os.name").startsWith("SunOS")
+ || System.getProperty("os.name").startsWith("FreeBSD")
+ ) {
+ // Use stty to get the window size
+ sttyWindowSize();
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // TTYSessionInfo ---------------------------------------------------------
+ // ------------------------------------------------------------------------
+