Issue #124, case 0: Fixed long standing bug with inconsistent cursor position after select-word jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 17 Mar 2017 09:13:53 +0000
branchjv
changeset 6153 ef289d40b266
parent 6133 da4954e52fd3
child 6187 df5e0e50fe4e
Issue #124, case 0: Fixed long standing bug with inconsistent cursor position after select-word If there's a selection, cursor position (`cursorLine` / `cursorCol` instvars) are required to be same as either selection start or selection end. #selectWordAtLine:col: did not update cursor position accordingly, leading to assertion failure. This bug has been there for a loong time. My bad, I was too lazy to fix it, until today... https://swing.fit.cvut.cz/projects/stx-jv/ticket/124
EditTextView.st
tests/EditTextViewTests.st
--- a/EditTextView.st	Mon Mar 13 14:51:58 2017 +0000
+++ b/EditTextView.st	Fri Mar 17 09:13:53 2017 +0000
@@ -8858,6 +8858,15 @@
     ]
 !
 
+selectWordAtLine:line col:col
+    "select the word at given line/col"
+    super selectWordAtLine:line col:col.
+    cursorLine := selectionEndLine.
+    cursorCol := selectionEndCol + 1.
+
+    "Created: / 16-03-2017 / 23:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 selectWordUnderCursor
     "select the word under the cursor"
 
--- a/tests/EditTextViewTests.st	Mon Mar 13 14:51:58 2017 +0000
+++ b/tests/EditTextViewTests.st	Fri Mar 17 09:13:53 2017 +0000
@@ -14,7 +14,7 @@
 setUp
     | topView |
 
-    Smalltalk loadPackage: 'stx:goodies/sunitext/ui'.
+    Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'.
 
     topView := StandardSystemView new.
     topView extent: 320 @ 200.
@@ -49,8 +49,8 @@
     textViewInteractor type: #CtrlShiftCursorRight.
     textViewInteractor type: #CtrlShiftCursorRight.
 
-    self assert: textView selectionAsString = 'is Smalltalk'.
-
+    self assert: textView selectionAsString = 'is Smalltalk '.
+ 
     "Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !