From eb80afb21dc5e26617ae03eafa94fd603d7531c8 Mon Sep 17 00:00:00 2001 From: Mike Cifelli Date: Sat, 18 Nov 2017 10:50:55 -0500 Subject: [PATCH] Update lanterna version --- pom.xml | 22 +++++++++++----------- src/terminal/LispTerminal.java | 27 ++------------------------- test/terminal/LispTerminalTest.java | 10 ---------- 3 files changed, 13 insertions(+), 46 deletions(-) diff --git a/pom.xml b/pom.xml index 9a6b388..4e15482 100644 --- a/pom.xml +++ b/pom.xml @@ -46,35 +46,35 @@ + + com.googlecode.lanterna + lanterna + 3.0.0 + junit junit 4.12 test + + org.hamcrest + hamcrest-all + 1.3 + test + org.fitnesse fitnesse 20161106 test - - com.googlecode.lanterna - lanterna - 3.0.0-rc1 - com.github.stefanbirkner system-rules 1.16.1 test - - org.hamcrest - hamcrest-all - test - 1.3 - UTF-8 diff --git a/src/terminal/LispTerminal.java b/src/terminal/LispTerminal.java index a86d6cb..771c860 100644 --- a/src/terminal/LispTerminal.java +++ b/src/terminal/LispTerminal.java @@ -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(); diff --git a/test/terminal/LispTerminalTest.java b/test/terminal/LispTerminalTest.java index cf140b0..2892d36 100644 --- a/test/terminal/LispTerminalTest.java +++ b/test/terminal/LispTerminalTest.java @@ -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");