Update lanterna version

This commit is contained in:
Mike Cifelli 2017-11-18 10:50:55 -05:00
parent 1995b23f42
commit eb80afb21d
3 changed files with 13 additions and 46 deletions

22
pom.xml
View File

@ -46,35 +46,35 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.googlecode.lanterna</groupId>
<artifactId>lanterna</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.fitnesse</groupId>
<artifactId>fitnesse</artifactId>
<version>20161106</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.lanterna</groupId>
<artifactId>lanterna</artifactId>
<version>3.0.0-rc1</version>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.16.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
<version>1.3</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -107,7 +107,7 @@ public class LispTerminal {
}
private void processNextKey() {
KeyStroke keyStroke = getKeyStroke();
KeyStroke keyStroke = terminal.pollInput();
if (keyStroke != null)
handleKey(keyStroke);
@ -115,19 +115,6 @@ public class LispTerminal {
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) {
doKey(keyStroke);
terminal.flush();
@ -148,20 +135,10 @@ public class LispTerminal {
}
private synchronized void doControlCharacter(KeyStroke keyStroke) {
if (keyStroke.getCharacter() == 'c')
doControlC();
else if (keyStroke.getCharacter() == 'd')
if (keyStroke.getCharacter() == 'd')
doControlD();
}
private synchronized void doControlC() {
moveCursorToEndOfInput();
terminal.putCharacter('\n');
inputLine = "";
setOriginToCurrentPosition();
stop();
}
private synchronized void doControlD() {
doEnter();
stop();

View File

@ -231,16 +231,6 @@ public class LispTerminalTest {
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
public void controlDWorksInMiddleOfInput() {
terminal.enterCharacters("control-d");