The Trunk: Morphic-mt.1061.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1061.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1061.mcz

==================== Summary ====================

Name: Morphic-mt.1061
Author: mt
Time: 22 December 2015, 4:46:35.738 pm
UUID: af0fca47-4c9f-4973-ab53-a9fa9edcccef
Ancestors: Morphic-tpr.1060

Text editing: code clean-up and fix for in-place find. Here is how it works:

- You just moved your cursor to some place without selecting something.
- You type something.
- You hit CMD+G to "find again"
- The previous input will be removed and taken as search text.
- The next match will be selected.
- (If you err here, you can undo with CMD+Z to insert the input from above again.)

If you hit CMD+J, nothing will happen because there was no replace operation detected. If you, however, hit CMD+G to find the next match and then continue wit a CMD+J, it will find/replace the next match (with nothing) because your insertion was removed automatically as described above.

=============== Diff against Morphic-tpr.1060 ===============

Item was changed:
  ----- Method: TextEditor>>again (in category 'menu messages') -----
  again
+ "Do the same find/replace command again. Looks up the editor's own command history and uses the previous command to determine find string and replace string."
- "Do the same replace command again. Unlike #findReplaceAgain, this looks up the editor's own command history and uses the previous command."
 
+ self history hasReplacedSomething
- (self history hasPrevious and: [self history previous hasReplacedSomething])
  ifFalse: [morph flash. ^ false].
 
  self
  setSearchFromSelectionOrHistory;
  setReplacementFromHistory.
 
  "If we have no selection, give the user one to avoid annoying surprises."
  ^ self hasSelection
  ifTrue: [self findReplaceAgainNow]
  ifFalse: [self findAgainNow. false "see #againUpToEnd"]!

Item was changed:
  ----- Method: TextEditor>>findReplaceAgain (in category 'menu messages') -----
  findReplaceAgain
-
- self
- setSearchFromSelectionOrHistory;
- setReplacementFromHistory.
 
+ ^ self again!
- ^ self findReplaceAgainNow!

Item was added:
+ ----- Method: TextEditor>>removePreviousInsertion (in category 'typing support') -----
+ removePreviousInsertion
+ "If the previous command was an insertion, remove it by not undoing it but replacing it with nothing."
+
+ self history hasInsertedSomething ifFalse: [morph flash. ^ false].
+
+ self
+ selectInvisiblyFrom: self history previous intervalBefore first
+ to: self history previous intervalAfter last.
+
+ self replaceSelectionWith: self nullText.
+
+ ^ true
+ !

Item was changed:
  ----- Method: TextEditor>>setReplacementFromHistory (in category 'accessing') -----
  setReplacementFromHistory
  "Use history to get the previous replacement."
 
+ self history hasReplacedSomething
- (self history hasPrevious and: [self history previous hasReplacedSomething])
  ifTrue: [ChangeText := self history previous contentsAfter].!

Item was changed:
  ----- Method: TextEditor>>setSearchFromSelectionOrHistory (in category 'accessing') -----
  setSearchFromSelectionOrHistory
  "Updates the current string to find with the current selection or the last change if it replaced something and thus had a prior selection."
 
  self hasSelection
  ifTrue: [FindText := self selection]
+ ifFalse: [self history hasReplacedSomething
+ ifTrue: [FindText := self history previous contentsBefore]
+ ifFalse: [self history hasInsertedSomething
+ ifTrue: [
+ FindText := self history previous contentsAfter.
+ self removePreviousInsertion. "Undoable."]]]!
- ifFalse: [(self history hasPrevious and: [self history previous hasReplacedSomething])
- ifTrue: [FindText := self history previous contentsBefore]].!

Item was added:
+ ----- Method: TextEditorCommand>>hasInsertedSomething (in category 'testing') -----
+ hasInsertedSomething
+
+ ^ self contentsBefore isEmpty!

Item was added:
+ ----- Method: TextEditorCommandHistory>>hasInsertedSomething (in category 'testing') -----
+ hasInsertedSomething
+
+ ^ self hasPrevious and: [self previous hasInsertedSomething]!

Item was added:
+ ----- Method: TextEditorCommandHistory>>hasReplacedSomething (in category 'testing') -----
+ hasReplacedSomething
+
+ ^ self hasPrevious and: [self previous hasReplacedSomething]!