From bdac1ac43fc5dd92fa7a1c13891bb49cff4710bc Mon Sep 17 00:00:00 2001 From: BlackLight Date: Sun, 26 Dec 2010 18:18:21 +0100 Subject: [PATCH] Selection range and ctrl* fixes --- blash.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/blash.js b/blash.js index 6416fac..d9345e8 100644 --- a/blash.js +++ b/blash.js @@ -214,9 +214,12 @@ function blash () } } } + + return false; } else if ( key == 76 && evt.ctrlKey ) { // CTRL-l clears the screen this.refreshPrompt ( true ); + return false; } else if ( key == 13 || key == 10 || ( key == 67 && evt.ctrlKey )) { if ( this.prompt.value.length != 0 && ( key != 67 || !evt.ctrlKey )) { @@ -296,7 +299,12 @@ function blash () 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 ( 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(); } else if ( key == 9 ) { this.prompt.focus();