[squeak-dev] The Trunk: Morphic-mt.2000.mcz
Chris Muller
asqueaker at gmail.com
Wed Jun 15 22:31:31 UTC 2022
Thank you!
On Wed, Jun 8, 2022 at 2:50 AM <commits at source.squeak.org> wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.2000.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.2000
> Author: mt
> Time: 8 June 2022, 9:50:09.755722 am
> UUID: f8f15bbc-3ee5-a04e-b53e-79771cc03972
> Ancestors: Morphic-mt.1999
>
> Tweak the preference "Legacy keyboard shortcuts (US/UK only)" to really
> have the old behavior, which is bracket-toggling for, e.g., CMD+SHIFT+9.
>
> Note that that preference is disabled by default and only makes sense for
> US/UK keyboard layouts.
>
> See
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-June/220859.html
>
> =============== Diff against Morphic-mt.1999 ===============
>
> Item was changed:
> Editor subclass: #TextEditor
> instanceVariableNames: 'model paragraph markBlock pointBlock
> beginTypeInIndex emphasisHere lastParenLocation otherInterval oldInterval
> typeAhead history'
> classVariableNames: 'AutoEnclose AutoIndent ChangeText
> EncloseSelection FindText InteractivePrintIt'
> + poolDictionaries: 'LegacyShortcutsFilter'
> - 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'!
>
> Item was changed:
> ----- Method: TextEditor>>enclose: (in category 'editing keys') -----
> enclose: aKeyboardEvent
> - "Insert or remove bracket characters around the current selection."
>
> + ^ self enclose: aKeyboardEvent toggleOnly: LegacyShortcutsEnabled
> == true!
> - | character left right startIndex stopIndex oldSelection which
> closingBracket t |
> - character := aKeyboardEvent keyCharacter.
> - self closeTypeIn.
> - startIndex := self startIndex.
> - stopIndex := self stopIndex.
> - oldSelection := self selection.
> - closingBracket := false.
> - which := '([<{|"''' indexOf: character ifAbsent: [
> - closingBracket := true.
> - ')]>}|"''' indexOf: character ifAbsent: [ ^ false
> ]].
> - left := '([<{|"''' at: which.
> - right := ')]>}|"''' at: which.
> - t := self text.
> - ((startIndex > 1 and: [stopIndex <= t size])
> - and: [ (t at: startIndex-1) = left and: [(t at:
> stopIndex) = right]]
> - and: [ closingBracket or: [left = right] ])
> - ifTrue:
> - ["already enclosed and character is a closing
> bracket; strip off brackets"
> - self selectFrom: startIndex-1 to: stopIndex.
> - self replaceSelectionWith: oldSelection]
> - ifFalse:
> - ["not enclosed or character is an opening bracket;
> enclose by matching brackets"
> - closingBracket ifTrue: [ ^ false ] ifFalse:
> - [ self replaceSelectionWith:
> - (Text string: (String with: left),
> oldSelection string, (String with: right) attributes: emphasisHere).
> - self selectFrom: startIndex+1 to: stopIndex] ].
> - ^true!
>
> Item was added:
> + ----- Method: TextEditor>>enclose:toggleOnly: (in category 'editing
> keys') -----
> + enclose: aKeyboardEvent toggleOnly: toggleOnly
> + "Insert or remove bracket characters around the current selection.
> An opening
> + bracket will add a level, a closing one will remove a level. If
> there is no level to
> + remove, the current text selection will be replaced with that
> closing bracket. If
> + both opening and closing characters are identical, only one level
> is possible and
> + both states are toggled by repeated invocation. If toggleOnly is
> set, that also
> + happens for all asymmetrical characters."
> +
> + | character left right startIndex stopIndex oldSelection which
> closingBracket t |
> + character := aKeyboardEvent keyCharacter.
> + self closeTypeIn.
> + startIndex := self startIndex.
> + stopIndex := self stopIndex.
> + oldSelection := self selection.
> + closingBracket := false.
> + which := '([<{|"''' indexOf: character ifAbsent: [
> + closingBracket := true.
> + ')]>}|"''' indexOf: character ifAbsent: [ ^ false
> ]].
> + left := '([<{|"''' at: which.
> + right := ')]>}|"''' at: which.
> + t := self text.
> + ((startIndex > 1 and: [stopIndex <= t size])
> + and: [ (t at: startIndex-1) = left and: [(t at:
> stopIndex) = right]]
> + and: [ closingBracket or: [left = right] or:
> [toggleOnly] ])
> + ifTrue:
> + ["already enclosed and character is a closing
> bracket; strip off brackets"
> + self selectFrom: startIndex-1 to: stopIndex.
> + self replaceSelectionWith: oldSelection]
> + ifFalse:
> + ["not enclosed or character is an opening bracket;
> enclose by matching brackets"
> + closingBracket ifTrue: [ ^ false ] ifFalse:
> + [ self replaceSelectionWith:
> + (Text string: (String with: left),
> oldSelection string, (String with: right) attributes: emphasisHere).
> + self selectFrom: startIndex+1 to: stopIndex] ].
> + ^true!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220615/02a76ce6/attachment-0001.html>
More information about the Squeak-dev
mailing list
|