The Trunk: Morphic-cmm.1042.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-cmm.1042.mcz

commits-2
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1042.mcz

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

Name: Morphic-cmm.1042
Author: cmm
Time: 16 November 2015, 8:55:48.944 pm
UUID: 7a820a29-86bd-4923-a05f-f2f41045adfc
Ancestors: Morphic-mt.1041

- When selecting expressions, if the click occurs between two adjacent delimiters, give precedence to directional bracket delimiters over the non-directional punctuation delimiters, so that the correct expression will be selected.
- In code panes, when advancing the cursor via Command+Shift+[left-arrow] and Command+Shift+[right-arrow], stop also at Smalltalk expression boundaries so that selection of expressions via those hot keys is feasible.
- A further refinement to the in-place search-and-replace to present the suggested change to the user before changing it.
- Don't let drag and drop mess with the z-order of SystemWindows.

=============== Diff against Morphic-mt.1041 ===============

Item was changed:
  ----- Method: Editor>>selectWord (in category 'new selection') -----
  selectWord
+ "Select a word or expression, the result of pressing Command+[Space Bar] or by double-clicking."
- "Select delimited text or word--the result of double-clicking."
-
  ^self
+ selectWordLeftDelimiters: '
+ "''|([{<'   "<--- punctuation symbols should precede the bracket symbols"
+ rightDelimiters: '
+ "''|)]}>'!
- selectWordLeftDelimiters: '([{<|''"
- '
- rightDelimiters: ')]}>|''"
- '!

Item was changed:
  ----- Method: Editor>>selectWordLeftDelimiters:rightDelimiters: (in category 'new selection') -----
  selectWordLeftDelimiters: leftDelimiters rightDelimiters: rightDelimiters
  "Select delimited text or word--the result of double-clicking."
 
  | openDelimiter closeDelimiter direction match level
  string here hereChar start stop |
  string := self string.
  string size < 2 ifTrue: [^self].
  here := self pointIndex.
  "Select the whole text when clicking before first or after last character"
  (here > string size or: [here < 2]) ifTrue: [^self selectFrom: 1 to: string size].
  openDelimiter := string at: here - 1.
+ closeDelimiter := string at: here.
+ (match := leftDelimiters indexOf: openDelimiter) > (rightDelimiters indexOf: closeDelimiter)
- match := leftDelimiters indexOf: openDelimiter.
- match > 0
  ifTrue: [
+ "a more-distinct delimiter is on the left -- match to the right"
- "delimiter is on left -- match to the right"
  start := here.
  direction := 1.
  here := here - 1.
  closeDelimiter := rightDelimiters at: match]
  ifFalse: [
  openDelimiter := string at: here.
  match := rightDelimiters indexOf: openDelimiter.
  match > 0
  ifTrue: [
  "delimiter is on right -- match to the left"
  stop := here - 1.
  direction := -1.
  closeDelimiter := leftDelimiters at: match]
  ifFalse: [
  "no delimiters -- select a token"
  direction := -1]].
  level := 1.
  [level > 0 and: [direction > 0
  ifTrue: [here < string size]
  ifFalse: [here > 1]]]
  whileTrue: [
  hereChar := string at: (here := here + direction).
  match = 0
  ifTrue: ["token scan goes left, then right"
  hereChar tokenish
  ifTrue: [here = 1
  ifTrue: [
  start := 1.
  "go right if hit string start"
  direction := 1]]
  ifFalse: [
  direction < 0
  ifTrue: [
  start := here + 1.
  "go right if hit non-token"
  direction := 1]
  ifFalse: [level := 0]]]
  ifFalse: ["bracket match just counts nesting level"
  hereChar = closeDelimiter
  ifTrue: [level := level - 1"leaving nest"]
  ifFalse: [hereChar = openDelimiter
  ifTrue: [level := level + 1"entering deeper nest"]]]].
 
  level > 0 ifTrue: ["in case ran off string end" here := here + direction].
  ^direction > 0
  ifTrue: [self selectFrom: start to: here - 1]
  ifFalse: [self selectFrom: here + 1 to: stop]!

Item was changed:
  ----- Method: Morph>>justDroppedInto:event: (in category 'dropping/grabbing') -----
  justDroppedInto: aMorph event: anEvent
  "This message is sent to a dropped morph after it has been dropped on -- and been accepted by -- a drop-sensitive morph"
 
+ | partsBinCase cmd |
- | aWindow partsBinCase cmd |
  (self formerOwner notNil and: [self formerOwner ~~ aMorph])
  ifTrue: [self removeHalo].
  self formerOwner: nil.
  self formerPosition: nil.
  cmd := self valueOfProperty: #undoGrabCommand.
  cmd ifNotNil:[aMorph rememberCommand: cmd.
  self removeProperty: #undoGrabCommand].
  (partsBinCase := aMorph isPartsBin) ifFalse:
  [self isPartsDonor: false].
- (aWindow := aMorph ownerThatIsA: SystemWindow) ifNotNil:
- [aWindow isActive ifFalse:
- [aWindow activate]].
  (self isInWorld and: [partsBinCase not]) ifTrue:
  [self world startSteppingSubmorphsOf: self].
  "Note an unhappy inefficiency here:  the startStepping... call will often have already been called in the sequence leading up to entry to this method, but unfortunately the isPartsDonor: call often will not have already happened, with the result that the startStepping... call will not have resulted in the startage of the steppage."
 
  "An object launched by certain parts-launcher mechanisms should end up fully visible..."
  (self hasProperty: #beFullyVisibleAfterDrop) ifTrue:
  [aMorph == ActiveWorld ifTrue:
  [self goHome].
  self removeProperty: #beFullyVisibleAfterDrop].
  !

Item was added:
+ ----- Method: SmalltalkEditor>>nextWord: (in category 'private') -----
+ nextWord: position
+ | string index boundaryCharacters |
+ string := self string.
+ index := position - 1.
+ [ (index
+ between: 1
+ and: string size) and: [ (string at: index) isSeparator ] ] whileTrue: [ index := index + 1 ].
+ boundaryCharacters := ')]}''"|^. '.
+ ((index
+ between: 1
+ and: string size) and: [ boundaryCharacters includes: (string at: index) ])
+ ifTrue:
+ [  index := index + 1  ]
+ ifFalse:
+ [ [ (index
+ between: 1
+ and: string size) and: [ (boundaryCharacters includes: (string at: index)) not ] ] whileTrue: [ index := index + 1 ] ].
+ ^ index!

Item was added:
+ ----- Method: SmalltalkEditor>>previousWord: (in category 'private') -----
+ previousWord: position
+ | string index boundaryCharacters |
+ string := self string.
+ index := position.
+ "First, get out of whitespace."
+ [ (index
+ between: 2
+ and: string size) and: [ (string at: index) isSeparator ] ] whileTrue: [ index := index - 1 ].
+ boundaryCharacters := '([{''"|^. '.
+ "Are we at a boundary character?"
+ ((index
+ between: 2
+ and: string size) and: [ boundaryCharacters includes: (string at: index) ])
+ ifTrue:
+ [ "yes, select it and any following whitespace of this line."
+ index := index - 1 ]
+ ifFalse:
+ [ "no, select to the next boundary character"
+ [ (index
+ between: 1
+ and: string size) and: [ (boundaryCharacters includes: (string at: index)) not ] ] whileTrue: [ index := index - 1 ] ].
+ ^ index + 1!

Item was changed:
  ----- Method: TextEditor>>again (in category 'menu messages') -----
  again
  "Do the same replace command again. Unlike #findReplaceAgain, this looks up the editor's own command history and uses the previous command."
 
  self history hasPrevious ifFalse: [morph flash. ^ self].
 
  self history previous hasReplacedSomething
  ifFalse: [morph flash. ^ self]
+ ifTrue: [ | nextOperation |
+ nextOperation := (self selection=ChangeText) ifTrue: [#findAgain] ifFalse: [#findReplaceAgain].
- ifTrue: [
  "Reset shared find/replace state."
  FindText := self history previous contentsBefore.
  ChangeText := self history previous contentsAfter.
 
  self selectAt: self stopIndex.
+ self perform: nextOperation.
+ nextOperation = #findReplaceAgain ifTrue: [ self findAgainSettingSearch: false ] ].!
- self findReplaceAgain].!

Item was changed:
  ----- Method: TextEditor>>doAgainUpToEnd: (in category 'typing/selecting keys') -----
  doAgainUpToEnd: aKeyboardEvent
+ "Do the previous thing again repeatedly to the end of my contents.  Under circumstances this can require two calls to againUpToEnd "
+ self
+ insertAndCloseTypeIn ;
+ againUpToEnd ;
+ againUpToEnd.
- "Do the previous thing again once. 1/26/96 sw"
-
- self insertAndCloseTypeIn.
- self againUpToEnd.
  ^ true!

Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'Editor initialize.'!
- (PackageInfo named: 'Morphic') postscript: 'Editor initialize.
- MenuIcons initializeTranslations.
- TextMorph allSubInstancesDo: [:tm | tm releaseEditor].
- Preferences removePreference: #multipleTextUndo.
- '!