hterm 1.24: Fix cursor height regression.
* Fix cursor sizing regression. syncCursorPosition_ is now only about the
position of the cursor, restyleCursor_ now sets cursor width, in addition to
height and cursor shape related stuff. Call restyleCursor_ from onResize_.
Change-Id: I4631aa4bea8a01acde59f8d51861dd212bea84ae
Reviewed-on: https://chromium-review.googlesource.com/179631
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Tested-by: Robert Ginda <rginda@chromium.org>
diff --git a/hterm/doc/changelog.txt b/hterm/doc/changelog.txt
index 5f99872..ba1cd7a 100644
--- a/hterm/doc/changelog.txt
+++ b/hterm/doc/changelog.txt
@@ -1,3 +1,9 @@
+1.24, 2013-12-10, Fix cursor height regression.
+
+* Fix cursor sizing regression. syncCursorPosition_ is now only about the
+ position of the cursor, restyleCursor_ now sets cursor width, in addition to
+ height and cursor shape related stuff. Call restyleCursor_ from onResize_.
+
1.23, 2013-11-25, Prevent overlay focus, fix timeout tracking.
* Prevent the terminal overlay (hterm.Terminal.prototype.showOverlay) from
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js
index 5cda73d..14f59b2 100644
--- a/hterm/js/hterm_terminal.js
+++ b/hterm/js/hterm_terminal.js
@@ -669,7 +669,7 @@
*/
hterm.Terminal.prototype.setCursorShape = function(shape) {
this.cursorShape_ = shape;
- this.restyleCursor_(shape);
+ this.restyleCursor_();
}
/**
@@ -1087,7 +1087,10 @@
'width: ' + this.scrollPort_.characterSize.width + 'px;' +
'height: ' + this.scrollPort_.characterSize.height + 'px;' +
'-webkit-transition: opacity, background-color 100ms linear;');
+
this.setCursorColor(this.prefs_.get('cursor-color'));
+ this.setCursorBlink(!!this.prefs_.get('cursor-blink'));
+ this.restyleCursor_();
this.document_.body.appendChild(this.cursorNode_);
@@ -1120,7 +1123,6 @@
setTimeout(this.focus.bind(this));
}.bind(this));
- this.setCursorBlink(!!this.prefs_.get('cursor-blink'));
this.setReverseVideo(false);
this.scrollPort_.focus();
@@ -2179,8 +2181,6 @@
return;
}
- this.cursorNode_.style.width = this.scrollPort_.characterSize.width + 'px';
-
this.cursorNode_.style.top = this.scrollPort_.visibleRowTopMargin +
this.scrollPort_.characterSize.height * (cursorRowIndex - topRowIndex) +
'px';
@@ -2198,6 +2198,10 @@
this.screen_.syncSelectionCaret(selection);
};
+/**
+ * Adjusts the style of this.cursorNode_ according to the current cursor shape
+ * and character cell dimensions.
+ */
hterm.Terminal.prototype.restyleCursor_ = function() {
var shape = this.cursorShape_;
@@ -2208,6 +2212,8 @@
var style = this.cursorNode_.style;
+ style.width = this.scrollPort_.characterSize.width + 'px';
+
switch (shape) {
case hterm.Terminal.cursorShape.BEAM:
style.height = this.scrollPort_.characterSize.height + 'px';
@@ -2618,6 +2624,7 @@
if (isNewSize)
this.overlaySize();
+ this.restyleCursor_();
this.scheduleSyncCursorPosition_();
};