Skip to content

Commit 1f68e9f

Browse files
committed
better escape handling with tooltips
1 parent 761758e commit 1f68e9f

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cmjs-shell",
3-
"version": "0.2.21",
3+
"version": "0.2.22",
44
"license": "MIT",
55
"description": "Command shell based on CodeMirror.",
66
"keywords": ["shell", "console"],

shell.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,19 @@ var Shell = function( CodeMirror_, opts ){
672672
};
673673

674674
/**
675-
* hide function tip
675+
* hide function tip.
676+
*
677+
* @return true if we consumed the event, or false
676678
*/
677679
this.hide_function_tip = function( user ){
678-
if( !this.function_tip ) return;
680+
if( !this.function_tip ) return false;
679681
if( !user ) this.function_tip.cached_tip = null;
680682
if( this.function_tip.visible ){
681683
this.function_tip.container_node.classList.remove( "visible" );
682684
this.function_tip.visible = false;
685+
return true;
683686
}
687+
return false;
684688
};
685689

686690
/**
@@ -874,8 +878,11 @@ var Shell = function( CodeMirror_, opts ){
874878
Down: function(cm){ shell_history( false );},
875879

876880
Esc: function(cm){
877-
instance.hide_function_tip( true );
878-
opts.function_key_callback( 'esc' );
881+
882+
// don't pass through if we consume it
883+
884+
if( !instance.hide_function_tip( true ))
885+
opts.function_key_callback( 'esc' );
879886
},
880887

881888
F3: function(cm){

0 commit comments

Comments
 (0)