* Some work on cursor hiding while redrawing. WIP.

This commit is contained in:
Bryan Ashby 2015-04-27 20:19:17 -06:00
parent 10d8812300
commit 75bb9e91e4
6 changed files with 48 additions and 9 deletions

View file

@ -18,6 +18,10 @@ var VIEW_SPECIAL_KEY_MAP_DEFAULT = {
next : [ 'tab' ],
up : [ 'up arrow' ],
down : [ 'down arrow' ],
clear : [ 'ctrl-y' ],
end : [ 'end' ],
home : [ 'home' ],
};
function View(options) {
@ -31,6 +35,7 @@ function View(options) {
this.client = options.client;
this.cursor = options.cursor || 'show';
this.cursorStyle = options.cursorStyle || 'default';
this.acceptsFocus = options.acceptsFocus || false;
this.acceptsInput = options.acceptsInput || false;
@ -76,6 +81,15 @@ function View(options) {
}
return ansi.sgr(sgr);
};
this.hideCusor = function() {
self.client.term.write(ansi.hideCursor());
};
this.restoreCursor = function() {
//this.client.term.write(ansi.setCursorStyle(this.cursorStyle));
this.client.term.write('show' === this.cursor ? ansi.showCursor() : ansi.hideCursor());
};
}
util.inherits(View, events.EventEmitter);
@ -162,7 +176,7 @@ View.prototype.setFocus = function(focused) {
assert(this.acceptsFocus, 'View does not accept focus');
this.hasFocus = focused;
this.client.term.write('show' === this.cursor ? ansi.showCursor() : ansi.hideCursor());
this.restoreCursor();
};
View.prototype.onKeyPress = function(key, isSpecial) {