Tweaked cursor positioning code, and added explicit no-cache headers to our
responses. This might help with reported IE6 problems. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@81 0da03de8-d603-11dd-86c2-0f8696b7b6f9
This commit is contained in:
parent
e1863d0a47
commit
cdd4ae34eb
5 changed files with 53 additions and 13 deletions
|
@ -1,3 +1,11 @@
|
|||
2009-03-19 Markus Gutschke <markus@shellinabox.com>
|
||||
|
||||
* Fixed cursor positioning. Hopefully, more browsers will be happy
|
||||
with this, now.
|
||||
|
||||
* Explicitly added no-cache headers to our responses. This might help
|
||||
with the IE6 problems.
|
||||
|
||||
2009-03-17 Markus Gutschke <markus@shellinabox.com>
|
||||
|
||||
* Allow root to bind to privileged port.
|
||||
|
|
2
config.h
2
config.h
|
@ -95,7 +95,7 @@
|
|||
#define STDC_HEADERS 1
|
||||
|
||||
/* Most recent revision number in the version control system */
|
||||
#define VCS_REVISION "80"
|
||||
#define VCS_REVISION "81"
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.4"
|
||||
|
|
|
@ -225,6 +225,7 @@ static int completePendingRequest(struct Session *session,
|
|||
"Content-Type: application/json; "
|
||||
"charset=utf-8\r\n"
|
||||
"Content-Length: %ld\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"\r\n"
|
||||
"%s",
|
||||
(long)strlen(json),
|
||||
|
|
|
@ -20,10 +20,15 @@
|
|||
padding: 1px;
|
||||
}
|
||||
|
||||
#vt100 #console, #vt100 #alt_console, #vt100 #cursor {
|
||||
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight {
|
||||
font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, "Andale Mono", "Lucida Console", monospace;
|
||||
}
|
||||
|
||||
#vt100 #lineheight {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#vt100 #cursor {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
|
|
|
@ -234,11 +234,11 @@ VT100.prototype.initializeElements = function(container) {
|
|||
'</div>' +
|
||||
'<div id="menu"></div>' +
|
||||
'<div id="scrollable">' +
|
||||
'<pre id="lineheight"> </pre>' +
|
||||
'<pre id="console"></pre>' +
|
||||
'<pre id="alt_console" style="display: none"></pre>' +
|
||||
'<div id="padding"></div>' +
|
||||
'<pre id="cursor"> </pre>' +
|
||||
'<pre id="lineheight"> </pre>' +
|
||||
'<pre id="cursor">X</pre>' +
|
||||
'</div>' +
|
||||
'<div class="hidden">' +
|
||||
'<input type="textfield" id="input" />' +
|
||||
|
@ -982,28 +982,54 @@ VT100.prototype.putString = function(x, y, text, style) {
|
|||
this.cursorX = 0;
|
||||
}
|
||||
}
|
||||
var pixelX = -1;
|
||||
var pixelY = -1;
|
||||
if (!this.cursor.style.visibility) {
|
||||
var idx = this.cursorX - xPos;
|
||||
if (span) {
|
||||
var nxtIdx = idx - this.getTextContent(span).length;
|
||||
// If we are in a non-empty line, take the cursor Y position from the
|
||||
// other elements in this line. If dealing with broken, non-proportional
|
||||
// fonts, this is likely to yield better results.
|
||||
pixelY = span.offsetTop;
|
||||
|
||||
s = this.getTextContent(span);
|
||||
var nxtIdx = idx - s.length;
|
||||
if (nxtIdx < 0) {
|
||||
this.setTextContent(this.cursor,
|
||||
this.getTextContent(span).charAt(idx));
|
||||
} else if (span.nextSibling) {
|
||||
this.setTextContent(this.cursor,
|
||||
this.getTextContent(span.nextSibling).charAt(nxtIdx));
|
||||
this.setTextContent(this.cursor, s.charAt(idx));
|
||||
pixelX = span.offsetLeft +
|
||||
idx*span.offsetWidth / s.length;
|
||||
} else {
|
||||
this.setTextContent(this.cursor, ' ');
|
||||
if (nxtIdx == 0) {
|
||||
pixelX = span.offsetLeft + span.offsetWidth;
|
||||
}
|
||||
if (span.nextSibling) {
|
||||
s = this.getTextContent(span.nextSibling);
|
||||
this.setTextContent(this.cursor, s.charAt(nxtIdx));
|
||||
if (pixelX < 0) {
|
||||
pixelX = span.nextSibling.offsetLeft +
|
||||
nxtIdx*span.offsetWidth / s.length;
|
||||
}
|
||||
} else {
|
||||
this.setTextContent(this.cursor, ' ');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setTextContent(this.cursor, ' ');
|
||||
}
|
||||
}
|
||||
this.cursor.style.left = this.cursorX*this.cursorWidth +
|
||||
if (pixelX >= 0) {
|
||||
this.cursor.style.left = pixelX + 'px';
|
||||
} else {
|
||||
this.cursor.style.left = this.cursorX*this.cursorWidth +
|
||||
console.offsetLeft + 'px';
|
||||
}
|
||||
this.cursorY = yIdx - this.numScrollbackLines;
|
||||
this.cursor.style.top = yIdx*this.cursorHeight +
|
||||
if (pixelY >= 0) {
|
||||
this.cursor.style.top = pixelY + 'px';
|
||||
} else {
|
||||
this.cursor.style.top = yIdx*this.cursorHeight +
|
||||
console.offsetTop + 'px';
|
||||
}
|
||||
|
||||
if (text.length) {
|
||||
// Merge <span> with previous sibling, if styles are identical
|
||||
|
|
Loading…
Reference in a new issue