Input handling.

main
sigonasr2, Sig, Sigo 3 years ago
parent 71a4540303
commit 62e8860b43
  1. 17
      src/sig/SigTerm.java
  2. BIN
      target/SigTerm-0.jar
  3. BIN
      target/classes/sig/SigTerm.class
  4. 2
      target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  5. 2
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -1,10 +1,13 @@
package sig; package sig;
import java.io.IOException; import java.io.IOException;
import java.io.Reader;
import org.jline.terminal.Terminal; import org.jline.terminal.Terminal;
import org.jline.utils.NonBlockingReader;
public class SigTerm{ public class SigTerm{
static boolean RUNNING=true;
static String storedVal=""; static String storedVal="";
final static String ESC = "\u001b"; final static String ESC = "\u001b";
final static String CSI = "["; final static String CSI = "[";
@ -159,7 +162,6 @@ public class SigTerm{
Text(DIM+MAGENTA+BLACK_BACKGROUND+"A little purple!"); Text(DIM+MAGENTA+BLACK_BACKGROUND+"A little purple!");
CursorLineDown(2); CursorLineDown(2);
CursorSetPosition(999999,1); CursorSetPosition(999999,1);
GetCursorPosition();
CursorSetPosition(1,8); CursorSetPosition(1,8);
System.out.println(RESET); System.out.println(RESET);
} }
@ -167,9 +169,22 @@ public class SigTerm{
public static void main(String[] args) { public static void main(String[] args) {
try { try {
Terminal term = org.jline.terminal.TerminalBuilder.terminal(); Terminal term = org.jline.terminal.TerminalBuilder.terminal();
term.enterRawMode();
NonBlockingReader r = term.reader();
System.out.println(term.getWidth()+"x"+term.getHeight()+" size detected."); System.out.println(term.getWidth()+"x"+term.getHeight()+" size detected.");
System.out.println("Done!"); System.out.println("Done!");
RunTest(); RunTest();
while (RUNNING) {
int ch = r.peek(250);
if (ch!=NonBlockingReader.READ_EXPIRED) {
Text(Integer.toString(r.read()));
} else {
Text("...");
}
CursorLineDown(1);
ScrollUp(1);
}
r.shutdown();
term.close(); term.close();
} catch (IOException e) { } catch (IOException e) {

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
C:\Users\sigon\Documents\SigTerm\src\sig\SigTerm.java /workspace/SigTerm/src/sig/SigTerm.java

Loading…
Cancel
Save