[squeak-dev] The Trunk: Morphic-cmm.339.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Feb 12 22:12:13 UTC 2010


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

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

Name: Morphic-cmm.339
Author: cmm
Time: 12 February 2010, 4:10:58.781 pm
UUID: 78515af8-e2f0-4581-adb9-22905df81937
Ancestors: Morphic-cmm.338

Added "Destructive Back Word" preference.  It defaults to the worse, legacy option, true.  Try setting it false and note how nice a non-destructive back-word command is:

	- Ability to select the prior text while keeping hands in the typing position.
	- When used in conjunction with SelectionsMayShrink=false, it becomes useful in the debugger for selecting and evaluating expressions using gross (vs. fine) motor-skill, preserving developer energy.
	- The existing behavior, replacing the prior word(s) with something else is preserved verbatim, no additional gestures.
	- The existing behavior, to delete prior words (without replacing them with anything) does now require the deliberate action of delete (or backspace).  However, this is actually better than destructive backWord because the selection lets you confirm what you want to delete, instead of accidently deleting more than you want (i.e., when punctuation is involved).

=============== Diff against Morphic-cmm.338 ===============

Item was added:
+ ----- Method: Editor class>>destructiveBackWord (in category 'preferences') -----
+ destructiveBackWord
+ 	<preference: 'Destructive Back-Word'
+ 		category: 'Morphic'
+ 		description: 'Indicates whether the back-word command deletes, or merely selects, the prior word.'
+ 		type: #Boolean>
+ 	^ DestructiveBackWord ifNil: [ true ]!

Item was changed:
  ----- Method: Editor class>>selectionsMayShrink: (in category 'preferences') -----
+ selectionsMayShrink: aBoolean
+ 	SelectionsMayShrink := aBoolean!
- selectionsMayShrink: aBool
- 	SelectionsMayShrink := aBool.!

Item was added:
+ ----- Method: Editor>>nonDestructiveBackWord: (in category 'typing/selecting keys') -----
+ nonDestructiveBackWord: characterStream 
+ 	"Select the prior word."
+ 	| indices newPosition |
+ 	self closeTypeIn: characterStream.
+ 	indices := self 
+ 		setIndices: true
+ 		forward: false.
+ 	newPosition := 1 max: (indices at: #moving)-1.
+ 	newPosition :=  self previousWord: newPosition.
+ 	sensor keyboard.
+ 	self selectMark: (indices at: #fixed) point: newPosition - 1.
+ 	^ true!

Item was added:
+ ----- Method: Editor class>>destructiveBackWord: (in category 'preferences') -----
+ destructiveBackWord: aBoolean
+ 	DestructiveBackWord := aBoolean!

Item was added:
+ ----- Method: Editor>>destructiveBackWord: (in category 'typing/selecting keys') -----
+ destructiveBackWord: characterStream 
+ 	"If the selection is not a caret, delete it and leave it in the backspace buffer.
+ 	 Else if there is typeahead, delete it.
+ 	 Else, delete the word before the caret."
+ 
+ 	| startIndex |
+ 	sensor keyboard.
+ 	characterStream isEmpty
+ 		ifTrue:
+ 			[self hasCaret
+ 				ifTrue: "a caret, delete at least one character"
+ 					[startIndex := 1 max: self markIndex - 1.
+ 					[startIndex > 1 and:
+ 						[(self string at: startIndex - 1) tokenish]]
+ 						whileTrue:
+ 							[startIndex := startIndex - 1]]
+ 				ifFalse: "a non-caret, just delete it"
+ 					[startIndex := self markIndex].
+ 			self backTo: startIndex]
+ 		ifFalse:
+ 			[characterStream reset].
+ 	^false!

Item was changed:
  Object subclass: #Editor
  	instanceVariableNames: 'sensor morph selectionShowing'
+ 	classVariableNames: 'DestructiveBackWord SelectionsMayShrink'
- 	classVariableNames: 'SelectionsMayShrink'
  	poolDictionaries: ''
  	category: 'Morphic-Text Support'!
  
  !Editor commentStamp: '<historical>' prior: 0!
  New text editors.
  TextEditor provides most of the functionality that used to be in TextMorphEditor. This class is no longer a Controller!!
  SmalltalkEditor is has Smalltalk code specific features.
  SimpleEditor provides basic functionality for single line text editing. It does not handle fonts and styles, aligning and Smalltalk utilities. It handles one single line.
  CellStyleEditor allows entering alphabetic characters using only number keys, like most cell phones do.!

Item was changed:
  ----- Method: Editor>>backWord: (in category 'typing/selecting keys') -----
  backWord: characterStream 
+ 	^ self class destructiveBackWord 
+ 		ifTrue: [ self destructiveBackWord: characterStream ]
+ 		ifFalse: [ self nonDestructiveBackWord: characterStream ]!
- 	"If the selection is not a caret, delete it and leave it in the backspace buffer.
- 	 Else if there is typeahead, delete it.
- 	 Else, delete the word before the caret."
- 
- 	| startIndex |
- 	sensor keyboard.
- 	characterStream isEmpty
- 		ifTrue:
- 			[self hasCaret
- 				ifTrue: "a caret, delete at least one character"
- 					[startIndex := 1 max: self markIndex - 1.
- 					[startIndex > 1 and:
- 						[(self string at: startIndex - 1) tokenish]]
- 						whileTrue:
- 							[startIndex := startIndex - 1]]
- 				ifFalse: "a non-caret, just delete it"
- 					[startIndex := self markIndex].
- 			self backTo: startIndex]
- 		ifFalse:
- 			[characterStream reset].
- 	^false!




More information about the Squeak-dev mailing list