diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-11 04:00:46 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-11 04:00:46 +0000 |
commit | e9f1ccb0308f207303af2507415379c4d8dbcd6a (patch) | |
tree | 63405092a3b6eee03ee1ecef6a7da1578dd23b42 /src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala | |
parent | 8e380b67366ab83d81fd401632af17d7cc0c2205 (diff) | |
download | scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.tar.gz scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.tar.bz2 scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.zip |
This addresses a few long standing irritations ...
This addresses a few long standing irritations with jline, rewriting
chunks of it along the way. No longer does columnar output spill over
and double space everything if you're unlucky with the chosen widths.
Pagination works for a higher definition of work. Etc.
Also, for those who enjoy operating missile systems from their repls,
crash recovery now requests your permission before replaying the
session.
Closes #4194, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala index 782fd52ab2..1430cbe55c 100644 --- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala @@ -17,16 +17,25 @@ import Properties.isMac trait InteractiveReader { val interactive: Boolean + def init(): Unit + def reset(): Unit + def history: History def completion: Completion def keyBindings: List[KeyBinding] + def eraseLine(): Unit + def redrawLine(): Unit + def currentLine: String - def init(): Unit - def reset(): Unit + def readYesOrNo(prompt: String) = readOneKey(prompt) match { + case 'y' => true + case 'n' => false + } + def readAssumingNo(prompt: String) = try readYesOrNo(prompt) catch { case _: MatchError => false } + def readAssumingYes(prompt: String) = try readYesOrNo(prompt) catch { case _: MatchError => true } protected def readOneLine(prompt: String): String - def redrawLine(): Unit - def currentLine: String + protected def readOneKey(prompt: String): Int def readLine(prompt: String): String = // hack necessary for OSX jvm suspension because read calls are not restarted after SIGTSTP |