clean up primary loops.

main
sigonasr2, Sig, Sigo 3 years ago
parent 348c5cc051
commit c6d18273a9
  1. 38
      src/sig/SigTerm.java
  2. BIN
      target/classes/sig/SigTerm.class

@ -168,20 +168,8 @@ public class SigTerm{
System.out.println(RESET); System.out.println(RESET);
} }
static void RefreshScreen() { static void HandleInput(NonBlockingReader r) {
CursorLineDown(1);
ScrollUp(1);
}
public static void main(String[] args) {
try { try {
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("Done!");
RunTest();
while (RUNNING) {
int ch = r.peek(250); int ch = r.peek(250);
if (ch!=NonBlockingReader.READ_EXPIRED) { if (ch!=NonBlockingReader.READ_EXPIRED) {
if (!is27&&!is91&&ch==27) { if (!is27&&!is91&&ch==27) {
@ -215,8 +203,32 @@ public class SigTerm{
} }
r.read(); r.read();
} }
} catch (IOException e) {
e.printStackTrace();
}
}
static void Run(NonBlockingReader r) {
while (RUNNING) {
HandleInput(r);
RefreshScreen(); RefreshScreen();
} }
}
static void RefreshScreen() {
CursorLineDown(1);
ScrollUp(1);
}
public static void main(String[] args) {
try {
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("Done!");
//RunTest();
Run(r);
r.shutdown(); r.shutdown();
term.close(); term.close();
} catch (IOException e) { } catch (IOException e) {

Binary file not shown.
Loading…
Cancel
Save