[squeak-dev] The Trunk: Morphic-nice.560.mcz
leves at elte.hu
Thu Aug 4 00:30:02 UTC 2011
Wow, great improvements.
On Wed, 3 Aug 2011, commits at source.squeak.org wrote:
> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
> ==================== Summary ====================
> Name: Morphic-nice.560
> Author: nice
> Time: 4 August 2011, 12:13:33.583 am
> UUID: f816651e-2c1a-402f-b4be-d7fc194061a0
> Ancestors: Morphic-nice.559
> Correct forwardDelete: that I just broke.
> Note that (cmd+z) fail to undo this action. I think it was previously the case before I changed anything.
I think it would be better to leech the undo framework from Pharo. Having
"infinite" undo/redo is better than just a single (and sometimes broken)
undo/redo which is (guess what) global...
> =============== Diff against Morphic-nice.559 ===============
> Item was changed:
> ----- Method: TextEditor>>forwardDelete: (in category 'typing/selecting keys') -----
> forwardDelete: aKeyboardEvent
> "Delete forward over the next character.
> Make Undo work on the whole type-in, not just the one char.
> wod 11/3/1998: If there was a selection use #zapSelectionWith: rather than #backspace: which was 'one off' in deleting the selection. Handling of things like undo or typeIn area were not fully considered."
> | startIndex usel upara uinterval ind stopIndex |
> startIndex := self markIndex.
> startIndex > self text size ifTrue: [
> ^ false].
> self hasSelection ifTrue: [
> "there was a selection"
> self zapSelectionWith: self nullText.
> ^ false].
> "Null selection - do the delete forward"
> beginTypeInIndex ifNil: [ "no previous typing. openTypeIn"
> self openTypeIn. UndoSelection := self nullText].
> uinterval := UndoInterval copy.
> upara := UndoParagraph copy.
> stopIndex := startIndex.
> (aKeyboardEvent keyValue = 127 and: [ aKeyboardEvent shiftPressed ])
> + ifTrue: [stopIndex := (self nextWord: stopIndex) - 1].
> - ifTrue: [stopIndex := (self nextWordStart: stopIndex) - 1].
> self selectFrom: startIndex to: stopIndex.
> self replaceSelectionWith: self nullText.
> self selectFrom: startIndex to: startIndex-1.
> UndoParagraph := upara. UndoInterval := uinterval.
> UndoMessage selector == #noUndoer ifTrue: [
> (UndoSelection isText) ifTrue: [
> usel := UndoSelection.
> ind := startIndex. "UndoInterval startIndex"
> usel replaceFrom: usel size + 1 to: usel size with:
> (UndoParagraph text copyFrom: ind to: ind).
> UndoParagraph text replaceFrom: ind to: ind with: self nullText]].
More information about the Squeak-dev