fix javadoc header
[fanfix.git] / src / jexer / session / TTYSessionInfo.java
index 080e949b7ef5d8ff3dab6de3112a85d8c31e62a1..5d858c6e2ba5996b605bee7d191e32bde9b3d77a 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Jexer - Java Text User Interface
  *
  * License: LGPLv3 or later
@@ -38,9 +38,8 @@ import java.util.StringTokenizer;
 
 /**
  * TTYSessionInfo queries environment variables and the tty window size for
- * the session information.  The username is taken from
- * getpwuid(geteuid()).pw_name, language is taken from LANG, and text window
- * size from ioctl(TIOCGWINSIZ).
+ * the session information.  The username is taken from user.name, language
+ * is taken from user.language, and text window size from 'stty size'.
  */
 public final class TTYSessionInfo implements SessionInfo {
 
@@ -120,8 +119,14 @@ public final class TTYSessionInfo implements SessionInfo {
             String line = in.readLine();
             if ((line != null) && (line.length() > 0)) {
                 StringTokenizer tokenizer = new StringTokenizer(line);
-                windowHeight = Integer.parseInt(tokenizer.nextToken());
-                windowWidth = Integer.parseInt(tokenizer.nextToken());
+                int rc = Integer.parseInt(tokenizer.nextToken());
+                if (rc > 0) {
+                    windowHeight = rc;
+                }
+                rc = Integer.parseInt(tokenizer.nextToken());
+                if (rc > 0) {
+                    windowWidth = rc;
+                }
             }
             while (true) {
                 BufferedReader err = new BufferedReader(