X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FECMA48Terminal.java;h=7416819a3b73ed54f3da1518c1afbd68efcb12ce;hb=c1d8e2b874088d4336bd3ba0a04623176d2039a0;hp=1dc3957d75b534deec2b318a9c2bd501db8d7f5f;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=nikiroo-utils.git diff --git a/src/jexer/backend/ECMA48Terminal.java b/src/jexer/backend/ECMA48Terminal.java index 1dc3957..7416819 100644 --- a/src/jexer/backend/ECMA48Terminal.java +++ b/src/jexer/backend/ECMA48Terminal.java @@ -1085,23 +1085,7 @@ public class ECMA48Terminal extends LogicalScreen windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN, sessionInfo.getWindowWidth(), sessionInfo.getWindowHeight()); - // Permit RGB colors only if externally requested. - if (System.getProperty("jexer.ECMA48.rgbColor") != null) { - if (System.getProperty("jexer.ECMA48.rgbColor").equals("true")) { - doRgbColor = true; - } else { - doRgbColor = false; - } - } - - // Pull the system properties for sixel output. - if (System.getProperty("jexer.ECMA48.sixel") != null) { - if (System.getProperty("jexer.ECMA48.sixel").equals("true")) { - sixel = true; - } else { - sixel = false; - } - } + reloadOptions(); // Spin up the input reader eventQueue = new LinkedList(); @@ -1187,23 +1171,7 @@ public class ECMA48Terminal extends LogicalScreen windowResize = new TResizeEvent(TResizeEvent.Type.SCREEN, sessionInfo.getWindowWidth(), sessionInfo.getWindowHeight()); - // Permit RGB colors only if externally requested - if (System.getProperty("jexer.ECMA48.rgbColor") != null) { - if (System.getProperty("jexer.ECMA48.rgbColor").equals("true")) { - doRgbColor = true; - } else { - doRgbColor = false; - } - } - - // Pull the system properties for sixel output. - if (System.getProperty("jexer.ECMA48.sixel") != null) { - if (System.getProperty("jexer.ECMA48.sixel").equals("true")) { - sixel = true; - } else { - sixel = false; - } - } + reloadOptions(); // Spin up the input reader eventQueue = new LinkedList(); @@ -1357,6 +1325,27 @@ public class ECMA48Terminal extends LogicalScreen this.listener = listener; } + /** + * Reload options from System properties. + */ + public void reloadOptions() { + // Permit RGB colors only if externally requested. + if (System.getProperty("jexer.ECMA48.rgbColor", + "false").equals("true") + ) { + doRgbColor = true; + } else { + doRgbColor = false; + } + + // Pull the system properties for sixel output. + if (System.getProperty("jexer.ECMA48.sixel", "true").equals("true")) { + sixel = true; + } else { + sixel = false; + } + } + // ------------------------------------------------------------------------ // Runnable --------------------------------------------------------------- // ------------------------------------------------------------------------ @@ -2745,11 +2734,19 @@ public class ECMA48Terminal extends LogicalScreen StringBuilder sb = new StringBuilder(); - assert (sixel == true); assert (cells != null); assert (cells.size() > 0); assert (cells.get(0).getImage() != null); + if (sixel == false) { + sb.append(normal()); + sb.append(gotoXY(x, y)); + for (int i = 0; i < cells.size(); i++) { + sb.append(' '); + } + return sb.toString(); + } + if (sixelCache == null) { sixelCache = new SixelCache(height * 10); } @@ -3388,6 +3385,11 @@ public class ECMA48Terminal extends LogicalScreen * * Note that this also sets the alternate/primary screen buffer. * + * Finally, also emit a Privacy Message sequence that Jexer recognizes to + * mean "hide the mouse pointer." We have to use our own sequence to do + * this because there is no standard in xterm for unilaterally hiding the + * pointer all the time (regardless of typing). + * * @param on If true, enable mouse report and use the alternate screen * buffer. If false disable mouse reporting and use the primary screen * buffer. @@ -3395,9 +3397,9 @@ public class ECMA48Terminal extends LogicalScreen */ private String mouse(final boolean on) { if (on) { - return "\033[?1002;1003;1005;1006h\033[?1049h"; + return "\033[?1002;1003;1005;1006h\033[?1049h\033^hideMousePointer\033\\"; } - return "\033[?1002;1003;1006;1005l\033[?1049l"; + return "\033[?1002;1003;1006;1005l\033[?1049l\033^showMousePointer\033\\"; } }