mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-22 18:56:00 +02:00
* Some work on cursor hiding while redrawing. WIP.
This commit is contained in:
parent
10d8812300
commit
75bb9e91e4
6 changed files with 48 additions and 9 deletions
16
core/view.js
16
core/view.js
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue