|
@@ -121,9 +121,22 @@ class TextInput extends Text {
|
|
|
var oldText = text;
|
|
|
|
|
|
switch( e.keyCode ) {
|
|
|
+ case K.LEFT if (K.isDown(K.CTRL)):
|
|
|
+ if (cursorIndex > 0) {
|
|
|
+ var charset = hxd.Charset.getDefault();
|
|
|
+ while (cursorIndex > 0 && charset.isSpace(StringTools.fastCodeAt(text, cursorIndex - 1))) cursorIndex--;
|
|
|
+ while (cursorIndex > 0 && !charset.isSpace(StringTools.fastCodeAt(text, cursorIndex - 1))) cursorIndex--;
|
|
|
+ }
|
|
|
case K.LEFT:
|
|
|
if( cursorIndex > 0 )
|
|
|
cursorIndex--;
|
|
|
+ case K.RIGHT if (K.isDown(K.CTRL)):
|
|
|
+ var len = text.length;
|
|
|
+ if (cursorIndex < text.length) {
|
|
|
+ var charset = hxd.Charset.getDefault();
|
|
|
+ while (cursorIndex < len && charset.isSpace(StringTools.fastCodeAt(text, cursorIndex))) cursorIndex++;
|
|
|
+ while (cursorIndex < len && !charset.isSpace(StringTools.fastCodeAt(text, cursorIndex))) cursorIndex++;
|
|
|
+ }
|
|
|
case K.RIGHT:
|
|
|
if( cursorIndex < text.length )
|
|
|
cursorIndex++;
|
|
@@ -149,7 +162,7 @@ class TextInput extends Text {
|
|
|
text = text.substr(0, cursorIndex) + text.substr(cursorIndex + 1);
|
|
|
onChange();
|
|
|
}
|
|
|
- case K.ENTER, K.NUMPAD_ENTER:
|
|
|
+ case K.ESCAPE, K.ENTER, K.NUMPAD_ENTER:
|
|
|
cursorIndex = -1;
|
|
|
interactive.blur();
|
|
|
return;
|
|
@@ -165,6 +178,13 @@ class TextInput extends Text {
|
|
|
setState(redo.pop());
|
|
|
}
|
|
|
return;
|
|
|
+ case K.A if (K.isDown(K.CTRL)):
|
|
|
+ if (text != "") {
|
|
|
+ cursorIndex = text.length;
|
|
|
+ selectionRange = {start: 0, length: text.length};
|
|
|
+ selectionSize = 0;
|
|
|
+ }
|
|
|
+ return;
|
|
|
default:
|
|
|
if( e.kind == EKeyDown )
|
|
|
return;
|