The Trunk: Morphic-cmm.1040.mcz

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

The Trunk: Morphic-cmm.1040.mcz

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

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

Name: Morphic-cmm.1040
Author: cmm
Time: 15 November 2015, 11:06:42.328 pm
UUID: 912689c9-ab7b-461d-92b3-177f671fde54
Ancestors: Morphic-tpr.1039

- Consolidate Command+hg into, more-simply, Command+g, recovering the lowercase "h" hot-key for future use.  Hot keys have become a valuable commodity.
- Fix the in-place search-and-replace function.  Command+g and j now function together, harmoniously, for the user.

=============== Diff against Morphic-tpr.1039 ===============

Item was changed:
  ----- Method: TextEditor class>>initializeCmdKeyShortcuts (in category 'keyboard shortcut tables') -----
  initializeCmdKeyShortcuts
  "Initialize the (unshifted) command-key (or alt-key) shortcut table."
 
  "NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
 
  "TextEditor initialize"
 
  | cmdMap cmds |
  cmdMap := Array new: 256 withAll: #noop:. "use temp in case of a crash"
  cmdMap at: 1 + 1 put: #cursorHome:. "home key"
  cmdMap at: 4 + 1 put: #cursorEnd:. "end key"
  cmdMap at: 8 + 1 put: #backspace:. "ctrl-H or delete key"
  cmdMap at: 11 + 1 put: #cursorPageUp:. "page up key"
  cmdMap at: 12 + 1 put: #cursorPageDown:. "page down key"
  cmdMap at: 13 + 1 put: #crWithIndent:. "cmd-Return"
  cmdMap at: 27 + 1 put: #offerMenuFromEsc:. "escape key"
  cmdMap at: 28 + 1 put: #cursorLeft:. "left arrow key"
  cmdMap at: 29 + 1 put: #cursorRight:. "right arrow key"
  cmdMap at: 30 + 1 put: #cursorUp:. "up arrow key"
  cmdMap at: 31 + 1 put: #cursorDown:. "down arrow key"
  cmdMap at: 32 + 1 put: #selectWord:. "space bar key"
  cmdMap at: 127 + 1 put: #forwardDelete:. "del key"
 
  '0123456789-='
  do: [:char | cmdMap at: char asciiValue + 1 put: #changeEmphasis:].
 
  '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
 
+ cmds := #($a #selectAll: $c #copySelection: $e #exchange: $f #find: $g #findAgain: $j #doAgain: $k #offerFontMenu: $u #align: $v #paste: $w #backWord: $x #cut: $y #swapChars: $z #undo:).
- cmds := #($a #selectAll: $c #copySelection: $e #exchange: $f #find: $g #findAgain: $h #setSearchString: $j #doAgain: $k #offerFontMenu: $u #align: $v #paste: $w #backWord: $x #cut: $y #swapChars: $z #undo:).
  1 to: cmds size
  by: 2
  do: [:i | cmdMap at: (cmds at: i) asciiValue + 1 put: (cmds at: i + 1)].
 
  cmdActions := cmdMap!

Item was changed:
  ----- Method: TextEditor>>findAgain: (in category 'typing/selecting keys') -----
  findAgain: aKeyboardEvent
+ | previousHistory |
+ previousHistory := self history previous.
+ self
+ insertAndCloseTypeIn ;
+ findAgainSettingSearch: (previousHistory isNil or: [ previousHistory hasReplacedSomething not ]).
- "Find the desired text again.  1/24/96 sw"
-
- self insertAndCloseTypeIn.
- self findAgain.
  ^ true!

Item was added:
+ ----- Method: TextEditor>>findAgainSettingSearch: (in category 'menu messages') -----
+ findAgainSettingSearch: aBoolean
+ aBoolean ifTrue:
+ [ self hasSelection ifTrue:
+ [ self setSearch: self selection string ] ].
+ self findAgain!

Item was changed:
  ----- Method: TextEditor>>findReplaceAgain (in category 'menu messages') -----
  findReplaceAgain
 
  | where |
  self hasSelection ifTrue: [
  "Search from the beginning of the current selection. Supports a nice combination with regular find feature."
  self selectInvisiblyFrom: self startIndex to: self startIndex - 1].
 
  where := self text
  findString: FindText
+ startingAt: self stopIndex-FindText size
- startingAt: self stopIndex
  caseSensitive: Preferences caseSensitiveFinds.
 
  where = 0 ifTrue: [^ false].
 
  self selectInvisiblyFrom: where to: where + FindText size - 1.
  self replaceSelectionWith: ChangeText.
 
  ^ true!

Item was changed:
  ----- Method: TextEditor>>mouseMove: (in category 'events') -----
+ mouseMove: evt
- mouseMove: evt
  "Change the selection in response to mouse-down drag"
-
  pointBlock := paragraph characterBlockAtPoint: evt position.
+ self
+ storeSelectionInParagraph ;
+ setSearch: self selection string!
- self storeSelectionInParagraph!

Item was changed:
  ----- Method: TextEditor>>selectFrom:to: (in category 'new selection') -----
  selectFrom: start to: stop
  "Select the specified characters inclusive."
  self selectInvisiblyFrom: start to: stop.
  self closeTypeIn.
  self storeSelectionInParagraph.
  "Preserve current emphasis if selection is empty"
  stop > start ifTrue: [
+ self setEmphasisHere ].
+ self hasSelection ifTrue: [ self setSearch: self selection string ]!
- self setEmphasisHere ]!

Item was removed:
- ----- Method: TextEditor>>setSearchString: (in category 'nonediting/nontyping keys') -----
- setSearchString: aKeyboardEvent
- "Establish the current selection as the current search string."
-
- | aString |
- self insertAndCloseTypeIn.
- self lineSelectAndEmptyCheck: [^ true].
- aString :=  self selection string.
- aString size = 0
- ifTrue:
- [self flash]
- ifFalse:
- [self setSearch: aString].
- ^ true!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.1040.mcz

marcel.taeumel
...now the user has to be very careful when to change the selection... I think there is room for improvement. :) Why not just change the selection on find-again? Why on mouse-down? This is too brittle... It looks like that #findAgainSettingSearch: brings back that complicated interface into the TextEditor (#doAgain:many: *sigh*), that tried to simplify. ;-)

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.1040.mcz

marcel.taeumel
What about updating FindText in #findAgain if there is some selection and that does not match the selection anymore? This would avoid some user errors... ;-) And having this, we would not need this additional #findAgainSettingSearch: anymore. And we would not have to scatter find-code over to mouse-down etc...

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.1040.mcz

Chris Muller-3
In reply to this post by marcel.taeumel
On Mon, Nov 16, 2015 at 12:26 AM, marcel.taeumel <[hidden email]> wrote:
> ...now the user has to be very careful when to change the selection...

The search-and-replace didn't even work well at all before, so the
user in a lot better shape now than she was before.

> I
> think there is room for improvement. :) Why not just change the selection on
> find-again? Why on mouse-down? This is too brittle... It looks like that
> #findAgainSettingSearch: brings back that complicated interface into the
> TextEditor (#doAgain:many: *sigh*), that tried to simplify. ;-)

TextEditor does not provide a single path through a method which
updates the current selection which could be hooked.  That's why it
had to be hooked in #selectFrom:to: as well as #mouseMove:.
#mouseMove is already updating its model (its pointBlock) by
direct-assignment, setting the search is just another part of its
model, so I don't see that it is any more brittle than it was before..

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.1040.mcz

Chris Muller-3
In reply to this post by marcel.taeumel
On Mon, Nov 16, 2015 at 12:37 AM, marcel.taeumel <[hidden email]> wrote:
> What about updating FindText in #findAgain if there is some selection and
> that does not match the selection anymore?

Once the user presses command+j, the selection is updated, but the
FindText shouldn't be, because they want to find the next occurrence
of the FindText, not what it was changed to via command+j...

> This would avoid some user
> errors... ;-) And having this, we would not need this additional
> #findAgainSettingSearch: anymore. And we would not have to scatter find-code
> over to mouse-down etc...
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/The-Trunk-Morphic-cmm-1040-mcz-tp4861159p4861166.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>