X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Ftterminal%2FECMA48.java;h=c94d7d2b8524f60290496f53e4b97cbe0bdec883;hb=69a8c36844309a07dfe7c8c7576d9c0e47be3303;hp=f2b485eca078e949b75868575b6869a05e01b4c6;hpb=5fc7bf09f3c9987287f34f9035b522b0e5e9de13;p=fanfix.git diff --git a/src/jexer/tterminal/ECMA48.java b/src/jexer/tterminal/ECMA48.java index f2b485e..c94d7d2 100644 --- a/src/jexer/tterminal/ECMA48.java +++ b/src/jexer/tterminal/ECMA48.java @@ -213,7 +213,7 @@ public class ECMA48 implements Runnable { /** * XTERM mouse reporting protocols. */ - private enum MouseProtocol { + public enum MouseProtocol { OFF, X10, NORMAL, @@ -4620,6 +4620,30 @@ public class ECMA48 implements Runnable { } } + /** + * Perform xterm window operations. + */ + private void xtermWindowOps() { + boolean xtermPrivateModeFlag = false; + + for (int i = 0; i < collectBuffer.length(); i++) { + if (collectBuffer.charAt(i) == '?') { + xtermPrivateModeFlag = true; + break; + } + } + + int i = getCsiParam(0, 0); + + if (!xtermPrivateModeFlag) { + if (i == 14) { + // Report xterm window in pixels as CSI 4 ; height ; width t + writeRemote(String.format("\033[4;%d;%dt", textHeight * height, + textWidth * width)); + } + } + } + /** * Run this input character through the ECMA48 state machine. * @@ -5906,6 +5930,10 @@ public class ECMA48 implements Runnable { } break; case 't': + if (type == DeviceType.XTERM) { + // Window operations + xtermWindowOps(); + } break; case 'u': // Restore cursor (ANSI.SYS) @@ -6169,7 +6197,13 @@ public class ECMA48 implements Runnable { decstbm(); break; case 's': + break; case 't': + if (type == DeviceType.XTERM) { + // Window operations + xtermWindowOps(); + } + break; case 'u': case 'v': case 'w': @@ -6643,6 +6677,15 @@ public class ECMA48 implements Runnable { return hideMousePointer; } + /** + * Get the mouse protocol. + * + * @return MouseProtocol.OFF, MouseProtocol.X10, etc. + */ + public MouseProtocol getMouseProtocol() { + return mouseProtocol; + } + // ------------------------------------------------------------------------ // Sixel support ---------------------------------------------------------- // ------------------------------------------------------------------------ @@ -6670,13 +6713,16 @@ public class ECMA48 implements Runnable { * the text cells. */ private void parseSixel() { - System.err.println("parseSixel(): '" + sixelParseBuffer.toString() + - "'"); + + /* + System.err.println("parseSixel(): '" + sixelParseBuffer.toString() + + "'"); + */ Sixel sixel = new Sixel(sixelParseBuffer.toString()); BufferedImage image = sixel.getImage(); - System.err.println("parseSixel(): image " + image); + // System.err.println("parseSixel(): image " + image); if (image == null) { // Sixel data was malformed in some way, bail out.