From 3633816889a62bb395ff68f9219dcd26d600c870 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Sat, 21 Mar 2015 00:04:32 -0400 Subject: [PATCH] run jexer inside jexer --- README.md | 5 +++++ screenshots/yodawg.png | Bin 0 -> 4860 bytes src/jexer/session/TTYSessionInfo.java | 10 +++++++-- src/jexer/tterminal/ECMA48.java | 30 +++++++++++++++++++------- 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 screenshots/yodawg.png diff --git a/README.md b/README.md index 1a419083..89e852a1 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 0000000000000000000000000000000000000000..a7d3d314c6fe5d2c683f38e0775eb39f9f2d1f0d GIT binary patch literal 4860 zcma)Ac_38l`yb_M5h}%%Wx6e-YpE2&v0Pb7aa=o*C1tK`GbYDUL!l&FMbB_@AE$Iv%R0^eNX)F;2DYS`?jM{ zC<%+RrnV^5CK!bhsTSQV{1On%{$1FJVvVhgQK;uB;sURqg!F#zv$j?!RD?1Lbu$)) zS`mJ_`8Ns`atwuHd!kT!nJAPj4z9D&7Y-cy-O}Dn*cJ&NVS_3X2n6;5dm)Yb@d_z> zd%?!WhG|1Yns8j?()lx{;^@KFCLyuqnuV3wma)xyMMXq>5S$tcwOhx+)Yv|Z!6h{W zetIEeKKr&Tq-R7suu$@euIBzt;WuA}M~f6niisqq)#m7IbsG!J{qiL!HBF8F(9-tF zVt~qXwT)I6mqUjmQZMhg^;+ksX(bAA#&olIej$2yiE)U@V&uZH@Ub^z8+zX!ve8JPE#Zbvg+I+x`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h^)Lk8S=@RBfu$Lw2DU;XoYmV zF#u%0BING*5j|v@Poj;dnKifps*Sy!`(1~_^}a&3aDKAAdcA*Nh}l&(*dVNBS*B^l z0>?^%%0Jsz&g?V2Vd=Yp-)s86hL2e87e93Jzh3w;LaQPLX--uvob4|To+TL}xRXljtkr0>6ej1OxElbw}xpws2p z$&BsYU~4aQZ$GfhIGSTBy6yX!N`+(Egy?fj_Xj6!Z2o$4$A#c1#WvwzC6t93Xj*>S HGx~o3ap~D0 literal 0 HcmV?d00001 diff --git a/src/jexer/session/TTYSessionInfo.java b/src/jexer/session/TTYSessionInfo.java index 080e949b..4716e26d 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 017c3c7f..d148b39b 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); + } } /** -- 2.27.0