# 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 c4547d9646555ff4fcb9bc2c447afd756da0e334
# Parent da4954e52fd3ec5341a1b86cf9840aaf4f0fc354
EditTextView: 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...
diff -r da4954e52fd3 -r c4547d964655 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 c4547d964655 tests/EditTextViewTests.st
a
|
b
|
|
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 | |