Skip to content

Commit

Permalink
Activate smart characters even when in completion position
Browse files Browse the repository at this point in the history
+ Tests
  • Loading branch information
guillep committed Mar 4, 2021
1 parent dd0cee6 commit 74ee127
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NECompletion-Morphic/CompletionEngine.class.st
Expand Up @@ -187,8 +187,8 @@ CompletionEngine >> handleKeystrokeBefore: aKeyboardEvent editor: anEditor [
keyCharacter := aKeyboardEvent keyCharacter.
controlKeyPressed := aKeyboardEvent controlKeyPressed.

self editor atCompletionPosition ifFalse: [
^ (self smartInputWithEvent: aKeyboardEvent ) notNil ].
(self smartInputWithEvent: aKeyboardEvent )
ifNotNil: [ ^ true ].

self isMenuOpen
ifFalse: [ ^ self handleKeystrokeWithoutMenu: aKeyboardEvent ].
Expand Down
10 changes: 10 additions & 0 deletions src/NECompletion-Tests/CompletionEngineTest.class.st
Expand Up @@ -243,6 +243,16 @@ CompletionEngineTest >> testSmartBackspaceWithSelection [

]

{ #category : #'tests-keyboard' }
CompletionEngineTest >> testSmartCharacterAfterEspace [
"Test we surround selected text with smart characters properly"
self
setEditorText: 'a b';
selectFrom: 2 to: 4.
editor keystroke: (self keyboardPressFor: $").
self assert: editor text equals: 'a" b"'.
]
{ #category : #'tests-keyboard' }
CompletionEngineTest >> testSmartCharacterPairForIfAbsent [
Expand Down

0 comments on commit 74ee127

Please sign in to comment.