Update lanterna version
This commit is contained in:
parent
1995b23f42
commit
eb80afb21d
22
pom.xml
22
pom.xml
|
@ -46,35 +46,35 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.lanterna</groupId>
|
||||||
|
<artifactId>lanterna</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>4.12</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-all</artifactId>
|
||||||
|
<version>1.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.fitnesse</groupId>
|
<groupId>org.fitnesse</groupId>
|
||||||
<artifactId>fitnesse</artifactId>
|
<artifactId>fitnesse</artifactId>
|
||||||
<version>20161106</version>
|
<version>20161106</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.googlecode.lanterna</groupId>
|
|
||||||
<artifactId>lanterna</artifactId>
|
|
||||||
<version>3.0.0-rc1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.stefanbirkner</groupId>
|
<groupId>com.github.stefanbirkner</groupId>
|
||||||
<artifactId>system-rules</artifactId>
|
<artifactId>system-rules</artifactId>
|
||||||
<version>1.16.1</version>
|
<version>1.16.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.hamcrest</groupId>
|
|
||||||
<artifactId>hamcrest-all</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
<version>1.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class LispTerminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processNextKey() {
|
private void processNextKey() {
|
||||||
KeyStroke keyStroke = getKeyStroke();
|
KeyStroke keyStroke = terminal.pollInput();
|
||||||
|
|
||||||
if (keyStroke != null)
|
if (keyStroke != null)
|
||||||
handleKey(keyStroke);
|
handleKey(keyStroke);
|
||||||
|
@ -115,19 +115,6 @@ public class LispTerminal {
|
||||||
takeNap();
|
takeNap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyStroke getKeyStroke() {
|
|
||||||
KeyStroke keyStroke = null;
|
|
||||||
|
|
||||||
// issue #299
|
|
||||||
try {
|
|
||||||
keyStroke = terminal.pollInput();
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
doControlC();
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyStroke;
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void handleKey(KeyStroke keyStroke) {
|
private synchronized void handleKey(KeyStroke keyStroke) {
|
||||||
doKey(keyStroke);
|
doKey(keyStroke);
|
||||||
terminal.flush();
|
terminal.flush();
|
||||||
|
@ -148,20 +135,10 @@ public class LispTerminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void doControlCharacter(KeyStroke keyStroke) {
|
private synchronized void doControlCharacter(KeyStroke keyStroke) {
|
||||||
if (keyStroke.getCharacter() == 'c')
|
if (keyStroke.getCharacter() == 'd')
|
||||||
doControlC();
|
|
||||||
else if (keyStroke.getCharacter() == 'd')
|
|
||||||
doControlD();
|
doControlD();
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void doControlC() {
|
|
||||||
moveCursorToEndOfInput();
|
|
||||||
terminal.putCharacter('\n');
|
|
||||||
inputLine = "";
|
|
||||||
setOriginToCurrentPosition();
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void doControlD() {
|
private synchronized void doControlD() {
|
||||||
doEnter();
|
doEnter();
|
||||||
stop();
|
stop();
|
||||||
|
|
|
@ -231,16 +231,6 @@ public class LispTerminalTest {
|
||||||
terminal.assertInputWritten("control-d\n");
|
terminal.assertInputWritten("control-d\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void controlCWorks() {
|
|
||||||
terminal.enterCharacters("ctrl-c");
|
|
||||||
terminal.enterControlCharacter('c');
|
|
||||||
terminal.produceOutput("");
|
|
||||||
terminal.assertInputStreamClosed();
|
|
||||||
terminal.assertInputWritten("");
|
|
||||||
terminal.assertScreenText("ctrl-c ", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void controlDWorksInMiddleOfInput() {
|
public void controlDWorksInMiddleOfInput() {
|
||||||
terminal.enterCharacters("control-d");
|
terminal.enterCharacters("control-d");
|
||||||
|
|
Loading…
Reference in New Issue