# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1489742033 0
# Fri Mar 17 09:13:53 2017 +0000
# Branch jv
# Node ID ef289d40b266f762c0295507234b78d6c7091408
# Parent da4954e52fd3ec5341a1b86cf9840aaf4f0fc354
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
diff -r da4954e52fd3 -r ef289d40b266 EditTextView.st
a
|
b
|
|
8858 | 8858 | ] |
8859 | 8859 | ! |
8860 | 8860 | |
| 8861 | selectWordAtLine:line col:col |
| 8862 | "select the word at given line/col" |
| 8863 | super selectWordAtLine:line col:col. |
| 8864 | cursorLine := selectionEndLine. |
| 8865 | cursorCol := selectionEndCol + 1. |
| 8866 | |
| 8867 | "Created: / 16-03-2017 / 23:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 8868 | ! |
| 8869 | |
8861 | 8870 | selectWordUnderCursor |
8862 | 8871 | "select the word under the cursor" |
8863 | 8872 | |
diff -r da4954e52fd3 -r ef289d40b266 tests/EditTextViewTests.st
a
|
b
|
|
14 | 14 | setUp |
15 | 15 | | topView | |
16 | 16 | |
17 | | Smalltalk loadPackage: 'stx:goodies/sunitext/ui'. |
| 17 | Smalltalk loadPackage: 'stx:goodies/sunit/ext/ui'. |
18 | 18 | |
19 | 19 | topView := StandardSystemView new. |
20 | 20 | topView extent: 320 @ 200. |
… |
… |
|
49 | 49 | textViewInteractor type: #CtrlShiftCursorRight. |
50 | 50 | textViewInteractor type: #CtrlShiftCursorRight. |
51 | 51 | |
52 | | self assert: textView selectionAsString = 'is Smalltalk'. |
53 | | |
| 52 | self assert: textView selectionAsString = 'is Smalltalk '. |
| 53 | |
54 | 54 | "Created: / 24-02-2015 / 08:21:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
55 | 55 | ! ! |
56 | 56 | |