class: EditTextViewCompletionSupport
changed: #handleKeyPress:x:y:
optionally do not intercept cursor keys
(see codeCompletionViewKeyboardNavigationNeedsModifier)
--- a/EditTextViewCompletionSupport.st Sat Jun 14 11:30:03 2014 +0200
+++ b/EditTextViewCompletionSupport.st Sat Jun 14 13:18:07 2014 +0200
@@ -74,7 +74,7 @@
handleKeyPress:key x:x y:y
"return true, if I have eaten this keypress"
- |ch completeImmediate eatCursorLeftOrRight|
+ |ch completeImmediate eatCursorLeftOrRight eatCursorUpDown|
completeImmediate := UserPreferences current immediateCodeCompletion.
@@ -105,29 +105,33 @@
key isCharacter ifFalse:[
"/ forward to menu
(completionView notNil) ifTrue:[
+ "/never
eatCursorLeftOrRight := false.
"/ completeImmediate not
"/ or:[ editView sensor shiftDown
"/ or:[ editView sensor ctrlDown ]].
- (key == #CursorDown
- or:[ (key == #CursorUp)
+ "/ only with shift or ctrl
+ eatCursorUpDown :=
+ (UserPreferences current codeCompletionViewKeyboardNavigationNeedsModifier not)
+ or:[ editView sensor shiftDown
+ or:[editView sensor ctrlDown]].
+
+ ((key == #CursorDown and:[eatCursorUpDown])
+ or:[ (key == #CursorUp and:[eatCursorUpDown])
or:[ ((key == #CursorLeft) and:[eatCursorLeftOrRight])
or:[ ((key == #CursorRight) and:[eatCursorLeftOrRight])
or:[ ((key == #Return) and:[ completionView hasSelection ])
]]]]) ifTrue:[
- "/ only with shift - normal user typing should not interfere with completion
- true "editView sensor shiftDown" ifTrue:[
- "/ forward to completion view
- completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:0 y:0 ].
- ^ true.
- ].
+ "/ forward to completion view
+ completionView sensor pushUserEvent:#value for:[ completionView keyPress:key x:0 y:0 ].
+ ^ true.
].
(key == #Control_L or:[ key == #Control_R or:[ key == #Control or:[ key == #Ctrl ]]]) ifTrue:[
"/ CTRL is a toggle
- self closeCompletionView.
- ^ true.
- "/ ^ false
+"/ self closeCompletionView.
+"/ ^ true.
+ ^ false "/ don't eat
].
(key == #Escape) ifTrue:[
self closeCompletionView.
@@ -312,10 +316,10 @@
!EditTextViewCompletionSupport class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.10 2014-06-14 11:18:07 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.9 2014-05-21 08:10:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.10 2014-06-14 11:18:07 cg Exp $'
! !