mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-02 07:51:52 +02:00
* Most everything converted to new 'key press' system. Still WIP, some cleanup & probably a few keys to add for various BBS style terminals
This commit is contained in:
parent
dd0568f207
commit
8a17ca694e
13 changed files with 329 additions and 189 deletions
24
core/view.js
24
core/view.js
|
@ -22,7 +22,7 @@ var VIEW_SPECIAL_KEY_MAP_DEFAULT = {
|
|||
home : [ 'home' ],
|
||||
left : [ 'left arrow' ],
|
||||
right : [ 'right arrow' ],
|
||||
clearLine : [ 'end of medium' ],
|
||||
clearLine : [ 'ctrl + y' ],
|
||||
};
|
||||
|
||||
function View(options) {
|
||||
|
@ -177,7 +177,7 @@ View.prototype.setFocus = function(focused) {
|
|||
this.hasFocus = focused;
|
||||
this.restoreCursor();
|
||||
};
|
||||
|
||||
/*
|
||||
View.prototype.onKeyPress = function(key, isSpecial) {
|
||||
assert(this.hasFocus, 'View does not have focus');
|
||||
assert(this.acceptsInput, 'View does not accept input');
|
||||
|
@ -195,6 +195,26 @@ View.prototype.onSpecialKeyPress = function(keyName) {
|
|||
this.emit('action', 'next');
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
View.prototype.onKeyPress = function(ch, key) {
|
||||
assert(this.hasFocus, 'View does not have focus');
|
||||
assert(this.acceptsInput, 'View does not accept input');
|
||||
|
||||
if(key) {
|
||||
assert(this.specialKeyMap, 'No special key map defined');
|
||||
|
||||
if(this.isSpecialKeyMapped('accept', key.name)) {
|
||||
this.emit('action', 'accept');
|
||||
} else if(this.isSpecialKeyMapped('next', key.name)) {
|
||||
this.emit('action', 'next');
|
||||
}
|
||||
}
|
||||
|
||||
if(ch) {
|
||||
assert(1 === ch.length);
|
||||
}
|
||||
};
|
||||
|
||||
View.prototype.getData = function() {
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue