Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.322.mcz ==================== Summary ==================== Name: Morphic-ar.322 Author: ar Time: 6 February 2010, 11:40:47.921 am UUID: aecf6e04-dd35-6643-8ec2-f019954cc285 Ancestors: Morphic-ar.320, Morphic-cmm.321 Merging Morphic-cmm.321 - Recovered "Auto Indent" preference lost back in 3.9, updated for the new TextEditor and Preference Pragma's. =============== Diff against Morphic-ar.320 =============== Item was added: + ----- Method: TextEditor>>tabCount (in category 'typing/selecting keys') ----- + tabCount + ^ self class autoIndent + ifTrue: + [ | tabCount s i char | + s := paragraph string. + i := self stopIndex. + tabCount := 0. + [(i := i-1) > 0 and: [(char := s at: i) ~= Character cr]] + whileTrue: "Count tabs and brackets (but not a leading bracket)" + [(char = Character tab and: [i < s size and: [(s at: i+1) ~= $[ ]]) ifTrue: [tabCount := tabCount + 1]. + char = $[ ifTrue: [tabCount := tabCount + 1]. + char = $] ifTrue: [tabCount := tabCount - 1]]. + tabCount ] + ifFalse: [ 0 ]! Item was changed: ----- Method: TextEditor>>crWithIndent: (in category 'typing/selecting keys') ----- crWithIndent: characterStream "Replace the current text selection with CR followed by as many tabs as on the current line (+/- bracket count) -- initiated by Shift-Return." - | char s i tabCount | sensor keyboard. "flush character" + characterStream crtab: self tabCount. "Now inject CR with tabCount tabs" - s := paragraph string. - i := self stopIndex. - tabCount := 0. - [(i := i-1) > 0 and: [(char := s at: i) ~= Character cr]] - whileTrue: "Count tabs and brackets (but not a leading bracket)" - [(char = Character tab and: [i < s size and: [(s at: i+1) ~= $[ ]]) ifTrue: [tabCount := tabCount + 1]. - char = $[ ifTrue: [tabCount := tabCount + 1]. - char = $] ifTrue: [tabCount := tabCount - 1]]. - characterStream crtab: tabCount. "Now inject CR with tabCount tabs" ^ false! Item was added: + ----- Method: TextEditor class>>autoIndent (in category 'accessing') ----- + autoIndent + <preference: 'Auto Indent' + category: 'Morphic' + description: 'When true, tabs will be inserted after pressing Enter | Return such that the new line will be indented equally with the previous line.' + type: #Boolean> + ^ AutoIndent ifNil: [ true ]! Item was added: + ----- Method: TextEditor class>>autoIndent: (in category 'accessing') ----- + autoIndent: aBoolean + AutoIndent := aBoolean! Item was changed: + ----- Method: TextEditor>>totalTextHeight (in category 'accessing') ----- - ----- Method: TextEditor>>totalTextHeight (in category 'as yet unclassified') ----- totalTextHeight ^paragraph lines last bottom! Item was changed: + ----- Method: TextEditor>>visibleHeight (in category 'accessing') ----- - ----- Method: TextEditor>>visibleHeight (in category 'as yet unclassified') ----- visibleHeight ^morph owner bounds height! Item was changed: Editor subclass: #TextEditor instanceVariableNames: 'model paragraph pointBlock markBlock beginTypeInBlock emphasisHere otherInterval lastParenLocation oldInterval' + classVariableNames: 'AutoIndent ChangeText FindText UndoInterval UndoMessage UndoParagraph UndoSelection Undone' - classVariableNames: 'ChangeText FindText UndoInterval UndoMessage UndoParagraph UndoSelection Undone' poolDictionaries: '' category: 'Morphic-Text Support'! TextEditor class instanceVariableNames: 'cmdActions shiftCmdActions yellowButtonMenu shiftedYellowButtonMenu'! !TextEditor commentStamp: '<historical>' prior: 0! See comment in Editor. My instances edit Text, this is, they support multiple lines and TextAttributes. They have no specific facilities for editing Smalltalk code. Those are found in SmalltalkEditor.! TextEditor class instanceVariableNames: 'cmdActions shiftCmdActions yellowButtonMenu shiftedYellowButtonMenu'! |
Free forum by Nabble | Edit this page |