Selection range and ctrl* fixes

This commit is contained in:
BlackLight 2010-12-26 18:18:21 +01:00
parent 403363ae69
commit bdac1ac43f

View file

@ -214,9 +214,12 @@ function blash ()
} }
} }
} }
return false;
} else if ( key == 76 && evt.ctrlKey ) { } else if ( key == 76 && evt.ctrlKey ) {
// CTRL-l clears the screen // CTRL-l clears the screen
this.refreshPrompt ( true ); this.refreshPrompt ( true );
return false;
} else if ( key == 13 || key == 10 || ( key == 67 && evt.ctrlKey )) { } else if ( key == 13 || key == 10 || ( key == 67 && evt.ctrlKey )) {
if ( this.prompt.value.length != 0 && ( key != 67 || !evt.ctrlKey )) if ( this.prompt.value.length != 0 && ( key != 67 || !evt.ctrlKey ))
{ {
@ -296,7 +299,12 @@ function blash ()
this.prompt.focus(); this.prompt.focus();
} }
} }
} else if ( key == 38 || key == 40 ) {
if ( key == 67 && evt.ctrlKey )
{
return false;
}
} else if (( key == 38 || key == 40 ) && this.history.length > 0 ) {
if ( key == 38 ) if ( key == 38 )
{ {
if ( this.history_index < 0 ) if ( this.history_index < 0 )
@ -321,6 +329,12 @@ function blash ()
} }
} }
// Put the cursor at the end
if ( this.prompt.setSelectionRange )
{
this.prompt.setSelectionRange ( this.prompt.value.length, this.prompt.value.length );
}
this.prompt.focus(); this.prompt.focus();
} else if ( key == 9 ) { } else if ( key == 9 ) {
this.prompt.focus(); this.prompt.focus();