summaryrefslogtreecommitdiff
path: root/src/jline
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2011-04-19 12:10:57 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2011-04-19 12:10:57 +0000
commita387c9fd9b88861e5ca6bfae59c0f4f540fd4133 (patch)
treef89c2de13a8e0d88becf0c0acab68c9779fac194 /src/jline
parent260a41241e7c4bde3280fb80d2a509102c77c114 (diff)
downloadscala-a387c9fd9b88861e5ca6bfae59c0f4f540fd4133.tar.gz
scala-a387c9fd9b88861e5ca6bfae59c0f4f540fd4133.tar.bz2
scala-a387c9fd9b88861e5ca6bfae59c0f4f540fd4133.zip
Merged revisions 24749-24771,24773-24774,24776-...
Merged revisions 24749-24771,24773-24774,24776-24779 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r24749 | odersky | 2011-04-13 17:07:21 +0200 (Wed, 13 Apr 2011) | 1 line Fixes my part of #4283 by inserting another cast pre-emptively when an IllegalAccess error is possible in an erasure-inserted cast. Review by extempore. ........ r24750 | dragos | 2011-04-13 18:15:37 +0200 (Wed, 13 Apr 2011) | 1 line Warn when the jar file cannot be found when loading a plugin. no review. ........ r24751 | dragos | 2011-04-13 18:15:43 +0200 (Wed, 13 Apr 2011) | 1 line Closes #4283. no review. ........ r24752 | prokopec | 2011-04-13 18:31:42 +0200 (Wed, 13 Apr 2011) | 45 lines Refactoring the collections api to support differentiation between referring to a sequential collection and a parallel collection, and to support referring to both types of collections. New set of traits Gen* are now superclasses of both their * and Par* subclasses. For example, GenIterable is a superclass of both Iterable and ParIterable. Iterable and ParIterable are not in a subclassing relation. The new class hierarchy is illustrated below (simplified, not all relations and classes are shown): TraversableOnce --> GenTraversableOnce ^ ^ | | Traversable --> GenTraversable ^ ^ | | Iterable --> GenIterable <-- ParIterable ^ ^ ^ | | | Seq --> GenSeq <-- ParSeq (the *Like, *View and *ViewLike traits have a similar hierarchy) General views extract common view functionality from parallel and sequential collections. This design also allows for more flexible extensions to the collections framework. It also allows slowly factoring out common functionality up into Gen* traits. From now on, it is possible to write this: import collection._ val p = parallel.ParSeq(1, 2, 3) val g: GenSeq[Int] = p // meaning a General Sequence val s = g.seq // type of s is Seq[Int] for (elem <- g) { // do something without guarantees on sequentiality of foreach // this foreach may be executed in parallel } for (elem <- s) { // do something with a guarantee that foreach is executed in order, sequentially } for (elem <- p) { // do something concurrently, in parallel } This also means that some signatures had to be changed. For example, method `flatMap` now takes `A => GenTraversableOnce[B]`, and `zip` takes a `GenIterable[B]`. Also, there are mutable & immutable Gen* trait variants. They have generic companion functionality. ........ r24753 | prokopec | 2011-04-13 18:31:58 +0200 (Wed, 13 Apr 2011) | 3 lines Fixes and closes #4405. No review. ........ r24754 | prokopec | 2011-04-13 18:32:01 +0200 (Wed, 13 Apr 2011) | 3 lines Fixed some tests, renamed from Any to Gen. No review. ........ r24755 | prokopec | 2011-04-13 18:32:04 +0200 (Wed, 13 Apr 2011) | 3 lines Further fixes #4405. No review. ........ r24756 | prokopec | 2011-04-13 18:32:09 +0200 (Wed, 13 Apr 2011) | 3 lines Added test case for #4459. No review. ........ r24757 | extempore | 2011-04-13 21:00:56 +0200 (Wed, 13 Apr 2011) | 1 line New starr based on r24749. No review. ........ r24758 | dragos | 2011-04-13 21:12:57 +0200 (Wed, 13 Apr 2011) | 1 line Revert "Closes #4283. no review." because of failing tests. ........ r24759 | extempore | 2011-04-14 06:15:50 +0200 (Thu, 14 Apr 2011) | 2 lines Tests which run have to be called "Test". Fixes failing test and renames file to avoid ant's brainlessness, no review. ........ r24760 | extempore | 2011-04-14 08:38:35 +0200 (Thu, 14 Apr 2011) | 9 lines Doing a little polishing on the parallel collections refactor (which overall looks like a big improvement.) I went for some simpler wording and moved a number of scaladoc tags around because the rug had been pulled out from under their feet. This leaves a lot undone, but since many of the docs need to be reworded before they can move from e.g. SeqLike to GenSeqLike, and I'm not well informed on exactly how these abstractions are being presented, I stayed in the safe zone. Review by prokopec. ........ r24761 | phaller | 2011-04-14 11:11:10 +0200 (Thu, 14 Apr 2011) | 1 line Closed #4454. Applied patch provided in ticket. No review. ........ r24762 | dragos | 2011-04-14 15:48:00 +0200 (Thu, 14 Apr 2011) | 1 line This time, fixed #4283. no review. ........ r24763 | extempore | 2011-04-14 16:25:46 +0200 (Thu, 14 Apr 2011) | 4 lines Of late the test which fires up the window server, which has already been the source of undue quantities of inconvenience, has taken to hanging indefinitely when I run the test suite on a remote machine. Rope at end, goodbye test, no review. ........ r24764 | prokopec | 2011-04-14 18:09:33 +0200 (Thu, 14 Apr 2011) | 4 lines Adding some docs refactorings. Also, added some docs variables to Gen* traits that were missing. No review. ........ r24765 | extempore | 2011-04-14 21:33:39 +0200 (Thu, 14 Apr 2011) | 2 lines Some patches to jline, and new jar. Thanks to Kenji Matsuoka for improving the keybindings. No review. ........ r24766 | extempore | 2011-04-14 23:05:12 +0200 (Thu, 14 Apr 2011) | 3 lines Adds "since" field to @deprecated. Thanks to Simon Ochsenreither for the patch, as it's a change I've always wanted. Moving up in the glamorous world of scala commits! No review. ........ r24767 | extempore | 2011-04-14 23:06:14 +0200 (Thu, 14 Apr 2011) | 3 lines Various addenda to soc's patch: regenerating Product/Tuple/Function classes and AnyVal sources, making versioning consistent, etc. Closes #4477, no review. ........ r24768 | extempore | 2011-04-15 04:39:32 +0200 (Fri, 15 Apr 2011) | 3 lines Some mopping up having to do with deprecated gaining an argument, which may or may not cure scaladoc of its current assertion failure. No review. ........ r24769 | extempore | 2011-04-15 07:05:53 +0200 (Fri, 15 Apr 2011) | 1 line Fixing a couple more tests, no review. ........ r24770 | extempore | 2011-04-15 08:55:32 +0200 (Fri, 15 Apr 2011) | 6 lines Having been tortured by remorse ever since tiark told me that r23934 had made the hashmap slower, I crushed my previous efforts under the heel of my boot, threw all the types out the window, poured acid on them, and turned all the dials to the far other extreme. Pity the man who will sell his soul for a few CPU cycles. (I am that man.) Review by rompf. ........ r24771 | prokopec | 2011-04-15 09:54:54 +0200 (Fri, 15 Apr 2011) | 3 lines Couple of fixes to the usecases in docs. No review. ........ r24773 | kzys | 2011-04-15 18:12:22 +0200 (Fri, 15 Apr 2011) | 2 lines [scaladoc] Strike-through for deprecated symbols on the reference index. Closes #4471. Review by dubochet. ........ r24774 | extempore | 2011-04-15 23:03:44 +0200 (Fri, 15 Apr 2011) | 3 lines Added a script in tools for deploying maven artifacts locally, since it always takes me an eternity to figure out slash remember how to do it. No review. ........ r24776 | extempore | 2011-04-17 21:58:15 +0200 (Sun, 17 Apr 2011) | 2 lines Added releaseVersion and developmentVersion to Properties so people don't all have to parse the versionString. No review. ........ r24777 | extempore | 2011-04-17 23:28:03 +0200 (Sun, 17 Apr 2011) | 1 line Revised that last botched commit. No review. ........ r24778 | odersky | 2011-04-19 11:52:59 +0200 (Tue, 19 Apr 2011) | 1 line Trying to get build times down by refining implicit searches. Implicit infos associated with toplevel classes are cached now. Review by rompf. ........ r24779 | odersky | 2011-04-19 12:56:58 +0200 (Tue, 19 Apr 2011) | 1 line Further optimizations of implicits. Now, improves checks between static members are cached as well. Review by rompf. ........
Diffstat (limited to 'src/jline')
-rw-r--r--src/jline/pom.xml273
-rw-r--r--src/jline/project/build.properties4
-rw-r--r--src/jline/project/plugins/project/build.properties2
-rw-r--r--src/jline/src/main/java/scala/tools/jline/TerminalSupport.java10
-rw-r--r--src/jline/src/main/java/scala/tools/jline/UnixTerminal.java15
-rw-r--r--src/jline/src/main/java/scala/tools/jline/console/ConsoleReader.java46
-rw-r--r--src/jline/src/main/java/scala/tools/jline/console/Key.java6
-rw-r--r--src/jline/src/main/resources/scala/tools/jline/keybindings.properties3
-rw-r--r--src/jline/src/main/resources/scala/tools/jline/macbindings.properties62
9 files changed, 120 insertions, 301 deletions
diff --git a/src/jline/pom.xml b/src/jline/pom.xml
deleted file mode 100644
index 08a59b054d..0000000000
--- a/src/jline/pom.xml
+++ /dev/null
@@ -1,273 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.sonatype.forge</groupId>
- <artifactId>forge-parent</artifactId>
- <version>6</version>
- </parent>
-
- <groupId>org.sonatype.jline</groupId>
- <artifactId>jline</artifactId>
- <name>JLine</name>
- <version>2.6-SNAPSHOT</version>
-
- <organization>
- <name>Sonatype</name>
- <url>http://sonatype.org</url>
- </organization>
-
- <licenses>
- <license>
- <name>The BSD License</name>
- <url>http://www.opensource.org/licenses/bsd-license.php</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:git:git://github.com/jdillon/jline2.git</connection>
- <developerConnection>scm:git:ssh://git@github.com/jdillon/jline2.git</developerConnection>
- <url>http://github.com/jdillon/jline2</url>
- </scm>
-
- <ciManagement>
- <system>Hudson</system>
- <url>https://grid.sonatype.org/ci/job/JLine2</url>
- </ciManagement>
-
- <developers>
- <developer>
- <id>jdillon</id>
- <name>Jason Dillon</name>
- <email>jason@planet57.com</email>
- <roles>
- <role>Build Master</role>
- <role>Developer</role>
- </roles>
- </developer>
- </developers>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <!--
- <repositories>
- <repository>
- <id>jansi</id>
- <url>http://jansi.fusesource.org/repo/snapshot</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- -->
-
- <dependencies>
- <dependency>
- <groupId>org.fusesource.jansi</groupId>
- <artifactId>jansi</artifactId>
- <version>1.4</version>
- <!--<scope>provided</scope>-->
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <defaultGoal>install</defaultGoal>
-
- <resources>
- <resource>
- <directory>${project.basedir}/src/main/resources</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
-
- <resource>
- <directory>${project.basedir}/src/main/filtered-resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- </resources>
-
- <testResources>
- <testResource>
- <directory>${project.basedir}/src/test/resources</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </testResource>
-
- <testResource>
- <directory>${project.basedir}/src/test/filtered-resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*</include>
- </includes>
- </testResource>
- </testResources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <forkMode>once</forkMode>
- <argLine>-ea</argLine>
- <failIfNoTests>false</failIfNoTests>
- <workingDirectory>${project.build.directory}</workingDirectory>
- <excludes>
- <exclude>**/Abstract*.java</exclude>
- <exclude>**/Test*.java</exclude>
- </excludes>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.1.0</version>
- <executions>
- <execution>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- <configuration>
- <instructions>
- <Import-Package>!scala.tools.jline*,javax.swing;resolution:=optional,*</Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.3.1</version>
- <configuration>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-scm-plugin</artifactId>
- <version>1.4</version>
- </plugin>
-
- <!-- include all the dependencies into the jar so it can run standalone -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <excludes>
- <exclude>junit:junit</exclude>
- </excludes>
- </artifactSet>
- <filters>
- <filter>
- <artifact>org.fusesource.jansi:jansi</artifact>
- <excludes>
- <exclude>META-INF/maven/**</exclude>
- <exclude>*.txt</exclude>
- <exclude>junit/**</exclude>
- <exclude>org/junit/**</exclude>
- <exclude>org/hamcrest/**</exclude>
- <exclude>org/fusesource/hawtjni/runtime/Jni*</exclude>
- <exclude>org/fusesource/hawtjni/runtime/*Flag*</exclude>
- <exclude>org/fusesource/hawtjni/runtime/T32*</exclude>
- <exclude>org/fusesource/hawtjni/runtime/NativeStats*</exclude>
- </excludes>
- </filter>
- </filters>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>retro</id>
- <activation>
- <property>
- <name>retro</name>
- <value>true</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>retrotranslator-maven-plugin</artifactId>
- <version>1.0-alpha-4</version>
- <executions>
- <execution>
- <goals>
- <goal>translate-project</goal>
- </goals>
- <configuration>
- <classifier>jdk14</classifier>
- <attach>true</attach>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project> \ No newline at end of file
diff --git a/src/jline/project/build.properties b/src/jline/project/build.properties
index 3ecffcd808..89d3b4a498 100644
--- a/src/jline/project/build.properties
+++ b/src/jline/project/build.properties
@@ -1,8 +1,8 @@
#Project properties
+#Wed Mar 23 21:05:24 PDT 2011
project.organization=org.improving
project.name=jline
-sbt.version=0.7.5.RC0
+sbt.version=0.7.6.RC0
project.version=0.98
build.scala.versions=2.8.1
-/*build.scala.versions=2.9.0-SNAPSHOT*/
project.initialize=false
diff --git a/src/jline/project/plugins/project/build.properties b/src/jline/project/plugins/project/build.properties
index 0b7014c531..24481fef8e 100644
--- a/src/jline/project/plugins/project/build.properties
+++ b/src/jline/project/plugins/project/build.properties
@@ -1,3 +1,3 @@
#Project properties
-#Thu Feb 10 14:58:03 PST 2011
+#Tue Apr 05 12:32:56 PDT 2011
plugin.uptodate=true
diff --git a/src/jline/src/main/java/scala/tools/jline/TerminalSupport.java b/src/jline/src/main/java/scala/tools/jline/TerminalSupport.java
index 1ca12cb73f..03004fea68 100644
--- a/src/jline/src/main/java/scala/tools/jline/TerminalSupport.java
+++ b/src/jline/src/main/java/scala/tools/jline/TerminalSupport.java
@@ -24,6 +24,10 @@ public abstract class TerminalSupport
implements Terminal
{
public static String DEFAULT_KEYBINDINGS_PROPERTIES = "keybindings.properties";
+ public static String DEFAULT_KEYBINDINGS_PROPERTIES_MAC = "macbindings.properties";
+ public static boolean isMac() {
+ return System.getProperty("os.name").toLowerCase().startsWith("mac");
+ }
public static final String JLINE_SHUTDOWNHOOK = "jline.shutdownhook";
@@ -157,7 +161,11 @@ public abstract class TerminalSupport
}
public InputStream getDefaultBindings() {
- return TerminalSupport.class.getResourceAsStream(DEFAULT_KEYBINDINGS_PROPERTIES);
+ // Mac bindings are slightly different from Unix/Linux.
+ // For instance, the Delete key behavior is different between them.
+ return TerminalSupport.class.getResourceAsStream(
+ isMac() ? DEFAULT_KEYBINDINGS_PROPERTIES_MAC : DEFAULT_KEYBINDINGS_PROPERTIES
+ );
}
//
diff --git a/src/jline/src/main/java/scala/tools/jline/UnixTerminal.java b/src/jline/src/main/java/scala/tools/jline/UnixTerminal.java
index 10c98888d3..71659c5a42 100644
--- a/src/jline/src/main/java/scala/tools/jline/UnixTerminal.java
+++ b/src/jline/src/main/java/scala/tools/jline/UnixTerminal.java
@@ -166,6 +166,16 @@ public class UnixTerminal
return DELETE.code;
}
}
+ else if (c == 'b') { // alt-b: go back a word
+ return CTRL_O.code; // PREV_WORD
+ }
+ else if (c == 'f') { // alt-f: go forward a word
+ return CTRL_T.code; // NEXT_WORD
+ }
+ else if (key == DEL) { // alt-backspace: delete previous word
+ return CTRL_W.code; // DELETE_PREV_WORD
+ }
+
}
// handle unicode characters, thanks for a patch from amyi@inf.ed.ac.uk
@@ -205,7 +215,10 @@ public class UnixTerminal
DEL_THIRD(51),
- DEL_SECOND(126),;
+ DEL_SECOND(126),
+
+ DEL(127);
+
public final short code;
diff --git a/src/jline/src/main/java/scala/tools/jline/console/ConsoleReader.java b/src/jline/src/main/java/scala/tools/jline/console/ConsoleReader.java
index 861c2d58bd..5e6f5c166a 100644
--- a/src/jline/src/main/java/scala/tools/jline/console/ConsoleReader.java
+++ b/src/jline/src/main/java/scala/tools/jline/console/ConsoleReader.java
@@ -85,7 +85,7 @@ public class ConsoleReader
{
this.in = in;
this.terminal = term != null ? term : TerminalFactory.get();
- this.out = new PrintWriter(terminal.wrapOutIfNeeded(out));
+ this.out = new PrintWriter(getTerminal().wrapOutIfNeeded(out));
this.keyBindings = loadKeyBindings(bindings);
setBellEnabled(!Configuration.getBoolean(JLINE_NOBELL, false));
@@ -555,9 +555,9 @@ public class ConsoleReader
if (mask != null) {
Arrays.fill(chars, mask);
}
- if (terminal.hasWeirdWrap()) {
+ if (getTerminal().hasWeirdWrap()) {
// need to determine if wrapping will occur:
- int width = terminal.getWidth();
+ int width = getTerminal().getWidth();
int pos = getCursorPosition();
for (int i = 0; i < chars.length; i++) {
print(chars[i]);
@@ -570,7 +570,7 @@ public class ConsoleReader
print(chars);
}
clearAhead(clear, chars.length);
- if (terminal.isAnsiSupported()) {
+ if (getTerminal().isAnsiSupported()) {
if (chars.length > 0) {
back(chars.length);
}
@@ -578,8 +578,8 @@ public class ConsoleReader
back(chars.length);
}
}
- if (terminal.hasWeirdWrap()) {
- int width = terminal.getWidth();
+ if (getTerminal().hasWeirdWrap()) {
+ int width = getTerminal().getWidth();
// best guess on whether the cursor is in that weird location...
// Need to do this without calling ansi cursor location methods
// otherwise it breaks paste of wrapped lines in xterm.
@@ -614,8 +614,8 @@ public class ConsoleReader
return;
}
- if (terminal.isAnsiSupported()) {
- int width = terminal.getWidth();
+ if (getTerminal().isAnsiSupported()) {
+ int width = getTerminal().getWidth();
int screenCursorCol = getCursorPosition() + delta;
// clear current line
printAnsiSequence("K");
@@ -652,7 +652,7 @@ public class ConsoleReader
*/
protected void back(final int num) throws IOException {
if (num == 0) return;
- if (terminal.isAnsiSupported()) {
+ if (getTerminal().isAnsiSupported()) {
int width = getTerminal().getWidth();
int cursor = getCursorPosition();
int realCursor = cursor + num;
@@ -700,7 +700,7 @@ public class ConsoleReader
count = moveCursor(-1 * num) * -1;
buf.buffer.delete(buf.cursor, buf.cursor + count);
if (getCursorPosition() / termwidth != lines) {
- if (terminal.isAnsiSupported()) {
+ if (getTerminal().isAnsiSupported()) {
// debug("doing backspace redraw: " + getCursorPosition() + " on " + termwidth + ": " + lines);
printAnsiSequence("K");
// if cursor+num wraps, then we need to clear the line(s) below too
@@ -828,7 +828,7 @@ public class ConsoleReader
// + buf.cursor + " => " + (buf.cursor + where) + ")");
buf.cursor += where;
- if (terminal.isAnsiSupported()) {
+ if (getTerminal().isAnsiSupported()) {
if (where < 0) {
back(Math.abs(where));
} else {
@@ -837,12 +837,12 @@ public class ConsoleReader
int oldLine = (cursor - where) / width;
int newLine = cursor / width;
if (newLine > oldLine) {
- if (terminal.hasWeirdWrap()) {
+ if (getTerminal().hasWeirdWrap()) {
// scroll up if at bottom
// note:
- // on rxvt cywgin terminal.getHeight() is incorrect
+ // on rxvt cywgin getTerminal().getHeight() is incorrect
// MacOs xterm does not seem to support scrolling
- if (getCurrentAnsiRow() == terminal.getHeight()) {
+ if (getCurrentAnsiRow() == getTerminal().getHeight()) {
printAnsiSequence((newLine - oldLine) + "S");
}
}
@@ -918,7 +918,7 @@ public class ConsoleReader
* @return the character, or -1 if an EOF is received.
*/
public final int readVirtualKey() throws IOException {
- int c = terminal.readVirtualKey(in);
+ int c = getTerminal().readVirtualKey(in);
Log.trace("Keystroke: ", c);
@@ -933,7 +933,7 @@ public class ConsoleReader
*/
private int clearEcho(final int c) throws IOException {
// if the terminal is not echoing, then ignore
- if (!terminal.isEchoEnabled()) {
+ if (!getTerminal().isEchoEnabled()) {
return 0;
}
@@ -1171,7 +1171,7 @@ public class ConsoleReader
}
try {
- if (!terminal.isSupported()) {
+ if (!getTerminal().isSupported()) {
beforeReadLine(prompt, mask);
}
@@ -1181,7 +1181,7 @@ public class ConsoleReader
}
// if the terminal is unsupported, just use plain-java reading
- if (!terminal.isSupported()) {
+ if (!getTerminal().isSupported()) {
return readLine(in);
}
@@ -1283,7 +1283,7 @@ public class ConsoleReader
if (buf.buffer.length() == 0) {
return null;
} else {
- deleteCurrentCharacter();
+ success = deleteCurrentCharacter();
}
break;
@@ -1428,7 +1428,7 @@ public class ConsoleReader
}
}
finally {
- if (!terminal.isSupported()) {
+ if (!getTerminal().isSupported()) {
afterReadLine();
}
}
@@ -1756,7 +1756,7 @@ public class ConsoleReader
* Clear the screen by issuing the ANSI "clear screen" code.
*/
public boolean clearScreen() throws IOException {
- if (!terminal.isAnsiSupported()) {
+ if (!getTerminal().isAnsiSupported()) {
return false;
}
@@ -2109,7 +2109,7 @@ public class ConsoleReader
// return column position, reported by the terminal
private int getCurrentPosition() {
// check for ByteArrayInputStream to disable for unit tests
- if (terminal.isAnsiSupported() && !(in instanceof ByteArrayInputStream)) {
+ if (getTerminal().isAnsiSupported() && !(in instanceof ByteArrayInputStream)) {
try {
printAnsiSequence("6n");
flush();
@@ -2136,7 +2136,7 @@ public class ConsoleReader
// wrapping terminals - not tested for anything else
private int getCurrentAnsiRow() {
// check for ByteArrayInputStream to disable for unit tests
- if (terminal.isAnsiSupported() && !(in instanceof ByteArrayInputStream)) {
+ if (getTerminal().isAnsiSupported() && !(in instanceof ByteArrayInputStream)) {
try {
printAnsiSequence("6n");
flush();
diff --git a/src/jline/src/main/java/scala/tools/jline/console/Key.java b/src/jline/src/main/java/scala/tools/jline/console/Key.java
index 5c13d19860..26528555df 100644
--- a/src/jline/src/main/java/scala/tools/jline/console/Key.java
+++ b/src/jline/src/main/java/scala/tools/jline/console/Key.java
@@ -40,8 +40,14 @@ public enum Key
CTRL_N(14),
+ CTRL_O(15),
+
CTRL_P(16),
+ CTRL_T(20),
+
+ CTRL_W(23),
+
CTRL_OB(27),
CTRL_QM(127),
diff --git a/src/jline/src/main/resources/scala/tools/jline/keybindings.properties b/src/jline/src/main/resources/scala/tools/jline/keybindings.properties
index 610a1626aa..ebb5c8818a 100644
--- a/src/jline/src/main/resources/scala/tools/jline/keybindings.properties
+++ b/src/jline/src/main/resources/scala/tools/jline/keybindings.properties
@@ -51,6 +51,9 @@
# CTRL-R: redraw the current line
18=SEARCH_PREV
+# CTRL-T: move to next word
+20=NEXT_WORD
+
# CTRL-U: delete all the characters before the cursor position
21=KILL_LINE_PREV
diff --git a/src/jline/src/main/resources/scala/tools/jline/macbindings.properties b/src/jline/src/main/resources/scala/tools/jline/macbindings.properties
new file mode 100644
index 0000000000..8e810a8364
--- /dev/null
+++ b/src/jline/src/main/resources/scala/tools/jline/macbindings.properties
@@ -0,0 +1,62 @@
+# Keybinding mapping for JLine. The format is:
+# [key code]: [logical operation]
+
+# CTRL-B: move to the previous character
+2: PREV_CHAR
+
+# CTRL-G: move to the previous word
+7: PREV_WORD
+
+# CTRL-F: move to the next character
+6: NEXT_CHAR
+
+# CTRL-A: move to the beginning of the line
+1: MOVE_TO_BEG
+
+# CTRL-D: close out the input stream
+4: EXIT
+
+# CTRL-E: move the cursor to the end of the line
+5: MOVE_TO_END
+
+# BACKSPACE, CTRL-H: delete the previous character
+# 8 is the ASCII code for backspace and therefor
+# deleting the previous character
+8: DELETE_PREV_CHAR
+
+# TAB, CTRL-I: signal that console completion should be attempted
+9: COMPLETE
+
+# CTRL-J, CTRL-M: newline
+10: NEWLINE
+
+# CTRL-K: erase the current line
+11: KILL_LINE
+
+# ENTER: newline
+13: NEWLINE
+
+# CTRL-L: clear screen
+12: CLEAR_SCREEN
+
+# CTRL-N: scroll to the next element in the history buffer
+14: NEXT_HISTORY
+
+# CTRL-P: scroll to the previous element in the history buffer
+16: PREV_HISTORY
+
+# CTRL-R: redraw the current line
+18: REDISPLAY
+
+# CTRL-U: delete all the characters before the cursor position
+21: KILL_LINE_PREV
+
+# CTRL-V: paste the contents of the clipboard (useful for Windows terminal)
+22: PASTE
+
+# CTRL-W: delete the word directly before the cursor
+23: DELETE_PREV_WORD
+
+# DELETE, CTRL-?: delete the previous character
+# 127 is the ASCII code for delete
+127: DELETE_NEXT_CHAR