From: Kevin Lamonte Date: Sat, 21 Mar 2015 04:04:32 +0000 (-0400) Subject: run jexer inside jexer X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=3633816889a62bb395ff68f9219dcd26d600c870;p=nikiroo-utils.git run jexer inside jexer --- diff --git a/README.md b/README.md index 1a41908..89e852a 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ ambiguous. This section describes such issues. emulation limitations. + + Roadmap ------- @@ -161,3 +163,6 @@ Screenshots ![Several Windows Open Including A Terminal](/screenshots/screenshot1.png?raw=true "Several Windows Open Including A Terminal") +![Yo Dawg...](/screenshots/yodawg.png?raw=true "Yo Dawg, I heard you + like text windowing systems, so I ran a text windowing system inside your + text windowing system so you can have a terminal in your terminal.") diff --git a/screenshots/yodawg.png b/screenshots/yodawg.png new file mode 100644 index 0000000..a7d3d31 Binary files /dev/null and b/screenshots/yodawg.png differ diff --git a/src/jexer/session/TTYSessionInfo.java b/src/jexer/session/TTYSessionInfo.java index 080e949..4716e26 100644 --- a/src/jexer/session/TTYSessionInfo.java +++ b/src/jexer/session/TTYSessionInfo.java @@ -120,8 +120,14 @@ public final class TTYSessionInfo implements SessionInfo { String line = in.readLine(); if ((line != null) && (line.length() > 0)) { StringTokenizer tokenizer = new StringTokenizer(line); - windowHeight = Integer.parseInt(tokenizer.nextToken()); - windowWidth = Integer.parseInt(tokenizer.nextToken()); + int rc = Integer.parseInt(tokenizer.nextToken()); + if (rc > 0) { + windowHeight = rc; + } + rc = Integer.parseInt(tokenizer.nextToken()); + if (rc > 0) { + windowWidth = rc; + } } while (true) { BufferedReader err = new BufferedReader( diff --git a/src/jexer/tterminal/ECMA48.java b/src/jexer/tterminal/ECMA48.java index 017c3c7..d148b39 100644 --- a/src/jexer/tterminal/ECMA48.java +++ b/src/jexer/tterminal/ECMA48.java @@ -3307,17 +3307,31 @@ public class ECMA48 implements Runnable { * DECSTBM - Set top and bottom margins. */ private void decstbm() { - int top = getCsiParam(0, 1, 1, height) - 1; - int bottom = getCsiParam(1, height, 1, height) - 1; + boolean decPrivateModeFlag = false; - if (top > bottom) { - top = bottom; + for (int i = 0; i < collectBuffer.length(); i++) { + if (collectBuffer.charAt(i) == '?') { + decPrivateModeFlag = true; + break; + } } - scrollRegionTop = top; - scrollRegionBottom = bottom; + if (decPrivateModeFlag) { + // This could be restore DEC private mode values. + // Ignore it. + } else { + // DECSTBM + int top = getCsiParam(0, 1, 1, height) - 1; + int bottom = getCsiParam(1, height, 1, height) - 1; - // Home cursor - cursorPosition(0, 0); + if (top > bottom) { + top = bottom; + } + scrollRegionTop = top; + scrollRegionBottom = bottom; + + // Home cursor + cursorPosition(0, 0); + } } /**