Skip to content

Commit

Permalink
make terminalHeight and terminalWidth lazy vals, to avoid recomputing it
Browse files Browse the repository at this point in the history
all the time. (Also prevents repeated error messages on unsupported
terminals.)
  • Loading branch information
dlwh committed Jan 17, 2012
1 parent ec4f431 commit 91f8922
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/scala/scalala/ScalalaConsole.scala
Expand Up @@ -56,7 +56,7 @@ object ScalalaConsole {
}

/** The width of the console, or 80 if it can't be discovered. */
def terminalWidth : Int = {
lazy val terminalWidth : Int = {
// this ugly try-catch is here to use scala's built-in jline,
// which only exists in scala > 2.9
try {
Expand All @@ -75,8 +75,9 @@ object ScalalaConsole {
}
}
};

def terminalHeight : Int = {

/** The height of the console, or 24 if it can't be discovered. */
lazy val terminalHeight : Int = {
// this ugly try-catch is here to use scala's built-in jline,
// which only exists in scala > 2.9
try {
Expand Down

0 comments on commit 91f8922

Please sign in to comment.