Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.370.mcz ==================== Summary ==================== Name: Morphic-cmm.370 Author: cmm Time: 2 March 2010, 6:49:15.68 pm UUID: ea745757-8733-4ec9-a9f6-aabc939b465e Ancestors: Morphic-ar.369 Added hot-key to invoke pretty-print on a method. It is crucial for the computer to handle mundane code-formatting, because it allows code to "flow" into the system as quickly as one can type. The key is Shift+Command+S. The pretty-print command also now positions the cursor at the end of the code, where there is a chance you wish to continue the method, instead of at the beginning, where there is no chance of that. =============== Diff against Morphic-ar.369 =============== Item was changed: ----- Method: TextEditor>>prettyPrint: (in category 'menu messages') ----- + prettyPrint: decorated - prettyPrint: decorated "Reformat the contents of the receiver's view (a Browser)." - | selectedClass newText | + model selectedMessageName ifNil: [ ^ morph flash ]. - model selectedMessageName ifNil: [^ morph flash]. selectedClass := model selectedClassOrMetaClass. newText := selectedClass compilerClass new format: self text in: selectedClass notifying: self decorated: decorated. newText ifNotNil: + [ self + deselect ; + selectInvisiblyFrom: 1 + to: paragraph text size. - [self deselect; selectInvisiblyFrom: 1 to: paragraph text size. self replaceSelectionWith: (newText asText makeSelectorBoldIn: selectedClass). + self selectAt: self text size + 1 ]! - self selectAt: 1]! Item was added: + ----- Method: SmalltalkEditor>>invokePrettyPrint: (in category 'editing keys') ----- + invokePrettyPrint: dummy + self prettyPrint: false. + ^ true! Item was changed: ----- Method: SmalltalkEditor 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." "SmalltalkEditor initialize" | cmds | super initializeShiftCmdKeyShortcuts. cmds := #( $a argAdvance: $b browseItHere: $e methodStringsContainingIt: $f displayIfFalse: $g fileItIn: $i exploreIt: $n referencesToIt: + $s invokePrettyPrint: $t displayIfTrue: $v pasteInitials: $w methodNamesContainingIt: ). 1 to: cmds size by: 2 do: [ :i | shiftCmdActions at: ((cmds at: i) asciiValue + 1) put: (cmds at: i + 1). "plain keys" shiftCmdActions at: ((cmds at: i) asciiValue - 32 + 1) put: (cmds at: i + 1). "shifted keys" shiftCmdActions at: ((cmds at: i) asciiValue - 96 + 1) put: (cmds at: i + 1). "ctrl keys" ].! |
Free forum by Nabble | Edit this page |