Fix invalid completion when tab is pressed and completion is *UN*ambiguous
i.e., a complete item can be inserted. Due to a missing return,
text to complete was inserted twice.
--- a/SmallSense__CompletionController.st Tue Jun 02 10:31:11 2020 +0100
+++ b/SmallSense__CompletionController.st Fri Jun 12 22:06:58 2020 +0100
@@ -3,6 +3,7 @@
Copyright (C) 2013-2015 Jan Vrany
Copyright (C) 2014 Claus Gittinger
Copyright (C) 2018 Jan Vrany
+Copyright (C) 2020 LabWare
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -37,6 +38,7 @@
Copyright (C) 2013-2015 Jan Vrany
Copyright (C) 2014 Claus Gittinger
Copyright (C) 2018 Jan Vrany
+Copyright (C) 2020 LabWare
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -155,9 +157,8 @@
handleKeyPressTab
"Tab has been pressed, try to complete longest common prefix"
- | first prefix matching longest minlen |
+ | prefix matching longest minlen |
- first := completionView list first.
prefix := self prefixAlreadyWritten.
matching := OrderedCollection new.
minlen := SmallInteger maxVal.
@@ -172,10 +173,11 @@
].
matching isEmpty ifTrue:[
completionView flash.
- ^self.
+ ^ self.
].
matching size == 1 ifTrue:[
self complete: matching first key.
+ ^ self.
].
longest := String streamContents:[:s |
@@ -204,6 +206,7 @@
"Created: / 31-03-2014 / 22:55:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 18-05-2014 / 13:55:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-06-2020 / 22:05:10 / Jan Vrany <jan.vrany@labware.com>"
!
postKeyPress:key
--- a/SmallSense__MethodPO.st Tue Jun 02 10:31:11 2020 +0100
+++ b/SmallSense__MethodPO.st Fri Jun 12 22:06:58 2020 +0100
@@ -1,6 +1,7 @@
"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2015 Jan Vrany
+Copyright (C) 2020 LabWare
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -33,6 +34,7 @@
"
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
Copyright (C) 2013-2015 Jan Vrany
+Copyright (C) 2020 LabWare
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -72,7 +74,7 @@
stringToComplete := self stringToCompleteForLanguage: language.
language isSmalltalk ifTrue:[
idx := stringToComplete indexOf: $:.
- ^idx == 0 ifTrue:[stringToComplete size] ifFalse:[idx].
+ ^idx == 0 ifTrue:[stringToComplete size + 1] ifFalse:[idx].
].
((language askFor: #isJava) or:[language askFor: #isGroovy]) ifTrue:[
^ (stringToComplete at: stringToComplete size - 1) isSeparator
@@ -84,6 +86,7 @@
"Created: / 03-10-2013 / 16:50:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 07-10-2013 / 12:30:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-06-2020 / 21:50:41 / Jan Vrany <jan.vrany@labware.com>"
!
hint