forked from Botanical/BotanJS
InputEvent carrying range
This commit is contained in:
parent
a7d2e80f4a
commit
9faf2b4921
@ -128,7 +128,7 @@
|
||||
this.__ccur = this.__cfeeder.cursor;
|
||||
};
|
||||
|
||||
Controls.prototype.__comp = function( kCode, handler )
|
||||
Controls.prototype.__comp = function( e, handler )
|
||||
{
|
||||
if( handler )
|
||||
{
|
||||
@ -141,6 +141,8 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
var kCode = e.keyCode;
|
||||
|
||||
for( var i = 0; i < this.__compReg.length; i ++ )
|
||||
{
|
||||
var compReg = this.__compReg[i];
|
||||
@ -150,7 +152,7 @@
|
||||
{
|
||||
if( compReg.i == keys.length )
|
||||
{
|
||||
compReg.handler();
|
||||
compReg.handler( e );
|
||||
this.__compReg = null;
|
||||
this.__cMovement = false;
|
||||
}
|
||||
@ -249,7 +251,7 @@
|
||||
{
|
||||
if( !e.ModKeys )
|
||||
{
|
||||
this.__comp( kCode );
|
||||
this.__comp( e );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -312,23 +314,26 @@
|
||||
|
||||
this.__cMovement = true;
|
||||
// Word boundary
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function( e2 ) {
|
||||
var WordMatch = analyzer.wordAt( ccur.aPos );
|
||||
|
||||
debug.Info( "Word: "
|
||||
+ ccur.feeder.content.substring( WordMatch.open, WordMatch.close + 1 )
|
||||
);
|
||||
|
||||
e2.__range = WordMatch;
|
||||
|
||||
}, W );
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
debug.Info( "Bracket boundary [" );
|
||||
}, S_BRACKET_L );
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
debug.Info( "Bracket boundary ]" );
|
||||
}, S_BRACKET_R );
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
debug.Info( "Bracket boundary {" );
|
||||
}, SHIFT + S_BRACKET_L );
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
debug.Info( "Bracket boundary }" );
|
||||
analyzer.bracketAt( ccur.aPos );
|
||||
}, SHIFT + S_BRACKET_R );
|
||||
@ -336,11 +341,11 @@
|
||||
|
||||
case G: // Go to top
|
||||
this.__cMovement = true;
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
ccur.moveY( -Number.MAX_VALUE );
|
||||
ccur.moveX( -Number.MAX_VALUE, true );
|
||||
}, G );
|
||||
this.__comp( kCode, function(){
|
||||
this.__comp( e, function(){
|
||||
ccur.openRunAction( "PRINT_HEX", e );
|
||||
}, _8 );
|
||||
break;
|
||||
@ -420,6 +425,8 @@
|
||||
|
||||
this.__modKeys = c == KEY_SHIFT || c == KEY_CTRL || c == KEY_ALT;
|
||||
this.__key = e.key;
|
||||
|
||||
this.__range = null;
|
||||
};
|
||||
|
||||
__readOnly( InputEvent.prototype, "target", function() { return this.__target; } );
|
||||
@ -428,6 +435,19 @@
|
||||
__readOnly( InputEvent.prototype, "ModKeys", function() { return this.__modKeys; } );
|
||||
__readOnly( InputEvent.prototype, "Escape", function() { return this.__escape; } );
|
||||
|
||||
__readOnly( InputEvent.prototype, "range", function() {
|
||||
|
||||
/** @type {Components.Vim.Syntax.TokenMatch} */
|
||||
var r = this.__range;
|
||||
|
||||
if( r && r.open == -1 && r.close == -1 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return r;
|
||||
} );
|
||||
|
||||
InputEvent.prototype.kMap = function( map )
|
||||
{
|
||||
return this.__kCode == Map( map );
|
||||
|
@ -262,7 +262,7 @@
|
||||
if( p < Len ) while( word.test( c[ ++ j ] ) );
|
||||
|
||||
var tMatch = new TokenMatch();
|
||||
tMatch.__open = i + 1;
|
||||
tMatch.__open = 0 < i ? i + 1 : 0;
|
||||
tMatch.__close = j - 1;
|
||||
|
||||
return tMatch;
|
||||
|
@ -20,7 +20,7 @@
|
||||
]
|
||||
,
|
||||
[
|
||||
, [ 0x0250, 0x02AF ] // IPA Extensions
|
||||
[ 0x0250, 0x02AF ] // IPA Extensions
|
||||
, [ 0x02B0, 0x02FF ] // Spacing Modifier Letters
|
||||
, [ 0x0300, 0x036F ] // Combining Diacritical Marks
|
||||
, [ 0x0370, 0x03FF ] // Greek and Coptic
|
||||
@ -129,7 +129,7 @@
|
||||
]
|
||||
,
|
||||
[ // CJK scripts and symbols
|
||||
, [ 0x2E80, 0x2EFF ] // CJK Radicals Supplement
|
||||
[ 0x2E80, 0x2EFF ] // CJK Radicals Supplement
|
||||
, [ 0x2F00, 0x2FDF ] // Kangxi Radicals
|
||||
, [ 0x2FF0, 0x2FFF ] // Ideographic Description Characters
|
||||
, [ 0x3000, 0x303F ] // CJK Symbols and Punctuation
|
||||
@ -177,7 +177,7 @@
|
||||
]
|
||||
,
|
||||
[ // Surrogates
|
||||
, [ 0xD800, 0xDBFF ] // High Surrogates
|
||||
[ 0xD800, 0xDBFF ] // High Surrogates
|
||||
, [ 0xDC00, 0xDFFF ] // Low Surrogates
|
||||
, [ 0xE000, 0xF8FF ] // Private Use Area
|
||||
, [ 0xF900, 0xFAFF ] // CJK Compatibility Ideographs
|
||||
@ -197,7 +197,7 @@
|
||||
// Basic Latin
|
||||
[ 0x0021, 0x002F ], [ 0x003A, 0x0040 ], [ 0x005B, 0x0060 ], [ 0x007B, 0x007E ],
|
||||
// C1 Controls and Latin-1 Supplement (Extended ASCII)
|
||||
[ 0x00A1, 0x00AC ], [ 0x00AE, 0x00BF ],
|
||||
[ 0x00A1, 0x00AC ], [ 0x00AE, 0x00BF ]
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -3,6 +3,8 @@ Components.Vim.Controls.InputEvent = function(){};
|
||||
|
||||
/** @type {Components.Vim.VimArea} */
|
||||
Components.Vim.Controls.InputEvent.target;
|
||||
/** @type {Components.Vim.Syntax.TokenMatch} */
|
||||
Components.Vim.Controls.InputEvent.range;
|
||||
/** @type String */
|
||||
Components.Vim.Controls.InputEvent.key;
|
||||
/** @type Boolean */
|
||||
|
Loading…
Reference in New Issue
Block a user