mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-05 17:28:06 +02:00
* Some SyncTERM / EtherTerm key support for new key system
* Break long words for word wrap if required * Lots of cursor movement improvements for MultiLineEditText2 * Code cleanup
This commit is contained in:
parent
f2a61828aa
commit
feab2e0233
6 changed files with 99 additions and 197 deletions
22
core/view.js
22
core/view.js
|
@ -5,6 +5,7 @@ var events = require('events');
|
|||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var ansi = require('./ansi_term.js');
|
||||
|
||||
var _ = require('lodash');
|
||||
|
||||
exports.View = View;
|
||||
|
@ -79,7 +80,7 @@ function View(options) {
|
|||
}
|
||||
|
||||
this.isSpecialKeyMapped = function(keySet, keyName) {
|
||||
return this.specialKeyMap[keySet].indexOf(keyName) > -1;
|
||||
return _.has(this.specialKeyMap, keySet) && this.specialKeyMap[keySet].indexOf(keyName) > -1;
|
||||
};
|
||||
|
||||
this.getANSIColor = function(color) {
|
||||
|
@ -177,25 +178,6 @@ 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');
|
||||
assert(1 === key.length);
|
||||
};
|
||||
|
||||
View.prototype.onSpecialKeyPress = function(keyName) {
|
||||
assert(this.hasFocus, 'View does not have focus');
|
||||
assert(this.acceptsInput, 'View does not accept input');
|
||||
assert(this.specialKeyMap, 'No special key map defined');
|
||||
|
||||
if(this.isSpecialKeyMapped('accept', keyName)) {
|
||||
this.emit('action', 'accept');
|
||||
} else if(this.isSpecialKeyMapped('next', keyName)) {
|
||||
this.emit('action', 'next');
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
View.prototype.onKeyPress = function(ch, key) {
|
||||
assert(this.hasFocus, 'View does not have focus');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue