X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Ftterminal%2FECMA48.java;h=69a9da12191dc65fad624177c93935488489c9a6;hb=f6d9020703931f645f553b59426e085a81e90c60;hp=b3cb0ac556aded9743240714e087d738988d638c;hpb=5dfd1c11947e9cb32fcac4772f1b16879d9ffe67;p=fanfix.git diff --git a/src/jexer/tterminal/ECMA48.java b/src/jexer/tterminal/ECMA48.java index b3cb0ac..69a9da1 100644 --- a/src/jexer/tterminal/ECMA48.java +++ b/src/jexer/tterminal/ECMA48.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,6 +28,7 @@ */ package jexer.tterminal; +import java.io.BufferedOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; @@ -51,7 +52,7 @@ import jexer.io.TimeoutInputStream; import static jexer.TKeypress.*; /** - * This implements a complex ANSI ECMA-48/ISO 6429/ANSI X3.64 type consoles, + * This implements a complex ECMA-48/ISO 6429/ANSI X3.64 type console, * including a scrollback buffer. * *

@@ -905,11 +906,12 @@ public class ECMA48 implements Runnable { } if (type == DeviceType.XTERM) { this.input = new InputStreamReader(this.inputStream, "UTF-8"); - this.output = new OutputStreamWriter(outputStream, "UTF-8"); + this.output = new OutputStreamWriter(new + BufferedOutputStream(outputStream), "UTF-8"); this.outputStream = null; } else { this.output = null; - this.outputStream = outputStream; + this.outputStream = new BufferedOutputStream(outputStream); } reset(); @@ -1796,20 +1798,9 @@ public class ECMA48 implements Runnable { if (keypress.equalsWithoutModifiers(kbPgUp)) { switch (type) { case XTERM: - switch (arrowKeyMode) { - case ANSI: - return xtermBuildKeySequence("\033[", '5', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT52: - return xtermBuildKeySequence("\033", '5', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT100: - return xtermBuildKeySequence("\033O", '5', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - } + return xtermBuildKeySequence("\033[", '5', '~', + keypress.isCtrl(), keypress.isAlt(), + keypress.isShift()); default: return "\033[5~"; } @@ -1818,20 +1809,9 @@ public class ECMA48 implements Runnable { if (keypress.equalsWithoutModifiers(kbPgDn)) { switch (type) { case XTERM: - switch (arrowKeyMode) { - case ANSI: - return xtermBuildKeySequence("\033[", '6', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT52: - return xtermBuildKeySequence("\033", '6', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT100: - return xtermBuildKeySequence("\033O", '6', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - } + return xtermBuildKeySequence("\033[", '6', '~', + keypress.isCtrl(), keypress.isAlt(), + keypress.isShift()); default: return "\033[6~"; } @@ -1840,20 +1820,9 @@ public class ECMA48 implements Runnable { if (keypress.equalsWithoutModifiers(kbIns)) { switch (type) { case XTERM: - switch (arrowKeyMode) { - case ANSI: - return xtermBuildKeySequence("\033[", '2', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT52: - return xtermBuildKeySequence("\033", '2', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT100: - return xtermBuildKeySequence("\033O", '2', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - } + return xtermBuildKeySequence("\033[", '2', '~', + keypress.isCtrl(), keypress.isAlt(), + keypress.isShift()); default: return "\033[2~"; } @@ -1862,20 +1831,9 @@ public class ECMA48 implements Runnable { if (keypress.equalsWithoutModifiers(kbDel)) { switch (type) { case XTERM: - switch (arrowKeyMode) { - case ANSI: - return xtermBuildKeySequence("\033[", '3', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT52: - return xtermBuildKeySequence("\033", '3', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - case VT100: - return xtermBuildKeySequence("\033O", '3', '~', - keypress.isCtrl(), keypress.isAlt(), - keypress.isShift()); - } + return xtermBuildKeySequence("\033[", '3', '~', + keypress.isCtrl(), keypress.isAlt(), + keypress.isShift()); default: // Delete sends real delete for VTxxx return "\177";