Skip to content

Commit 4dcf6c0

Browse files
authored
Merge branch 'Pharo13' into helping-to-test-refactorings
2 parents 9460d5b + 3d8dbe4 commit 4dcf6c0

File tree

4 files changed

+42
-6
lines changed

4 files changed

+42
-6
lines changed

src/NECompletion/CompletionSorter.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CompletionSorter class >> kind [
2121

2222
{ #category : 'tools registry' }
2323
CompletionSorter class >> register [
24-
CompletionContext sorterClass: SizeSorter
24+
CompletionContext sorterClass: NoSorter
2525
]
2626

2727
{ #category : 'accessing' }

src/Rubric-Tests/RubTextEditorLocalHistoryTest.class.st

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,46 @@ RubTextEditorLocalHistoryTest >> testRedoLeavesCursorInOriginalPosition [
6060
self assert: editor selectionInterval equals: (5 to: 4)
6161
]
6262

63+
{ #category : 'tests - undo' }
64+
RubTextEditorLocalHistoryTest >> testUndoAfterFormatShouldRestoreOriginalCode [
65+
66+
editor textArea beForSmalltalkCode.
67+
68+
"Insert the start of the text and commit the transaction"
69+
editor addString: 'method (to be formatted; but) maybe not nice'.
70+
editor closeTypeIn.
71+
72+
"let's replace the to be formatted by a shorter sequence.
73+
Do not commit the transaction here, simulating a text edition by a user.
74+
When the transaction is committed, two entries will get created:
75+
- an entry with the removal of the selection
76+
- an entry with the addition of the new text in that place"
77+
editor selectFrom: 'method (to ' size + 1 to: 'method (to be formatted' size.
78+
editor addString: 'format'.
79+
80+
"Unselect and format. This should not break the undo buffer"
81+
editor unselect.
82+
editor textArea formatMethodCode.
83+
84+
self expectText: 'method
85+
86+
(to
87+
format;
88+
but) maybe not nice'.
89+
90+
"Undo the format"
91+
editor undo.
92+
self expectText: 'method (to format; but) maybe not nice'.
93+
94+
"Undo the addition of new text"
95+
editor undo.
96+
self expectText: 'method (to ; but) maybe not nice'.
97+
98+
"Undo the removal"
99+
editor undo.
100+
self expectText: 'method (to be formatted; but) maybe not nice'
101+
]
102+
63103
{ #category : 'tests - undo' }
64104
RubTextEditorLocalHistoryTest >> testUndoAfterTypeThenTabUndoesOnlyTheTab [
65105

src/Rubric/RubSmalltalkCodeMode.class.st

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ RubSmalltalkCodeMode >> classOrMetaClass: aBehavior [
164164
RubSmalltalkCodeMode >> formatMethodCode [
165165

166166
| source tree formatted |
167+
self editor closeTypeIn.
167168
self textArea hasSelection
168169
ifTrue: [
169170
source := self textArea selection.

src/Rubric/RubSmalltalkEditor.class.st

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,6 @@ RubSmalltalkEditor >> findValidKeywordIn: sourceCode at: locationIndex ifFound:
717717
validLocation ifTrue: aBlock
718718
]
719719

720-
{ #category : 'do-its' }
721-
RubSmalltalkEditor >> format [
722-
self model formatSourceCodeInView
723-
]
724-
725720
{ #category : 'do-its' }
726721
RubSmalltalkEditor >> highlightEvaluateAndDo: aBlock [
727722
"Treat the current selection as an expression; evaluate it and invoke aBlock with the result."

0 commit comments

Comments
 (0)