[squeak-dev] The Inbox: Morphic-nice.566.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Aug 4 08:50:26 UTC 2011
Nicolas Cellier uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-nice.566.mcz
==================== Summary ====================
Name: Morphic-nice.566
Author: nice
Time: 4 August 2011, 10:49:17.953 am
UUID: e386a0ba-d7c5-418b-a8e0-926d8ac29ee0
Ancestors: Morphic-ul.565
1) correct problem when double clicking in empty text
2) #shiftEnclose: is hardcoding the keyboard layout, which is not compatible with foreign keyboards and modern VM, and prevents correct enclosing to work.
This version rather use a normal #enclose:
=============== Diff against Morphic-ul.565 ===============
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 min: string size max: 2.
openDelimiter := string at: here - 1.
match := leftDelimiters indexOf: openDelimiter.
match > 0
ifTrue: [
"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: TextEditor class>>initializeShiftCmdKeyShortcuts (in category 'keyboard shortcut tables') -----
initializeShiftCmdKeyShortcuts
"Initialize the shift-command-key (or control-key) shortcut table."
"NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
"wod 11/3/1998: Fix setting of cmdMap for shifted keys to actually use the
capitalized versions of the letters.
TPR 2/18/99: add the plain ascii values back in for those VMs that don't return the shifted values."
"TextEditor initialize"
| cmdMap cmds |
"shift-command and control shortcuts"
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: #forwardDelete:. "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:. "ctrl-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: (45 + 1) put: #changeEmphasis:. "cmd-sh-minus"
cmdMap at: (61 + 1) put: #changeEmphasis:. "cmd-sh-plus"
cmdMap at: (127 + 1) put: #forwardDelete:. "del key"
+ "On some keyboards, these characters require a shift"
+ '([<{|"''' do: [:char | cmdMap at: char asciiValue + 1 put: #enclose:].
- "Note: Command key overrides shift key, so, for example, cmd-shift-9 produces $9 not $("
- '9[,''' do: [ :char | cmdMap at: (char asciiValue + 1) put: #shiftEnclose: ]. "({< and double-quote"
- "Note: Must use cmd-9 or ctrl-9 to get '()' since cmd-shift-9 is a Mac FKey command."
"NB: sw 12/9/2001 commented out the idiosyncratic line just below, which was grabbing shift-esc in the text editor and hence which argued with the wish to have shift-esc be a universal gesture for escaping the local context and calling up the desktop menu."
"cmdMap at: (27 + 1) put: #shiftEnclose:." "ctrl-["
"'""''(' do: [ :char | cmdMap at: (char asciiValue + 1) put: #enclose:]."
cmds := #(
$c compareToClipboard:
$d duplicate:
$h cursorTopHome:
$j doAgainMany:
$k changeStyle:
$l outdent:
$m selectCurrentTypeIn:
$r indent:
$s search:
$u changeLfToCr:
$x makeLowercase:
$y makeUppercase:
$z makeCapitalized:
).
1 to: cmds size by: 2 do: [ :i |
cmdMap at: ((cmds at: i) asciiValue + 1) put: (cmds at: i + 1). "plain keys"
cmdMap at: ((cmds at: i) asciiValue - 32 + 1) put: (cmds at: i + 1). "shifted keys"
cmdMap at: ((cmds at: i) asciiValue - 96 + 1) put: (cmds at: i + 1). "ctrl keys"
].
shiftCmdActions := cmdMap!
Item was removed:
- ----- Method: TextEditor>>shiftEnclose: (in category 'editing keys') -----
- shiftEnclose: aKeyboardEvent
- "Insert or remove bracket characters around the current selection.
- Flushes typeahead."
-
- | char left right startIndex stopIndex oldSelection which text |
- char := aKeyboardEvent keyCharacter.
- char = $9 ifTrue: [ char := $( ].
- char = $, ifTrue: [ char := $< ].
- char = $[ ifTrue: [ char := ${ ].
- char = $' ifTrue: [ char := $" ].
- char asciiValue = 27 ifTrue: [ char := ${ ]. "ctrl-["
-
- self closeTypeIn.
- startIndex := self startIndex.
- stopIndex := self stopIndex.
- oldSelection := self selection.
- which := '([<{|"''' indexOf: char ifAbsent: [1].
- left := '([<{|"''' at: which.
- right := ')]>}|"''' at: which.
- text := paragraph text.
- ((startIndex > 1 and: [stopIndex <= text size])
- and: [ (text at: startIndex-1) = left and: [(text at: stopIndex) = right]])
- ifTrue: [
- "already enclosed; strip off brackets"
- self selectFrom: startIndex-1 to: stopIndex.
- self replaceSelectionWith: oldSelection]
- ifFalse: [
- "not enclosed; enclose by matching brackets"
- self replaceSelectionWith:
- (Text string: (String with: left), oldSelection string, (String with: right) attributes: emphasisHere).
- self selectFrom: startIndex+1 to: stopIndex].
- ^true!
Item was changed:
(PackageInfo named: 'Morphic') postscript: '(Preferences dictionaryOfPreferences at: #alternativeWindowBoxesLook) defaultValue: false.
"Force SystemProgressMorph to be reset"
SystemProgressMorph initialize; reset.
- TextEditor initialize.
- SmalltalkEditor initialize.
+ "Initialize the key bindings and menus"
+ Editor initialize.
+
"apply the new icons"
MenuIcons initializeIcons.
TheWorldMainDockingBar updateInstances.
'!
More information about the Squeak-dev
mailing list
|