git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix javadoc
[fanfix.git]
/
src
/
jexer
/
net
/
TelnetInputStream.java
diff --git
a/src/jexer/net/TelnetInputStream.java
b/src/jexer/net/TelnetInputStream.java
index 056a7dc8e4e10ad2a4d8981f6c1668e1e0422c80..3e74561a40c20e6ea9b166dea9de4d2e24e00f1c 100644
(file)
--- a/
src/jexer/net/TelnetInputStream.java
+++ b/
src/jexer/net/TelnetInputStream.java
@@
-199,6
+199,15
@@
public class TelnetInputStream extends InputStream implements SessionInfo {
this.language = language;
}
this.language = language;
}
+ /**
+ * Get the terminal type as reported by the telnet Terminal Type option.
+ *
+ * @return the terminal type
+ */
+ public String getTerminalType() {
+ return master.terminalType;
+ }
+
/**
* Text window width getter.
*
/**
* Text window width getter.
*
@@
-311,6
+320,7
@@
public class TelnetInputStream extends InputStream implements SessionInfo {
// If we got something, return it.
if (rc > 0) {
// If we got something, return it.
if (rc > 0) {
+ readBufferEnd += rc;
readBufferStart++;
return readBuffer[readBufferStart - 1];
}
readBufferStart++;
return readBuffer[readBufferStart - 1];
}
@@
-926,25
+936,41
@@
public class TelnetInputStream extends InputStream implements SessionInfo {
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
- windowWidth = subnegBuffer.get(i) * 256;
+ int width = subnegBuffer.get(i);
+ if (width < 0) {
+ width += 256;
+ }
+ windowWidth = width * 256;
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
- windowWidth += subnegBuffer.get(i);
+ width = subnegBuffer.get(i);
+ windowWidth += width;
+ if (width < 0) {
+ windowWidth += 256;
+ }
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
- windowHeight = subnegBuffer.get(i) * 256;
+ int height = subnegBuffer.get(i);
+ if (height < 0) {
+ height += 256;
+ }
+ windowHeight = height * 256;
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
i++;
if (subnegBuffer.get(i) == (byte)TELNET_IAC) {
i++;
}
- windowHeight += subnegBuffer.get(i);
+ height = subnegBuffer.get(i);
+ windowHeight += height;
+ if (height < 0) {
+ windowHeight += 256;
+ }
}
break;
}
break;