Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
--- Sent from Squeak Inbox Talk
So, you would make it an extra preference instead of fine-tuning the existing one? Hmm... sounds good to me.
Best, Marcel Am 01.11.2021 22:16:58 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
Hi Marcel,
I am not sure whether a single preference would fit everyone's needs. For my own needs, the new mode alone would suffice, too. :-)
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Taeumel, Marcel Gesendet: Donnerstag, 4. November 2021 08:22:45 An: squeak-dev Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
So, you would make it an extra preference instead of fine-tuning the existing one? Hmm... sounds good to me.
Best, Marcel
Am 01.11.2021 22:16:58 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
--- Sent from Squeak Inbox Talkhttps://github.com/hpi-swa-lab/squeak-inbox-talk
Hi Christoph,
... I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
I like it, same frustration here, however there's a preference "Enclose selection with brackets" to cover this scenario. Nevertheless I often enter the closing bracket first - when I realize I need brackets, and then the frustration comes when adding the opening bracket :)
Thanks,
^[^ Jaromir ---
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Hi Christoph,
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor.
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
I am not sure whether a single preference would fit everyone's needs.
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Thanks, Chris
Hi Chris,
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
Yes, it does. :-)
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-)
Below the complete diff of the changeset for convenience, just because my new diff generators is so funny.
Best, Christoph
=============== Postscript ===============
"Postscript: Leave the line above, and replace the rest of this comment by a useful one. Executable statements should follow this comment, and should be separated by periods, with no exclamation points (!). Be sure to put any further comments in double-quotes, like this one."
TextEditor autoEnclose: TextEditor autoEnclose.
=============== Diff ===============
PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) initializePage03Interaction
| currentPage pane | currentPage := pages add: self createPage. pane := self createScrollPane. currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). currentPage addMorphBack: pane. pane scroller firstSubmorph addAllMorphsBack: { self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). self createVerticalSpace. - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). self createVerticalSpace. self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). }.
PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 + stateAutoEncloseAlways + + ^ TextEditor autoEncloseAlways
PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 + stateAutoEncloseBeforeSpaces + + ^ TextEditor autoEncloseBeforeSpaces
PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 + toggleAutoEncloseAlways + + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. + self + changed: #stateAutoEncloseAlways; + changed: #stateAutoEncloseBeforeSpaces.
PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 + toggleAutoEncloseBeforeSpaces + + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. + self + changed: #stateAutoEncloseAlways; + changed: #stateAutoEncloseBeforeSpaces.
ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) setPreferences "Preferences class defaultValueTableForCurrentRelease" - " Preferences outOfTheBox." - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." - "General User interaction"
+ " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." + + "General User interaction" Preferences - enable: #generalizedYellowButtonMenu; + enable: #generalizedYellowButtonMenu ; enable: #swapMouseButtons; disable: #mouseOverForKeyboardFocus. Morph indicateKeyboardFocus: true. Project uiManager openToolsAttachedToMouseCursor: false. SearchBar useScratchPad: false. HandMorph sendMouseWheelToKeyboardFocus: false. HandMorph synthesizeMouseWheelEvents: true. "Text input." TextEditor - autoEnclose: true; - autoIndent: true; - encloseSelection: false; - destructiveBackWord: false; - blinkingCursor: true; - dumbbellCursor: false. + autoEnclose: #beforeSpaces ; + autoIndent: true ; + encloseSelection: false ; + destructiveBackWord: false ; + blinkingCursor: true ; + dumbbellCursor: false. PluggableTextMorph simpleFrameAdornments: false. TextMorphForEditView draggableTextSelection: true. - "Windows" + "Windows" SystemWindow reuseWindows: false. SystemWindow windowsRaiseOnClick: true. SystemWindow windowTitleActiveOnFirstClick: true. - Model windowActiveOnFirstClick: false. - "Not good for little screen real estate." - Model useColorfulWindows: false. - - Preferences disable: #fastDragWindowForMorphic. + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." + Model useColorfulWindows: false. + + Preferences + disable: #fastDragWindowForMorphic. AbstractResizerMorph gripThickness: 4; handleLength: 25. CornerGripMorph drawCornerResizeHandles: false; drawEdgeResizeHandles: false. ProportionalSplitterMorph showSplitterHandles: false; smartHorizontalSplitters: false; smartVerticalSplitters: false. - + "Scroll bars." Preferences enable: #scrollBarsNarrow; enable: #scrollBarsOnRight; enable: #alwaysHideHScrollbar; disable: #alwaysShowHScrollbar; disable: #alwaysShowVScrollbar. ScrollBar scrollBarsWithoutArrowButtons: true; scrollBarsWithoutMenuButton: true. - ScrollPane useRetractableScrollBars: false. - + ScrollPane + useRetractableScrollBars: false. + "Rounded corners." Morph preferredCornerRadius: 8. SystemWindow roundedWindowCorners: false. DialogWindow roundedDialogCorners: false. MenuMorph roundedMenuCorners: false. PluggableButtonMorph roundedButtonCorners: false. ScrollBar roundedScrollBarLook: false. "Gradients." SystemWindow gradientWindow: false. DialogWindow gradientDialog: false. MenuMorph gradientMenu: false. PluggableButtonMorph gradientButton: false. ScrollBar gradientScrollBar: false. - + "Shadows" Preferences enable: #menuAppearance3d. Morph useSoftDropShadow: true. "Lists and Trees" PluggableListMorph filterableLists: true; clearFilterAutomatically: false; clearFilterDelay: 500; highlightHoveredRow: true; highlightPreSelection: false; menuRequestUpdatesSelection: true. PluggableTreeMorph filterByLabelsOnly: false; maximumSearchDepth: 1. "Standard Tools" TheWorldMainDockingBar showWorldMainDockingBar: true; showSecondsInClock: true; twentyFourHourClock: true. SearchBar useSmartSearch: true. Workspace shouldStyle: false. TranscriptStream forceUpdate: true; redirectToStdOut: false; characterLimit: 20000. Browser listClassesHierarchically: true; showClassIcons: true; showMessageIcons: true; sortMessageCategoriesAlphabetically: true. SystemBrowser browseWithDragNDrop: true. MessageSet useUnifiedMessageLabels: true. Preferences enable: #annotationPanes; - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); enable: #optionalButtons; disable: #diffsWithPrettyPrint; enable: #traceMessages; enable: #alternativeBrowseIt; enable: #menuWithIcons; enable: #visualExplorer. Preferences disable: #debugLogTimestamp. + "Halo" - Preferences - enable: #showBoundsInHalo; + enable: #showBoundsInHalo ; disable: #alternateHandlesLook; disable: #showDirectionHandles. Morph haloForAll: true; metaMenuForAll: true. - + "System" - NetNameResolver enableIPv6: true. + NetNameResolver enableIPv6: false. Scanner allowUnderscoreAsAssignment: true; prefAllowUnderscoreSelectors: true. - + Deprecation showDeprecationWarnings: true + "that's all, folks"
TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) autoEnclose - <preference: 'Auto enclose brackets () {} []' - categoryList: #('Morphic' 'editing') - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' - type: #Boolean> - - ^ AutoEnclose ifNil: [ false ] + + ^ AutoEnclose ifNil: [#never]
TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) - autoEnclose: aBoolean - AutoEnclose := aBoolean + autoEnclose: aSymbol + + aSymbol == true ifTrue: [ + "backward compatibility." + ^ self autoEnclose: #always]. + + self assert: [#(always beforeSpaces never) includes: aSymbol]. + + AutoEnclose := aSymbol.
TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 + autoEncloseAlways + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' + categoryList: #('Morphic' 'editing') + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' + type: #Boolean> + + ^ self autoEnclose = #always
TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 + autoEncloseAlways: aBoolean + + self autoEnclose: (aBoolean + ifTrue: [#always] + ifFalse: [#never]).
TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 + autoEncloseBeforeSpaces + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' + categoryList: #('Morphic' 'editing') + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' + type: #Boolean> + + ^ self autoEnclose = #beforeSpaces
TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 + autoEncloseBeforeSpaces: aBoolean + + self autoEnclose: (aBoolean + ifTrue: [#beforeSpaces] + ifFalse: [#never]).
TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) autoEncloseFor: typedChar "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." | openers closers | + self class autoEnclose = #never + ifTrue: [ ^ false ]. + (self class autoEnclose = #beforeSpaces + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) + ifFalse: [ ^ false ]. + openers := '([{'. closers := ')]}'. (closers includes: typedChar) ifTrue: [ | pos | self blinkPrevParen: typedChar. ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) ifTrue: [ self moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] forward: true select: false. ^ true ] ifFalse: [ ^ false ] ]. (openers includes: typedChar) ifTrue: [ self openTypeIn; addString: typedChar asString; addString: (closers at: (openers indexOf: typedChar)) asString; insertAndCloseTypeIn; moveCursor: [ : position | position - 1 ] forward: false select: false. ^ true ]. ^ false
TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) dispatchOnKeyboardEvent: aKeyboardEvent "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." | honorCommandKeys typedChar | typedChar := aKeyboardEvent keyCharacter. "Handle one-line input fields." (typedChar == Character cr and: [morph acceptOnCR]) ifTrue: [^ true]. "Clear highlight for last opened parenthesis." self clearParens. "Handle line breaks and auto indent." typedChar == Character cr ifTrue: [ aKeyboardEvent controlKeyPressed ifTrue: [^ self normalCharacter: aKeyboardEvent]. aKeyboardEvent shiftPressed ifTrue: [^ self lf: aKeyboardEvent]. aKeyboardEvent commandKeyPressed ifTrue: [^ self crlf: aKeyboardEvent]. ^ self crWithIndent: aKeyboardEvent].
"Handle indent/outdent with selected text block." typedChar == Character tab ifTrue: [ aKeyboardEvent shiftPressed ifTrue: [self outdent: aKeyboardEvent. ^ true] ifFalse: [self hasMultipleLinesSelected ifTrue: [self indent: aKeyboardEvent. ^ true]]].
honorCommandKeys := Preferences cmdKeysInText.
(honorCommandKeys and: [typedChar == Character enter]) ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this conflict, assume that keys other than cursor keys aren't used together with Crtl." ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [aKeyboardEvent keyValue < 27]) ifTrue: [^ aKeyboardEvent controlKeyPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]]. "backspace, and escape keys (ascii 8 and 27) are command keys" ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) ifTrue: [ ^ aKeyboardEvent shiftPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]].
"the control key can be used to invoke shift-cmd shortcuts" (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent].
"Enclose selection with brackets etc." ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) ifTrue: [^ true].
"Automatically enclose paired characters such as brackets." - (self class autoEnclose and: [self autoEncloseFor: typedChar]) + (self autoEncloseFor: typedChar) ifTrue: [^ true]. "Even if no enclosing feature was used, highlight the matching bracket when closing one." (')]}' includes: typedChar) ifTrue: [self blinkPrevParen: typedChar]. self normalCharacter: aKeyboardEvent. ^ false
--- Sent from Squeak Inbox Talk
On 2021-11-05T19:46:16-05:00, asqueaker@gmail.com wrote:
Hi Christoph,
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor.
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
I am not sure whether a single preference would fit everyone's needs.
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Thanks, Chris
Hi Chris, hi Christoph, hi Jaromir, hi all!
Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
Best, Marcel Am 06.11.2021 23:34:06 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi Chris,
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
Yes, it does. :-)
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-)
Below the complete diff of the changeset for convenience, just because my new diff generators is so funny.
Best, Christoph
=============== Postscript ===============
"Postscript: Leave the line above, and replace the rest of this comment by a useful one. Executable statements should follow this comment, and should be separated by periods, with no exclamation points (!). Be sure to put any further comments in double-quotes, like this one."
TextEditor autoEnclose: TextEditor autoEnclose.
=============== Diff ===============
PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) initializePage03Interaction
| currentPage pane | currentPage := pages add: self createPage. pane := self createScrollPane. currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). currentPage addMorphBack: pane. pane scroller firstSubmorph addAllMorphsBack: { self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). self createVerticalSpace. - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). self createVerticalSpace. self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). }.
PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 + stateAutoEncloseAlways + + ^ TextEditor autoEncloseAlways
PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 + stateAutoEncloseBeforeSpaces + + ^ TextEditor autoEncloseBeforeSpaces
PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 + toggleAutoEncloseAlways + + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. + self + changed: #stateAutoEncloseAlways; + changed: #stateAutoEncloseBeforeSpaces.
PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 + toggleAutoEncloseBeforeSpaces + + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. + self + changed: #stateAutoEncloseAlways; + changed: #stateAutoEncloseBeforeSpaces.
ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) setPreferences "Preferences class defaultValueTableForCurrentRelease" - " Preferences outOfTheBox." - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." - "General User interaction"
+ " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." + + "General User interaction" Preferences - enable: #generalizedYellowButtonMenu; + enable: #generalizedYellowButtonMenu ; enable: #swapMouseButtons; disable: #mouseOverForKeyboardFocus. Morph indicateKeyboardFocus: true. Project uiManager openToolsAttachedToMouseCursor: false. SearchBar useScratchPad: false. HandMorph sendMouseWheelToKeyboardFocus: false. HandMorph synthesizeMouseWheelEvents: true. "Text input." TextEditor - autoEnclose: true; - autoIndent: true; - encloseSelection: false; - destructiveBackWord: false; - blinkingCursor: true; - dumbbellCursor: false. + autoEnclose: #beforeSpaces ; + autoIndent: true ; + encloseSelection: false ; + destructiveBackWord: false ; + blinkingCursor: true ; + dumbbellCursor: false. PluggableTextMorph simpleFrameAdornments: false. TextMorphForEditView draggableTextSelection: true. - "Windows" + "Windows" SystemWindow reuseWindows: false. SystemWindow windowsRaiseOnClick: true. SystemWindow windowTitleActiveOnFirstClick: true. - Model windowActiveOnFirstClick: false. - "Not good for little screen real estate." - Model useColorfulWindows: false. - - Preferences disable: #fastDragWindowForMorphic. + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." + Model useColorfulWindows: false. + + Preferences + disable: #fastDragWindowForMorphic. AbstractResizerMorph gripThickness: 4; handleLength: 25. CornerGripMorph drawCornerResizeHandles: false; drawEdgeResizeHandles: false. ProportionalSplitterMorph showSplitterHandles: false; smartHorizontalSplitters: false; smartVerticalSplitters: false. - + "Scroll bars." Preferences enable: #scrollBarsNarrow; enable: #scrollBarsOnRight; enable: #alwaysHideHScrollbar; disable: #alwaysShowHScrollbar; disable: #alwaysShowVScrollbar. ScrollBar scrollBarsWithoutArrowButtons: true; scrollBarsWithoutMenuButton: true. - ScrollPane useRetractableScrollBars: false. - + ScrollPane + useRetractableScrollBars: false. + "Rounded corners." Morph preferredCornerRadius: 8. SystemWindow roundedWindowCorners: false. DialogWindow roundedDialogCorners: false. MenuMorph roundedMenuCorners: false. PluggableButtonMorph roundedButtonCorners: false. ScrollBar roundedScrollBarLook: false. "Gradients." SystemWindow gradientWindow: false. DialogWindow gradientDialog: false. MenuMorph gradientMenu: false. PluggableButtonMorph gradientButton: false. ScrollBar gradientScrollBar: false. - + "Shadows" Preferences enable: #menuAppearance3d. Morph useSoftDropShadow: true. "Lists and Trees" PluggableListMorph filterableLists: true; clearFilterAutomatically: false; clearFilterDelay: 500; highlightHoveredRow: true; highlightPreSelection: false; menuRequestUpdatesSelection: true. PluggableTreeMorph filterByLabelsOnly: false; maximumSearchDepth: 1. "Standard Tools" TheWorldMainDockingBar showWorldMainDockingBar: true; showSecondsInClock: true; twentyFourHourClock: true. SearchBar useSmartSearch: true. Workspace shouldStyle: false. TranscriptStream forceUpdate: true; redirectToStdOut: false; characterLimit: 20000. Browser listClassesHierarchically: true; showClassIcons: true; showMessageIcons: true; sortMessageCategoriesAlphabetically: true. SystemBrowser browseWithDragNDrop: true. MessageSet useUnifiedMessageLabels: true. Preferences enable: #annotationPanes; - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); enable: #optionalButtons; disable: #diffsWithPrettyPrint; enable: #traceMessages; enable: #alternativeBrowseIt; enable: #menuWithIcons; enable: #visualExplorer. Preferences disable: #debugLogTimestamp. + "Halo" - Preferences - enable: #showBoundsInHalo; + enable: #showBoundsInHalo ; disable: #alternateHandlesLook; disable: #showDirectionHandles. Morph haloForAll: true; metaMenuForAll: true. - + "System" - NetNameResolver enableIPv6: true. + NetNameResolver enableIPv6: false. Scanner allowUnderscoreAsAssignment: true; prefAllowUnderscoreSelectors: true. - + Deprecation showDeprecationWarnings: true + "that's all, folks"
TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) autoEnclose - <preference: 'Auto enclose brackets () {} []' - categoryList: #('Morphic' 'editing') - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' - type: #Boolean> - - ^ AutoEnclose ifNil: [ false ] + + ^ AutoEnclose ifNil: [#never]
TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) - autoEnclose: aBoolean - AutoEnclose := aBoolean + autoEnclose: aSymbol + + aSymbol == true ifTrue: [ + "backward compatibility." + ^ self autoEnclose: #always]. + + self assert: [#(always beforeSpaces never) includes: aSymbol]. + + AutoEnclose := aSymbol.
TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 + autoEncloseAlways + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' + categoryList: #('Morphic' 'editing') + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' + type: #Boolean> + + ^ self autoEnclose = #always
TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 + autoEncloseAlways: aBoolean + + self autoEnclose: (aBoolean + ifTrue: [#always] + ifFalse: [#never]).
TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 + autoEncloseBeforeSpaces + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' + categoryList: #('Morphic' 'editing') + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' + type: #Boolean> + + ^ self autoEnclose = #beforeSpaces
TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 + autoEncloseBeforeSpaces: aBoolean + + self autoEnclose: (aBoolean + ifTrue: [#beforeSpaces] + ifFalse: [#never]).
TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) autoEncloseFor: typedChar "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." | openers closers | + self class autoEnclose = #never + ifTrue: [ ^ false ]. + (self class autoEnclose = #beforeSpaces + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) + ifFalse: [ ^ false ]. + openers := '([{'. closers := ')]}'. (closers includes: typedChar) ifTrue: [ | pos | self blinkPrevParen: typedChar. ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) ifTrue: [ self moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] forward: true select: false. ^ true ] ifFalse: [ ^ false ] ]. (openers includes: typedChar) ifTrue: [ self openTypeIn; addString: typedChar asString; addString: (closers at: (openers indexOf: typedChar)) asString; insertAndCloseTypeIn; moveCursor: [ : position | position - 1 ] forward: false select: false. ^ true ]. ^ false
TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) dispatchOnKeyboardEvent: aKeyboardEvent "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." | honorCommandKeys typedChar | typedChar := aKeyboardEvent keyCharacter. "Handle one-line input fields." (typedChar == Character cr and: [morph acceptOnCR]) ifTrue: [^ true]. "Clear highlight for last opened parenthesis." self clearParens. "Handle line breaks and auto indent." typedChar == Character cr ifTrue: [ aKeyboardEvent controlKeyPressed ifTrue: [^ self normalCharacter: aKeyboardEvent]. aKeyboardEvent shiftPressed ifTrue: [^ self lf: aKeyboardEvent]. aKeyboardEvent commandKeyPressed ifTrue: [^ self crlf: aKeyboardEvent]. ^ self crWithIndent: aKeyboardEvent].
"Handle indent/outdent with selected text block." typedChar == Character tab ifTrue: [ aKeyboardEvent shiftPressed ifTrue: [self outdent: aKeyboardEvent. ^ true] ifFalse: [self hasMultipleLinesSelected ifTrue: [self indent: aKeyboardEvent. ^ true]]].
honorCommandKeys := Preferences cmdKeysInText.
(honorCommandKeys and: [typedChar == Character enter]) ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this conflict, assume that keys other than cursor keys aren't used together with Crtl." ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [aKeyboardEvent keyValue < 27]) ifTrue: [^ aKeyboardEvent controlKeyPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]]. "backspace, and escape keys (ascii 8 and 27) are command keys" ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) ifTrue: [ ^ aKeyboardEvent shiftPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]].
"the control key can be used to invoke shift-cmd shortcuts" (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent].
"Enclose selection with brackets etc." ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) ifTrue: [^ true].
"Automatically enclose paired characters such as brackets." - (self class autoEnclose and: [self autoEncloseFor: typedChar]) + (self autoEncloseFor: typedChar) ifTrue: [^ true]. "Even if no enclosing feature was used, highlight the matching bracket when closing one." (')]}' includes: typedChar) ifTrue: [self blinkPrevParen: typedChar]. self normalCharacter: aKeyboardEvent. ^ false
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-05T19:46:16-05:00, asqueaker@gmail.com wrote:
Hi Christoph,
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor.
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
I am not sure whether a single preference would fit everyone's needs.
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211105/7d2cc226/attachment.html
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
~~~ ^[^ -- Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T14:46:45+01:00, marcel.taeumel@hpi.de wrote:
Hi Chris, hi Christoph, hi Jaromir, hi all!
Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
Best, Marcel Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Hi Chris,
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
Yes, it does. :-)
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-)
Below the complete diff of the changeset for convenience, just because my new diff generators is so funny.
Best, Christoph
=============== Postscript ===============
"Postscript: Leave the line above, and replace the rest of this comment by a useful one. Executable statements should follow this comment, and should be separated by periods, with no exclamation points (!). Be sure to put any further comments in double-quotes, like this one."
TextEditor autoEnclose: TextEditor autoEnclose.
=============== Diff ===============
PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) initializePage03Interaction
| currentPage pane | currentPage := pages add: self createPage. pane := self createScrollPane. currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). currentPage addMorphBack: pane. pane scroller firstSubmorph addAllMorphsBack: { self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). self createVerticalSpace.
- self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose).
- self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose).
- self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose).
self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). self createVerticalSpace. self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). }.
PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19
- stateAutoEncloseAlways
- ^ TextEditor autoEncloseAlways
PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19
- stateAutoEncloseBeforeSpaces
- ^ TextEditor autoEncloseBeforeSpaces
PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20
- toggleAutoEncloseAlways
- TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not.
- self
- changed: #stateAutoEncloseAlways;
- changed: #stateAutoEncloseBeforeSpaces.
PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20
- toggleAutoEncloseBeforeSpaces
- TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not.
- self
- changed: #stateAutoEncloseAlways;
- changed: #stateAutoEncloseBeforeSpaces.
ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) setPreferences "Preferences class defaultValueTableForCurrentRelease"
- " Preferences outOfTheBox."
- "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up."
- "General User interaction"
- " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up."
- "General User interaction"
Preferences
- enable: #generalizedYellowButtonMenu;
- enable: #generalizedYellowButtonMenu ;
enable: #swapMouseButtons; disable: #mouseOverForKeyboardFocus. Morph indicateKeyboardFocus: true. Project uiManager openToolsAttachedToMouseCursor: false. SearchBar useScratchPad: false. HandMorph sendMouseWheelToKeyboardFocus: false. HandMorph synthesizeMouseWheelEvents: true. "Text input." TextEditor
- autoEnclose: true;
- autoIndent: true;
- encloseSelection: false;
- destructiveBackWord: false;
- blinkingCursor: true;
- dumbbellCursor: false.
- autoEnclose: #beforeSpaces ;
- autoIndent: true ;
- encloseSelection: false ;
- destructiveBackWord: false ;
- blinkingCursor: true ;
- dumbbellCursor: false.
PluggableTextMorph simpleFrameAdornments: false. TextMorphForEditView draggableTextSelection: true.
- "Windows"
- "Windows"
SystemWindow reuseWindows: false. SystemWindow windowsRaiseOnClick: true. SystemWindow windowTitleActiveOnFirstClick: true.
- Model windowActiveOnFirstClick: false.
- "Not good for little screen real estate."
- Model useColorfulWindows: false.
- Preferences disable: #fastDragWindowForMorphic.
- Model windowActiveOnFirstClick: false. "Not good for little screen real estate."
- Model useColorfulWindows: false.
- Preferences
- disable: #fastDragWindowForMorphic.
AbstractResizerMorph gripThickness: 4; handleLength: 25. CornerGripMorph drawCornerResizeHandles: false; drawEdgeResizeHandles: false. ProportionalSplitterMorph showSplitterHandles: false; smartHorizontalSplitters: false; smartVerticalSplitters: false.
"Scroll bars." Preferences enable: #scrollBarsNarrow; enable: #scrollBarsOnRight; enable: #alwaysHideHScrollbar; disable: #alwaysShowHScrollbar; disable: #alwaysShowVScrollbar. ScrollBar scrollBarsWithoutArrowButtons: true; scrollBarsWithoutMenuButton: true.
- ScrollPane useRetractableScrollBars: false.
- ScrollPane
- useRetractableScrollBars: false.
"Rounded corners." Morph preferredCornerRadius: 8. SystemWindow roundedWindowCorners: false. DialogWindow roundedDialogCorners: false. MenuMorph roundedMenuCorners: false. PluggableButtonMorph roundedButtonCorners: false. ScrollBar roundedScrollBarLook: false. "Gradients." SystemWindow gradientWindow: false. DialogWindow gradientDialog: false. MenuMorph gradientMenu: false. PluggableButtonMorph gradientButton: false. ScrollBar gradientScrollBar: false.
"Shadows" Preferences enable: #menuAppearance3d. Morph useSoftDropShadow: true. "Lists and Trees" PluggableListMorph filterableLists: true; clearFilterAutomatically: false; clearFilterDelay: 500; highlightHoveredRow: true; highlightPreSelection: false; menuRequestUpdatesSelection: true. PluggableTreeMorph filterByLabelsOnly: false; maximumSearchDepth: 1. "Standard Tools" TheWorldMainDockingBar showWorldMainDockingBar: true; showSecondsInClock: true; twentyFourHourClock: true. SearchBar useSmartSearch: true. Workspace shouldStyle: false. TranscriptStream forceUpdate: true; redirectToStdOut: false; characterLimit: 20000. Browser listClassesHierarchically: true; showClassIcons: true; showMessageIcons: true; sortMessageCategoriesAlphabetically: true. SystemBrowser browseWithDragNDrop: true. MessageSet useUnifiedMessageLabels: true. Preferences enable: #annotationPanes;
- defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets);
- defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets);
enable: #optionalButtons; disable: #diffsWithPrettyPrint; enable: #traceMessages; enable: #alternativeBrowseIt; enable: #menuWithIcons; enable: #visualExplorer. Preferences disable: #debugLogTimestamp.
"Halo"
Preferences
- enable: #showBoundsInHalo;
- enable: #showBoundsInHalo ;
disable: #alternateHandlesLook; disable: #showDirectionHandles. Morph haloForAll: true; metaMenuForAll: true.
"System"
- NetNameResolver enableIPv6: true.
- NetNameResolver enableIPv6: false.
Scanner allowUnderscoreAsAssignment: true; prefAllowUnderscoreSelectors: true.
Deprecation showDeprecationWarnings: true
"that's all, folks"
TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) autoEnclose
- <preference: 'Auto enclose brackets () {} []'
- categoryList: #('Morphic' 'editing')
- description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.'
- type: #Boolean>
- ^ AutoEnclose ifNil: [ false ]
- ^ AutoEnclose ifNil: [#never]
TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed)
- autoEnclose: aBoolean
- AutoEnclose := aBoolean
- autoEnclose: aSymbol
- aSymbol == true ifTrue: [
- "backward compatibility."
- ^ self autoEnclose: #always].
- self assert: [#(always beforeSpaces never) includes: aSymbol].
- AutoEnclose := aSymbol.
TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48
- autoEncloseAlways
- <preference: 'Auto enclose all brackets () {} [] '''' "" || <>'
- categoryList: #('Morphic' 'editing')
- description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.'
- type: #Boolean>
- ^ self autoEnclose = #always
TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32
- autoEncloseAlways: aBoolean
- self autoEnclose: (aBoolean
- ifTrue: [#always]
- ifFalse: [#never]).
TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49
- autoEncloseBeforeSpaces
- <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>'
- categoryList: #('Morphic' 'editing')
- description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.'
- type: #Boolean>
- ^ self autoEnclose = #beforeSpaces
TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32
- autoEncloseBeforeSpaces: aBoolean
- self autoEnclose: (aBoolean
- ifTrue: [#beforeSpaces]
- ifFalse: [#never]).
TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) autoEncloseFor: typedChar "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." | openers closers |
- self class autoEnclose = #never
- ifTrue: [ ^ false ].
- (self class autoEnclose = #beforeSpaces
- ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ])
- ifFalse: [ ^ false ].
openers := '([{'. closers := ')]}'. (closers includes: typedChar) ifTrue: [ | pos | self blinkPrevParen: typedChar. ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) ifTrue: [ self moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] forward: true select: false. ^ true ] ifFalse: [ ^ false ] ]. (openers includes: typedChar) ifTrue: [ self openTypeIn; addString: typedChar asString; addString: (closers at: (openers indexOf: typedChar)) asString; insertAndCloseTypeIn; moveCursor: [ : position | position - 1 ] forward: false select: false. ^ true ]. ^ false
TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) dispatchOnKeyboardEvent: aKeyboardEvent "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." | honorCommandKeys typedChar | typedChar := aKeyboardEvent keyCharacter. "Handle one-line input fields." (typedChar == Character cr and: [morph acceptOnCR]) ifTrue: [^ true]. "Clear highlight for last opened parenthesis." self clearParens. "Handle line breaks and auto indent." typedChar == Character cr ifTrue: [ aKeyboardEvent controlKeyPressed ifTrue: [^ self normalCharacter: aKeyboardEvent]. aKeyboardEvent shiftPressed ifTrue: [^ self lf: aKeyboardEvent]. aKeyboardEvent commandKeyPressed ifTrue: [^ self crlf: aKeyboardEvent]. ^ self crWithIndent: aKeyboardEvent].
"Handle indent/outdent with selected text block." typedChar == Character tab ifTrue: [ aKeyboardEvent shiftPressed ifTrue: [self outdent: aKeyboardEvent. ^ true] ifFalse: [self hasMultipleLinesSelected ifTrue: [self indent: aKeyboardEvent. ^ true]]].
honorCommandKeys := Preferences cmdKeysInText.
(honorCommandKeys and: [typedChar == Character enter]) ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this conflict, assume that keys other than cursor keys aren't used together with Crtl." ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [aKeyboardEvent keyValue < 27]) ifTrue: [^ aKeyboardEvent controlKeyPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]]. "backspace, and escape keys (ascii 8 and 27) are command keys" ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) ifTrue: [ ^ aKeyboardEvent shiftPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]].
"the control key can be used to invoke shift-cmd shortcuts" (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent].
"Enclose selection with brackets etc." ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) ifTrue: [^ true].
"Automatically enclose paired characters such as brackets."
- (self class autoEnclose and: [self autoEncloseFor: typedChar])
- (self autoEncloseFor: typedChar)
ifTrue: [^ true]. "Even if no enclosing feature was used, highlight the matching bracket when closing one." (')]}' includes: typedChar) ifTrue: [self blinkPrevParen: typedChar]. self normalCharacter: aKeyboardEvent. ^ false
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote:
Hi Christoph,
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor.
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
I am not sure whether a single preference would fit everyone's needs.
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Thanks, Chris
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von mail@jaromir.net mail@jaromir.net Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev@lists.squeakfoundation.org; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
~~~ ^[^ -- Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T14:46:45+01:00, marcel.taeumel@hpi.de wrote:
Hi Chris, hi Christoph, hi Jaromir, hi all!
Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
Best, Marcel Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Hi Chris,
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
Yes, it does. :-)
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-)
Below the complete diff of the changeset for convenience, just because my new diff generators is so funny.
Best, Christoph
=============== Postscript ===============
"Postscript: Leave the line above, and replace the rest of this comment by a useful one. Executable statements should follow this comment, and should be separated by periods, with no exclamation points (!). Be sure to put any further comments in double-quotes, like this one."
TextEditor autoEnclose: TextEditor autoEnclose.
=============== Diff ===============
PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) initializePage03Interaction
| currentPage pane | currentPage := pages add: self createPage. pane := self createScrollPane. currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). currentPage addMorphBack: pane. pane scroller firstSubmorph addAllMorphsBack: { self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). self createVerticalSpace.
self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose).
self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose).
self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). self createVerticalSpace. self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). }.
PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19
- stateAutoEncloseAlways
^ TextEditor autoEncloseAlways
PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19
- stateAutoEncloseBeforeSpaces
^ TextEditor autoEncloseBeforeSpaces
PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20
- toggleAutoEncloseAlways
TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not.
self
changed: #stateAutoEncloseAlways;
changed: #stateAutoEncloseBeforeSpaces.
PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20
- toggleAutoEncloseBeforeSpaces
TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not.
self
changed: #stateAutoEncloseAlways;
changed: #stateAutoEncloseBeforeSpaces.
ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) setPreferences "Preferences class defaultValueTableForCurrentRelease"
" Preferences outOfTheBox."
"<-- uncomment after #defaultValueTableForCurrentRelease is fixed up."
"General User interaction"
- " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up."
Preferences"General User interaction"
enable: #generalizedYellowButtonMenu;
enable: #generalizedYellowButtonMenu ; enable: #swapMouseButtons; disable: #mouseOverForKeyboardFocus.
Morph indicateKeyboardFocus: true. Project uiManager openToolsAttachedToMouseCursor: false. SearchBar useScratchPad: false.
HandMorph sendMouseWheelToKeyboardFocus: false. HandMorph synthesizeMouseWheelEvents: true.
"Text input." TextEditor
autoEnclose: true;
autoIndent: true;
encloseSelection: false;
destructiveBackWord: false;
blinkingCursor: true;
dumbbellCursor: false.
autoEnclose: #beforeSpaces ;
autoIndent: true ;
encloseSelection: false ;
destructiveBackWord: false ;
blinkingCursor: true ;
PluggableTextMorph simpleFrameAdornments: false. TextMorphForEditView draggableTextSelection: true.dumbbellCursor: false.
"Windows"
SystemWindow reuseWindows: false. SystemWindow windowsRaiseOnClick: true. SystemWindow windowTitleActiveOnFirstClick: true."Windows"
Model windowActiveOnFirstClick: false.
"Not good for little screen real estate."
Model useColorfulWindows: false.
Preferences disable: #fastDragWindowForMorphic.
Model windowActiveOnFirstClick: false. "Not good for little screen real estate."
Model useColorfulWindows: false.
Preferences
AbstractResizerMorph gripThickness: 4; handleLength: 25. CornerGripMorph drawCornerResizeHandles: false; drawEdgeResizeHandles: false. ProportionalSplitterMorph showSplitterHandles: false; smartHorizontalSplitters: false; smartVerticalSplitters: false.disable: #fastDragWindowForMorphic.
- "Scroll bars." Preferences enable: #scrollBarsNarrow; enable: #scrollBarsOnRight; enable: #alwaysHideHScrollbar; disable: #alwaysShowHScrollbar; disable: #alwaysShowVScrollbar. ScrollBar scrollBarsWithoutArrowButtons: true; scrollBarsWithoutMenuButton: true.
ScrollPane useRetractableScrollBars: false.
ScrollPane
useRetractableScrollBars: false.
"Rounded corners." Morph preferredCornerRadius: 8. SystemWindow roundedWindowCorners: false. DialogWindow roundedDialogCorners: false. MenuMorph roundedMenuCorners: false. PluggableButtonMorph roundedButtonCorners: false. ScrollBar roundedScrollBarLook: false.
"Gradients." SystemWindow gradientWindow: false. DialogWindow gradientDialog: false. MenuMorph gradientMenu: false. PluggableButtonMorph gradientButton: false. ScrollBar gradientScrollBar: false.
"Shadows" Preferences enable: #menuAppearance3d. Morph useSoftDropShadow: true.
"Lists and Trees" PluggableListMorph filterableLists: true; clearFilterAutomatically: false; clearFilterDelay: 500; highlightHoveredRow: true; highlightPreSelection: false; menuRequestUpdatesSelection: true. PluggableTreeMorph filterByLabelsOnly: false; maximumSearchDepth: 1.
"Standard Tools" TheWorldMainDockingBar showWorldMainDockingBar: true; showSecondsInClock: true; twentyFourHourClock: true. SearchBar useSmartSearch: true. Workspace shouldStyle: false. TranscriptStream forceUpdate: true; redirectToStdOut: false; characterLimit: 20000. Browser listClassesHierarchically: true; showClassIcons: true; showMessageIcons: true; sortMessageCategoriesAlphabetically: true. SystemBrowser browseWithDragNDrop: true. MessageSet useUnifiedMessageLabels: true. Preferences enable: #annotationPanes;
defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets);
Preferences disable: #debugLogTimestamp.defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); enable: #optionalButtons; disable: #diffsWithPrettyPrint; enable: #traceMessages; enable: #alternativeBrowseIt; enable: #menuWithIcons; enable: #visualExplorer.
- "Halo"
- Preferences
enable: #showBoundsInHalo;
Morph haloForAll: true; metaMenuForAll: true.enable: #showBoundsInHalo ; disable: #alternateHandlesLook; disable: #showDirectionHandles.
- "System"
NetNameResolver enableIPv6: true.
Scanner allowUnderscoreAsAssignment: true; prefAllowUnderscoreSelectors: true.NetNameResolver enableIPv6: false.
- Deprecation showDeprecationWarnings: true
- "that's all, folks"
TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) autoEnclose
<preference: 'Auto enclose brackets () {} []'
categoryList: #('Morphic' 'editing')
description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.'
type: #Boolean>
^ AutoEnclose ifNil: [ false ]
^ AutoEnclose ifNil: [#never]
TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed)
- autoEnclose: aBoolean
AutoEnclose := aBoolean
- autoEnclose: aSymbol
aSymbol == true ifTrue: [
"backward compatibility."
^ self autoEnclose: #always].
self assert: [#(always beforeSpaces never) includes: aSymbol].
AutoEnclose := aSymbol.
TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48
- autoEncloseAlways
<preference: 'Auto enclose all brackets () {} [] '''' "" || <>'
categoryList: #('Morphic' 'editing')
description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.'
type: #Boolean>
^ self autoEnclose = #always
TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32
- autoEncloseAlways: aBoolean
self autoEnclose: (aBoolean
ifTrue: [#always]
ifFalse: [#never]).
TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49
- autoEncloseBeforeSpaces
<preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>'
categoryList: #('Morphic' 'editing')
description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.'
type: #Boolean>
^ self autoEnclose = #beforeSpaces
TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32
- autoEncloseBeforeSpaces: aBoolean
self autoEnclose: (aBoolean
ifTrue: [#beforeSpaces]
ifFalse: [#never]).
TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) autoEncloseFor: typedChar "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." | openers closers |
self class autoEnclose = #never
ifTrue: [ ^ false ].
(self class autoEnclose = #beforeSpaces
==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ])
ifFalse: [ ^ false ].
openers := '([{'. closers := ')]}'. (closers includes: typedChar) ifTrue: [ | pos | self blinkPrevParen: typedChar. ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) ifTrue: [ self moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] forward: true select: false. ^ true ] ifFalse: [ ^ false ] ]. (openers includes: typedChar) ifTrue: [ self openTypeIn; addString: typedChar asString; addString: (closers at: (openers indexOf: typedChar)) asString; insertAndCloseTypeIn;
moveCursor: [ : position | position - 1 ] forward: false select: false. ^ true ].
^ false
TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) dispatchOnKeyboardEvent: aKeyboardEvent "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."
| honorCommandKeys typedChar | typedChar := aKeyboardEvent keyCharacter. "Handle one-line input fields." (typedChar == Character cr and: [morph acceptOnCR]) ifTrue: [^ true]. "Clear highlight for last opened parenthesis." self clearParens. "Handle line breaks and auto indent." typedChar == Character cr ifTrue: [ aKeyboardEvent controlKeyPressed ifTrue: [^ self normalCharacter: aKeyboardEvent]. aKeyboardEvent shiftPressed ifTrue: [^ self lf: aKeyboardEvent]. aKeyboardEvent commandKeyPressed ifTrue: [^ self crlf: aKeyboardEvent]. ^ self crWithIndent: aKeyboardEvent]. "Handle indent/outdent with selected text block." typedChar == Character tab ifTrue: [ aKeyboardEvent shiftPressed ifTrue: [self outdent: aKeyboardEvent. ^ true] ifFalse: [self hasMultipleLinesSelected ifTrue: [self indent: aKeyboardEvent. ^ true]]]. honorCommandKeys := Preferences cmdKeysInText. (honorCommandKeys and: [typedChar == Character enter]) ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this conflict, assume that keys other than cursor keys aren't used together with Crtl." ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [aKeyboardEvent keyValue < 27]) ifTrue: [^ aKeyboardEvent controlKeyPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]]. "backspace, and escape keys (ascii 8 and 27) are command keys" ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) ifTrue: [ ^ aKeyboardEvent shiftPressed ifTrue: [self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent] ifFalse: [self perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]]. "the control key can be used to invoke shift-cmd shortcuts" (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [^ self perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) with: aKeyboardEvent]. "Enclose selection with brackets etc." ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) ifTrue: [^ true]. "Automatically enclose paired characters such as brackets."
(self class autoEnclose and: [self autoEncloseFor: typedChar])
(self autoEncloseFor: typedChar) ifTrue: [^ true].
"Even if no enclosing feature was used, highlight the matching bracket when closing one." (')]}' includes: typedChar) ifTrue: [self blinkPrevParen: typedChar].
self normalCharacter: aKeyboardEvent. ^ false
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote:
Hi Christoph,
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor.
Hopefully also when the cursor is at the end of the text, too (I didn't test it).
I am not sure whether a single preference would fit everyone's needs.
It seems like this feature should not disrupt expression-editing at all, which is what I made autoEnclose for.
Thanks, Chris
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > >
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Best, Christoph
________________________________ Von: mail@jaromir.net mail@jaromir.net Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 An: squeak-dev@lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > >
--==CelesteAttachment52793== Content-type: text/plain;charset=UTF-8
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Thanks for your confidence :D Please check the logic in the enclosed fileout. Both opening and closing brackets on a selection enclose the selection with the first lever brackets; on higher levels opening brackets add and closing brackets remove one level...
The code needs polishing if agreed.
Best,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:57:16+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Best, Christoph
Von: mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} B7 ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} B7 ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} B7 ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} B7 ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} B7 ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} B7 ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} B7 ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} B7 ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} B7 ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} B7 ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
Hi Jaromir,
thanks for the patch! The only thing that has attracted my attention is that when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
Regarding code polishing, as both ifFalse blocks are identical, it should be possible to insert "closing not and: [" to the outer condition instead. Very minor. :-)
Best,
Christoph
________________________________ Von: mail@jaromir.net mail@jaromir.net Gesendet: Mittwoch, 1. Dezember 2021 21:03:22 An: squeak-dev@lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Thanks for your confidence :D Please check the logic in the enclosed fileout. Both opening and closing brackets on a selection enclose the selection with the first lever brackets; on higher levels opening brackets add and closing brackets remove one level...
The code needs polishing if agreed.
Best,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:57:16+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Best, Christoph
Von: mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} B7 ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} B7 ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} B7 ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} B7 ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} B7 ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} B7 ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} B7 ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} B7 ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} B7 ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} B7 ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
--==CelesteAttachment10027== Content-type: text/plain;charset=UTF-8
Hi Christoph,
I cleaned the condition - see the enclosed changeset.
[...] when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
(Selecting 1+2+3 inside (1+2+3) and pressing ) strips the outer parentheses.)
Thanks,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T21:28:00+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Jaromir,
thanks for the patch! The only thing that has attracted my attention is that when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
Regarding code polishing, as both ifFalse blocks are identical, it should be possible to insert "closing not and: [" to the outer condition instead. Very minor. :-)
Best,
Christoph
Von: mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 21:03:22 An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Thanks for your confidence :D Please check the logic in the enclosed fileout. Both opening and closing brackets on a selection enclose the selection with the first lever brackets; on higher levels opening brackets add and closing brackets remove one level...
The code needs polishing if agreed.
Best,
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:57:16+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > Genious! Would you like to implement this by yourself? :-) > > Best, > Christoph > > ________________________________ > Von: mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 > An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph > Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs > > Hi Christoph, > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. > > Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird). > > > Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > Thanks > > ~~~ > ^[^ Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > > Hi Marcel, hi Jaromir, > > > > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > > > > Best, > > > > Christoph > > > > ________________________________ > > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > > > Hi Marcel, > > > > > Please find attached another take on this idea. No extra preference. > > > > ... more than happy :) > > > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > Thanks, > > > > > > ~~~ > > ^[^ > > -- Jaromir > > > > Sent from Squeak Inbox Talk > > > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > > > Best, > > > Marcel > > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > > Hi Chris, > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > > > Yes, it does. :-) > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > > > Best, > > > Christoph > > > > > > > > > =============== Postscript =============== > > > > > > "Postscript: > > > Leave the line above, and replace the rest of this comment by a useful one. > > > Executable statements should follow this comment, and should > > > be separated by periods, with no exclamation points (!). > > > Be sure to put any further comments in double-quotes, like this one." > > > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > > > =============== Diff =============== > > > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} B7 ct 11/1/2021 20:19 (changed) > > > initializePage03Interaction > > > > > > | currentPage pane | > > > currentPage := pages add: self createPage. > > > pane := self createScrollPane. > > > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > > currentPage addMorphBack: pane. > > > > > > pane scroller firstSubmorph addAllMorphsBack: { > > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > > self createVerticalSpace. > > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > > self createVerticalSpace. > > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > > > }. > > > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:19 > > > + stateAutoEncloseAlways > > > + > > > + ^ TextEditor autoEncloseAlways > > > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:19 > > > + stateAutoEncloseBeforeSpaces > > > + > > > + ^ TextEditor autoEncloseBeforeSpaces > > > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:20 > > > + toggleAutoEncloseAlways > > > + > > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:20 > > > + toggleAutoEncloseBeforeSpaces > > > + > > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > ReleaseBuilder class>>setPreferences {scripts} B7 ct 11/1/2021 20:18 (changed) > > > setPreferences > > > "Preferences class defaultValueTableForCurrentRelease" > > > - " Preferences outOfTheBox." > > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > - "General User interaction" > > > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > + > > > + "General User interaction" > > > Preferences > > > - enable: #generalizedYellowButtonMenu; > > > + enable: #generalizedYellowButtonMenu ; > > > enable: #swapMouseButtons; > > > disable: #mouseOverForKeyboardFocus. > > > Morph indicateKeyboardFocus: true. > > > Project uiManager openToolsAttachedToMouseCursor: false. > > > SearchBar useScratchPad: false. > > > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > > HandMorph synthesizeMouseWheelEvents: true. > > > > > > "Text input." > > > TextEditor > > > - autoEnclose: true; > > > - autoIndent: true; > > > - encloseSelection: false; > > > - destructiveBackWord: false; > > > - blinkingCursor: true; > > > - dumbbellCursor: false. > > > + autoEnclose: #beforeSpaces ; > > > + autoIndent: true ; > > > + encloseSelection: false ; > > > + destructiveBackWord: false ; > > > + blinkingCursor: true ; > > > + dumbbellCursor: false. > > > PluggableTextMorph simpleFrameAdornments: false. > > > TextMorphForEditView draggableTextSelection: true. > > > - "Windows" > > > > > > + "Windows" > > > SystemWindow reuseWindows: false. > > > SystemWindow windowsRaiseOnClick: true. > > > SystemWindow windowTitleActiveOnFirstClick: true. > > > - Model windowActiveOnFirstClick: false. > > > - "Not good for little screen real estate." > > > - Model useColorfulWindows: false. > > > - > > > - Preferences disable: #fastDragWindowForMorphic. > > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > > + Model useColorfulWindows: false. > > > + > > > + Preferences > > > + disable: #fastDragWindowForMorphic. > > > AbstractResizerMorph > > > gripThickness: 4; > > > handleLength: 25. > > > CornerGripMorph > > > drawCornerResizeHandles: false; > > > drawEdgeResizeHandles: false. > > > ProportionalSplitterMorph > > > showSplitterHandles: false; > > > smartHorizontalSplitters: false; > > > smartVerticalSplitters: false. > > > - > > > + > > > "Scroll bars." > > > Preferences > > > enable: #scrollBarsNarrow; > > > enable: #scrollBarsOnRight; > > > enable: #alwaysHideHScrollbar; > > > disable: #alwaysShowHScrollbar; > > > disable: #alwaysShowVScrollbar. > > > ScrollBar > > > scrollBarsWithoutArrowButtons: true; > > > scrollBarsWithoutMenuButton: true. > > > - ScrollPane useRetractableScrollBars: false. > > > - > > > + ScrollPane > > > + useRetractableScrollBars: false. > > > + > > > "Rounded corners." > > > Morph preferredCornerRadius: 8. > > > SystemWindow roundedWindowCorners: false. > > > DialogWindow roundedDialogCorners: false. > > > MenuMorph roundedMenuCorners: false. > > > PluggableButtonMorph roundedButtonCorners: false. > > > ScrollBar roundedScrollBarLook: false. > > > > > > "Gradients." > > > SystemWindow gradientWindow: false. > > > DialogWindow gradientDialog: false. > > > MenuMorph gradientMenu: false. > > > PluggableButtonMorph gradientButton: false. > > > ScrollBar gradientScrollBar: false. > > > - > > > + > > > "Shadows" > > > Preferences enable: #menuAppearance3d. > > > Morph useSoftDropShadow: true. > > > > > > "Lists and Trees" > > > PluggableListMorph > > > filterableLists: true; > > > clearFilterAutomatically: false; > > > clearFilterDelay: 500; > > > highlightHoveredRow: true; > > > highlightPreSelection: false; > > > menuRequestUpdatesSelection: true. > > > PluggableTreeMorph > > > filterByLabelsOnly: false; > > > maximumSearchDepth: 1. > > > > > > "Standard Tools" > > > TheWorldMainDockingBar > > > showWorldMainDockingBar: true; > > > showSecondsInClock: true; > > > twentyFourHourClock: true. > > > SearchBar useSmartSearch: true. > > > Workspace shouldStyle: false. > > > TranscriptStream > > > forceUpdate: true; > > > redirectToStdOut: false; > > > characterLimit: 20000. > > > Browser > > > listClassesHierarchically: true; > > > showClassIcons: true; > > > showMessageIcons: true; > > > sortMessageCategoriesAlphabetically: true. > > > SystemBrowser browseWithDragNDrop: true. > > > MessageSet useUnifiedMessageLabels: true. > > > Preferences > > > enable: #annotationPanes; > > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > > enable: #optionalButtons; > > > disable: #diffsWithPrettyPrint; > > > enable: #traceMessages; > > > enable: #alternativeBrowseIt; > > > enable: #menuWithIcons; > > > enable: #visualExplorer. > > > Preferences disable: #debugLogTimestamp. > > > + > > > "Halo" > > > - > > > Preferences > > > - enable: #showBoundsInHalo; > > > + enable: #showBoundsInHalo ; > > > disable: #alternateHandlesLook; > > > disable: #showDirectionHandles. > > > Morph > > > haloForAll: true; > > > metaMenuForAll: true. > > > - > > > + > > > "System" > > > - NetNameResolver enableIPv6: true. > > > + NetNameResolver enableIPv6: false. > > > Scanner > > > allowUnderscoreAsAssignment: true; > > > prefAllowUnderscoreSelectors: true. > > > - > > > + > > > Deprecation showDeprecationWarnings: true > > > + > > > "that's all, folks" > > > > > > TextEditor class>>autoEnclose {preferences} B7 ct 11/1/2021 20:26 (changed) > > > autoEnclose > > > - <preference: 'Auto enclose brackets () {} []' > > > - categoryList: #('Morphic' 'editing') > > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > > - type: #Boolean> > > > - > > > - ^ AutoEnclose ifNil: [ false ] > > > + > > > + ^ AutoEnclose ifNil: [#never] > > > > > > TextEditor class>>autoEnclose: {preferences} B7 ct 11/1/2021 20:30 (changed) > > > - autoEnclose: aBoolean > > > - AutoEnclose := aBoolean > > > + autoEnclose: aSymbol > > > + > > > + aSymbol == true ifTrue: [ > > > + "backward compatibility." > > > + ^ self autoEnclose: #always]. > > > + > > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > > + > > > + AutoEnclose := aSymbol. > > > > > > TextEditor class>>autoEncloseAlways {preferences} B7 ct 11/1/2021 21:48 > > > + autoEncloseAlways > > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #always > > > > > > TextEditor class>>autoEncloseAlways: {preferences} B7 ct 11/1/2021 20:32 > > > + autoEncloseAlways: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#always] > > > + ifFalse: [#never]). > > > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} B7 ct 11/1/2021 21:49 > > > + autoEncloseBeforeSpaces > > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #beforeSpaces > > > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} B7 ct 11/1/2021 20:32 > > > + autoEncloseBeforeSpaces: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#beforeSpaces] > > > + ifFalse: [#never]). > > > > > > TextEditor>>autoEncloseFor: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > autoEncloseFor: typedChar > > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > > | openers closers | > > > + self class autoEnclose = #never > > > + ifTrue: [ ^ false ]. > > > + (self class autoEnclose = #beforeSpaces > > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > > + ifFalse: [ ^ false ]. > > > + > > > openers := '([{'. > > > closers := ')]}'. > > > (closers includes: typedChar) ifTrue: > > > [ | pos | > > > self blinkPrevParen: typedChar. > > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > > ifTrue: > > > [ self > > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > > forward: true > > > select: false. > > > ^ true ] > > > ifFalse: [ ^ false ] ]. > > > (openers includes: typedChar) ifTrue: > > > [ self > > > openTypeIn; > > > addString: typedChar asString; > > > addString: (closers at: (openers indexOf: typedChar)) asString; > > > insertAndCloseTypeIn; > > > > > > moveCursor: [ : position | position - 1 ] > > > forward: false > > > select: false. > > > ^ true ]. > > > ^ false > > > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > dispatchOnKeyboardEvent: aKeyboardEvent > > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > > > | honorCommandKeys typedChar | > > > typedChar := aKeyboardEvent keyCharacter. > > > > > > "Handle one-line input fields." > > > (typedChar == Character cr and: [morph acceptOnCR]) > > > ifTrue: [^ true]. > > > > > > "Clear highlight for last opened parenthesis." > > > self clearParens. > > > > > > "Handle line breaks and auto indent." > > > typedChar == Character cr ifTrue: [ > > > aKeyboardEvent controlKeyPressed > > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > > aKeyboardEvent shiftPressed > > > ifTrue: [^ self lf: aKeyboardEvent]. > > > aKeyboardEvent commandKeyPressed > > > ifTrue: [^ self crlf: aKeyboardEvent]. > > > ^ self crWithIndent: aKeyboardEvent]. > > > > > > "Handle indent/outdent with selected text block." > > > typedChar == Character tab ifTrue: [ > > > aKeyboardEvent shiftPressed > > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > > ifFalse: [self hasMultipleLinesSelected > > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > > > (honorCommandKeys and: [typedChar == Character enter]) > > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > > and: [aKeyboardEvent keyValue < 27]) > > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "the control key can be used to invoke shift-cmd shortcuts" > > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > > ifTrue: [^ self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]. > > > > > > "Enclose selection with brackets etc." > > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > > ifTrue: [^ true]. > > > > > > "Automatically enclose paired characters such as brackets." > > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > > + (self autoEncloseFor: typedChar) > > > ifTrue: [^ true]. > > > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > > (')]}' includes: typedChar) > > > ifTrue: [self blinkPrevParen: typedChar]. > > > > > > self normalCharacter: aKeyboardEvent. > > > ^ false > > > > > > --- > > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > > > Hi Christoph, > > > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > > having inserted enclosing brackets always, you can now activate a new > > > > > preference to only insert these characters if there is any space after the > > > > > cursor. > > > > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > > test it). > > > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > > > Thanks, > > > > Chris > > > >
Hi Jaromir,
thank you for Morphic-jar.1815, it looks really nice.
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
You are right, it would change the semantics. But it could also be more convenient. :-) If the selection is not enclosed by inclusive brackets, check the exclusive adjacent characters for brackets instead. Do you think we should give this a try or would you consider this a too disrupting change?
By the way, we could also discuss whether pressing a closing bracket on a bracket-free selection should really add new brackets. It feels a bit inconsistent as opposed to the behavior with at least one bracket. Alternatively, you could also return false in this case.
One last note: In my image, I have changed the condition like this:
((startIndex > 1 and: [stopIndex <= t size]) and: [ (t at: startIndex-1) = left and: [(t at: stopIndex) = right]] - and: [closingBracket]) + and: [closingBracket or: [left = right]])
so that you can also un-enclose quoted strings again. :)
Best, Christoph
________________________________ Von: mail@jaromir.net mail@jaromir.net Gesendet: Mittwoch, 1. Dezember 2021 22:52:31 An: squeak-dev@lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
I cleaned the condition - see the enclosed changeset.
[...] when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
(Selecting 1+2+3 inside (1+2+3) and pressing ) strips the outer parentheses.)
Thanks,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T21:28:00+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Jaromir,
thanks for the patch! The only thing that has attracted my attention is that when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
Regarding code polishing, as both ifFalse blocks are identical, it should be possible to insert "closing not and: [" to the outer condition instead. Very minor. :-)
Best,
Christoph
Von: mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 21:03:22 An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
Genious! Would you like to implement this by yourself? :-)
Thanks for your confidence :D Please check the logic in the enclosed fileout. Both opening and closing brackets on a selection enclose the selection with the first lever brackets; on higher levels opening brackets add and closing brackets remove one level...
The code needs polishing if agreed.
Best,
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:57:16+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > Genious! Would you like to implement this by yourself? :-) > > Best, > Christoph > > ________________________________ > Von: mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 > An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph > Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs > > Hi Christoph, > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. > > Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird). > > > Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > Thanks > > ~~~ > ^[^ Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > > Hi Marcel, hi Jaromir, > > > > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > > > > Best, > > > > Christoph > > > > ________________________________ > > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > > > Hi Marcel, > > > > > Please find attached another take on this idea. No extra preference. > > > > ... more than happy :) > > > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > Thanks, > > > > > > ~~~ > > ^[^ > > -- Jaromir > > > > Sent from Squeak Inbox Talk > > > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > > > Best, > > > Marcel > > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > > Hi Chris, > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > > > Yes, it does. :-) > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > > > Best, > > > Christoph > > > > > > > > > =============== Postscript =============== > > > > > > "Postscript: > > > Leave the line above, and replace the rest of this comment by a useful one. > > > Executable statements should follow this comment, and should > > > be separated by periods, with no exclamation points (!). > > > Be sure to put any further comments in double-quotes, like this one." > > > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > > > =============== Diff =============== > > > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} B7 ct 11/1/2021 20:19 (changed) > > > initializePage03Interaction > > > > > > | currentPage pane | > > > currentPage := pages add: self createPage. > > > pane := self createScrollPane. > > > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > > currentPage addMorphBack: pane. > > > > > > pane scroller firstSubmorph addAllMorphsBack: { > > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > > self createVerticalSpace. > > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > > self createVerticalSpace. > > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > > > }. > > > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:19 > > > + stateAutoEncloseAlways > > > + > > > + ^ TextEditor autoEncloseAlways > > > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:19 > > > + stateAutoEncloseBeforeSpaces > > > + > > > + ^ TextEditor autoEncloseBeforeSpaces > > > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:20 > > > + toggleAutoEncloseAlways > > > + > > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:20 > > > + toggleAutoEncloseBeforeSpaces > > > + > > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > ReleaseBuilder class>>setPreferences {scripts} B7 ct 11/1/2021 20:18 (changed) > > > setPreferences > > > "Preferences class defaultValueTableForCurrentRelease" > > > - " Preferences outOfTheBox." > > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > - "General User interaction" > > > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > + > > > + "General User interaction" > > > Preferences > > > - enable: #generalizedYellowButtonMenu; > > > + enable: #generalizedYellowButtonMenu ; > > > enable: #swapMouseButtons; > > > disable: #mouseOverForKeyboardFocus. > > > Morph indicateKeyboardFocus: true. > > > Project uiManager openToolsAttachedToMouseCursor: false. > > > SearchBar useScratchPad: false. > > > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > > HandMorph synthesizeMouseWheelEvents: true. > > > > > > "Text input." > > > TextEditor > > > - autoEnclose: true; > > > - autoIndent: true; > > > - encloseSelection: false; > > > - destructiveBackWord: false; > > > - blinkingCursor: true; > > > - dumbbellCursor: false. > > > + autoEnclose: #beforeSpaces ; > > > + autoIndent: true ; > > > + encloseSelection: false ; > > > + destructiveBackWord: false ; > > > + blinkingCursor: true ; > > > + dumbbellCursor: false. > > > PluggableTextMorph simpleFrameAdornments: false. > > > TextMorphForEditView draggableTextSelection: true. > > > - "Windows" > > > > > > + "Windows" > > > SystemWindow reuseWindows: false. > > > SystemWindow windowsRaiseOnClick: true. > > > SystemWindow windowTitleActiveOnFirstClick: true. > > > - Model windowActiveOnFirstClick: false. > > > - "Not good for little screen real estate." > > > - Model useColorfulWindows: false. > > > - > > > - Preferences disable: #fastDragWindowForMorphic. > > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > > + Model useColorfulWindows: false. > > > + > > > + Preferences > > > + disable: #fastDragWindowForMorphic. > > > AbstractResizerMorph > > > gripThickness: 4; > > > handleLength: 25. > > > CornerGripMorph > > > drawCornerResizeHandles: false; > > > drawEdgeResizeHandles: false. > > > ProportionalSplitterMorph > > > showSplitterHandles: false; > > > smartHorizontalSplitters: false; > > > smartVerticalSplitters: false. > > > - > > > + > > > "Scroll bars." > > > Preferences > > > enable: #scrollBarsNarrow; > > > enable: #scrollBarsOnRight; > > > enable: #alwaysHideHScrollbar; > > > disable: #alwaysShowHScrollbar; > > > disable: #alwaysShowVScrollbar. > > > ScrollBar > > > scrollBarsWithoutArrowButtons: true; > > > scrollBarsWithoutMenuButton: true. > > > - ScrollPane useRetractableScrollBars: false. > > > - > > > + ScrollPane > > > + useRetractableScrollBars: false. > > > + > > > "Rounded corners." > > > Morph preferredCornerRadius: 8. > > > SystemWindow roundedWindowCorners: false. > > > DialogWindow roundedDialogCorners: false. > > > MenuMorph roundedMenuCorners: false. > > > PluggableButtonMorph roundedButtonCorners: false. > > > ScrollBar roundedScrollBarLook: false. > > > > > > "Gradients." > > > SystemWindow gradientWindow: false. > > > DialogWindow gradientDialog: false. > > > MenuMorph gradientMenu: false. > > > PluggableButtonMorph gradientButton: false. > > > ScrollBar gradientScrollBar: false. > > > - > > > + > > > "Shadows" > > > Preferences enable: #menuAppearance3d. > > > Morph useSoftDropShadow: true. > > > > > > "Lists and Trees" > > > PluggableListMorph > > > filterableLists: true; > > > clearFilterAutomatically: false; > > > clearFilterDelay: 500; > > > highlightHoveredRow: true; > > > highlightPreSelection: false; > > > menuRequestUpdatesSelection: true. > > > PluggableTreeMorph > > > filterByLabelsOnly: false; > > > maximumSearchDepth: 1. > > > > > > "Standard Tools" > > > TheWorldMainDockingBar > > > showWorldMainDockingBar: true; > > > showSecondsInClock: true; > > > twentyFourHourClock: true. > > > SearchBar useSmartSearch: true. > > > Workspace shouldStyle: false. > > > TranscriptStream > > > forceUpdate: true; > > > redirectToStdOut: false; > > > characterLimit: 20000. > > > Browser > > > listClassesHierarchically: true; > > > showClassIcons: true; > > > showMessageIcons: true; > > > sortMessageCategoriesAlphabetically: true. > > > SystemBrowser browseWithDragNDrop: true. > > > MessageSet useUnifiedMessageLabels: true. > > > Preferences > > > enable: #annotationPanes; > > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > > enable: #optionalButtons; > > > disable: #diffsWithPrettyPrint; > > > enable: #traceMessages; > > > enable: #alternativeBrowseIt; > > > enable: #menuWithIcons; > > > enable: #visualExplorer. > > > Preferences disable: #debugLogTimestamp. > > > + > > > "Halo" > > > - > > > Preferences > > > - enable: #showBoundsInHalo; > > > + enable: #showBoundsInHalo ; > > > disable: #alternateHandlesLook; > > > disable: #showDirectionHandles. > > > Morph > > > haloForAll: true; > > > metaMenuForAll: true. > > > - > > > + > > > "System" > > > - NetNameResolver enableIPv6: true. > > > + NetNameResolver enableIPv6: false. > > > Scanner > > > allowUnderscoreAsAssignment: true; > > > prefAllowUnderscoreSelectors: true. > > > - > > > + > > > Deprecation showDeprecationWarnings: true > > > + > > > "that's all, folks" > > > > > > TextEditor class>>autoEnclose {preferences} B7 ct 11/1/2021 20:26 (changed) > > > autoEnclose > > > - <preference: 'Auto enclose brackets () {} []' > > > - categoryList: #('Morphic' 'editing') > > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > > - type: #Boolean> > > > - > > > - ^ AutoEnclose ifNil: [ false ] > > > + > > > + ^ AutoEnclose ifNil: [#never] > > > > > > TextEditor class>>autoEnclose: {preferences} B7 ct 11/1/2021 20:30 (changed) > > > - autoEnclose: aBoolean > > > - AutoEnclose := aBoolean > > > + autoEnclose: aSymbol > > > + > > > + aSymbol == true ifTrue: [ > > > + "backward compatibility." > > > + ^ self autoEnclose: #always]. > > > + > > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > > + > > > + AutoEnclose := aSymbol. > > > > > > TextEditor class>>autoEncloseAlways {preferences} B7 ct 11/1/2021 21:48 > > > + autoEncloseAlways > > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #always > > > > > > TextEditor class>>autoEncloseAlways: {preferences} B7 ct 11/1/2021 20:32 > > > + autoEncloseAlways: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#always] > > > + ifFalse: [#never]). > > > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} B7 ct 11/1/2021 21:49 > > > + autoEncloseBeforeSpaces > > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #beforeSpaces > > > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} B7 ct 11/1/2021 20:32 > > > + autoEncloseBeforeSpaces: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#beforeSpaces] > > > + ifFalse: [#never]). > > > > > > TextEditor>>autoEncloseFor: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > autoEncloseFor: typedChar > > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > > | openers closers | > > > + self class autoEnclose = #never > > > + ifTrue: [ ^ false ]. > > > + (self class autoEnclose = #beforeSpaces > > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > > + ifFalse: [ ^ false ]. > > > + > > > openers := '([{'. > > > closers := ')]}'. > > > (closers includes: typedChar) ifTrue: > > > [ | pos | > > > self blinkPrevParen: typedChar. > > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > > ifTrue: > > > [ self > > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > > forward: true > > > select: false. > > > ^ true ] > > > ifFalse: [ ^ false ] ]. > > > (openers includes: typedChar) ifTrue: > > > [ self > > > openTypeIn; > > > addString: typedChar asString; > > > addString: (closers at: (openers indexOf: typedChar)) asString; > > > insertAndCloseTypeIn; > > > > > > moveCursor: [ : position | position - 1 ] > > > forward: false > > > select: false. > > > ^ true ]. > > > ^ false > > > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > dispatchOnKeyboardEvent: aKeyboardEvent > > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > > > | honorCommandKeys typedChar | > > > typedChar := aKeyboardEvent keyCharacter. > > > > > > "Handle one-line input fields." > > > (typedChar == Character cr and: [morph acceptOnCR]) > > > ifTrue: [^ true]. > > > > > > "Clear highlight for last opened parenthesis." > > > self clearParens. > > > > > > "Handle line breaks and auto indent." > > > typedChar == Character cr ifTrue: [ > > > aKeyboardEvent controlKeyPressed > > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > > aKeyboardEvent shiftPressed > > > ifTrue: [^ self lf: aKeyboardEvent]. > > > aKeyboardEvent commandKeyPressed > > > ifTrue: [^ self crlf: aKeyboardEvent]. > > > ^ self crWithIndent: aKeyboardEvent]. > > > > > > "Handle indent/outdent with selected text block." > > > typedChar == Character tab ifTrue: [ > > > aKeyboardEvent shiftPressed > > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > > ifFalse: [self hasMultipleLinesSelected > > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > > > (honorCommandKeys and: [typedChar == Character enter]) > > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > > and: [aKeyboardEvent keyValue < 27]) > > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "the control key can be used to invoke shift-cmd shortcuts" > > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > > ifTrue: [^ self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]. > > > > > > "Enclose selection with brackets etc." > > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > > ifTrue: [^ true]. > > > > > > "Automatically enclose paired characters such as brackets." > > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > > + (self autoEncloseFor: typedChar) > > > ifTrue: [^ true]. > > > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > > (')]}' includes: typedChar) > > > ifTrue: [self blinkPrevParen: typedChar]. > > > > > > self normalCharacter: aKeyboardEvent. > > > ^ false > > > > > > --- > > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > > > Hi Christoph, > > > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > > having inserted enclosing brackets always, you can now activate a new > > > > > preference to only insert these characters if there is any space after the > > > > > cursor. > > > > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > > test it). > > > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > > > Thanks, > > > > Chris > > > >
Hi Christoph,,
This was my first Morphic fix so I just changed the bare minimum to get the job done :)
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
You are right, it would change the semantics. But it could also be more convenient. :-) If the selection is not enclosed by inclusive brackets, check the exclusive adjacent characters for brackets instead. Do you think we should give this a try or would you consider this a too disrupting change?
By the way, we could also discuss whether pressing a closing bracket on a bracket-free selection should really add new brackets. It feels a bit inconsistent as opposed to the behavior with at least one bracket. Alternatively, you could also return false in this case.
Honestly - whatever you find most useful, I don't have a preference/enough experience - please feel free to modify it; this version required minimum changes and I found the toggling effect amusing :)
One last note: In my image, I have changed the condition like this:
((startIndex > 1 and: [stopIndex <= t size]) and: [ (t at: startIndex-1) = left and: [(t at: stopIndex) = right]]
- and: [closingBracket])
- and: [closingBracket or: [left = right]])
so that you can also un-enclose quoted strings again. :)
Ha, that's a good one :) Unless you ever want to double quote - have you ever needed double quotes? Like "commenting" inside a comment? Does it makes sense?
Thanks,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-06T20:45:27+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Jaromir,
thank you for Morphic-jar.1815, it looks really nice.
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
You are right, it would change the semantics. But it could also be more convenient. :-) If the selection is not enclosed by inclusive brackets, check the exclusive adjacent characters for brackets instead. Do you think we should give this a try or would you consider this a too disrupting change?
By the way, we could also discuss whether pressing a closing bracket on a bracket-free selection should really add new brackets. It feels a bit inconsistent as opposed to the behavior with at least one bracket. Alternatively, you could also return false in this case.
One last note: In my image, I have changed the condition like this:
((startIndex > 1 and: [stopIndex <= t size]) and: [ (t at: startIndex-1) = left and: [(t at: stopIndex) = right]]
- and: [closingBracket])
- and: [closingBracket or: [left = right]])
so that you can also un-enclose quoted strings again. :)
Best, Christoph
Von: mail at jaromir.net <mail at jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 22:52:31 An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
I cleaned the condition - see the enclosed changeset.
[...] when I select a full line like this
(1+2+3)
I cannot type $) to remove the outer brackets. Could we change that, too?
I'm not sure what you mean... Like if you select a whole line beginning and ending with matching brackets you'd like to strip the brackets even if they are inside the selection? That would change the semantics of enclosing (or de-enclosing) *a selection* :) If that's what you meant...?
(Selecting 1+2+3 inside (1+2+3) and pressing ) strips the outer parentheses.)
Thanks,
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T21:28:00+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > Hi Jaromir, > > > thanks for the patch! The only thing that has attracted my attention is that when I select a full line like this > > > (1+2+3) > > > I cannot type $) to remove the outer brackets. Could we change that, too? > > > Regarding code polishing, as both ifFalse blocks are identical, it should be possible to insert "closing not and: [" to the outer condition instead. Very minor. :-) > > > Best, > > Christoph > > ________________________________ > Von: mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 21:03:22 > An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph > Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs > > > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > > > Genious! Would you like to implement this by yourself? :-) > > > Thanks for your confidence :D Please check the logic in the enclosed fileout. Both opening and closing brackets on a selection enclose the selection with the first lever brackets; on higher levels opening brackets add and closing brackets remove one level... > > The code needs polishing if agreed. > > Best, > > ~~~ > ^[^ Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T19:57:16+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > > > Genious! Would you like to implement this by yourself? :-) > > > > Best, > > Christoph > > > > ________________________________ > > Von: mail at jaromir.net <mail at jaromir.net> > > Gesendet: Mittwoch, 1. Dezember 2021 20:24:44 > > An: squeak-dev at lists.squeakfoundation.org; Thiede, Christoph > > Betreff: Re: Merge Request: autoEncloseBeforeSpace.cs > > > > Hi Christoph, > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. > > > > Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird). > > > > > Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... > > > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level? > > > > Thanks > > > > ~~~ > > ^[^ Jaromir > > > > Sent from Squeak Inbox Talk > > > > On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > > > > > Hi Marcel, hi Jaromir, > > > > > > > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > > > > > > > Best, > > > > > > Christoph > > > > > > ________________________________ > > > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > > > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > > > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > > > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > > > > > Hi Marcel, > > > > > > > Please find attached another take on this idea. No extra preference. > > > > > > ... more than happy :) > > > > > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > Thanks, > > > > > > > > > ~~~ > > > ^[^ > > > -- Jaromir > > > > > > Sent from Squeak Inbox Talk > > > > > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > > > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > > > > > Best, > > > > Marcel > > > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > > > Hi Chris, > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > > > > > Yes, it does. :-) > > > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > > which is what I made autoEnclose for. > > > > > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > > > > > Best, > > > > Christoph > > > > > > > > > > > > =============== Postscript =============== > > > > > > > > "Postscript: > > > > Leave the line above, and replace the rest of this comment by a useful one. > > > > Executable statements should follow this comment, and should > > > > be separated by periods, with no exclamation points (!). > > > > Be sure to put any further comments in double-quotes, like this one." > > > > > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > > > > > =============== Diff =============== > > > > > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} B7 ct 11/1/2021 20:19 (changed) > > > > initializePage03Interaction > > > > > > > > | currentPage pane | > > > > currentPage := pages add: self createPage. > > > > pane := self createScrollPane. > > > > > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > > > currentPage addMorphBack: pane. > > > > > > > > pane scroller firstSubmorph addAllMorphsBack: { > > > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > > > self createVerticalSpace. > > > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > > > self createVerticalSpace. > > > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > > > > > }. > > > > > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:19 > > > > + stateAutoEncloseAlways > > > > + > > > > + ^ TextEditor autoEncloseAlways > > > > > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:19 > > > > + stateAutoEncloseBeforeSpaces > > > > + > > > > + ^ TextEditor autoEncloseBeforeSpaces > > > > > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} B7 ct 11/1/2021 20:20 > > > > + toggleAutoEncloseAlways > > > > + > > > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > > > + self > > > > + changed: #stateAutoEncloseAlways; > > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} B7 ct 11/1/2021 20:20 > > > > + toggleAutoEncloseBeforeSpaces > > > > + > > > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > > > + self > > > > + changed: #stateAutoEncloseAlways; > > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > > > ReleaseBuilder class>>setPreferences {scripts} B7 ct 11/1/2021 20:18 (changed) > > > > setPreferences > > > > "Preferences class defaultValueTableForCurrentRelease" > > > > - " Preferences outOfTheBox." > > > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > > - "General User interaction" > > > > > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > > + > > > > + "General User interaction" > > > > Preferences > > > > - enable: #generalizedYellowButtonMenu; > > > > + enable: #generalizedYellowButtonMenu ; > > > > enable: #swapMouseButtons; > > > > disable: #mouseOverForKeyboardFocus. > > > > Morph indicateKeyboardFocus: true. > > > > Project uiManager openToolsAttachedToMouseCursor: false. > > > > SearchBar useScratchPad: false. > > > > > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > > > HandMorph synthesizeMouseWheelEvents: true. > > > > > > > > "Text input." > > > > TextEditor > > > > - autoEnclose: true; > > > > - autoIndent: true; > > > > - encloseSelection: false; > > > > - destructiveBackWord: false; > > > > - blinkingCursor: true; > > > > - dumbbellCursor: false. > > > > + autoEnclose: #beforeSpaces ; > > > > + autoIndent: true ; > > > > + encloseSelection: false ; > > > > + destructiveBackWord: false ; > > > > + blinkingCursor: true ; > > > > + dumbbellCursor: false. > > > > PluggableTextMorph simpleFrameAdornments: false. > > > > TextMorphForEditView draggableTextSelection: true. > > > > - "Windows" > > > > > > > > + "Windows" > > > > SystemWindow reuseWindows: false. > > > > SystemWindow windowsRaiseOnClick: true. > > > > SystemWindow windowTitleActiveOnFirstClick: true. > > > > - Model windowActiveOnFirstClick: false. > > > > - "Not good for little screen real estate." > > > > - Model useColorfulWindows: false. > > > > - > > > > - Preferences disable: #fastDragWindowForMorphic. > > > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > > > + Model useColorfulWindows: false. > > > > + > > > > + Preferences > > > > + disable: #fastDragWindowForMorphic. > > > > AbstractResizerMorph > > > > gripThickness: 4; > > > > handleLength: 25. > > > > CornerGripMorph > > > > drawCornerResizeHandles: false; > > > > drawEdgeResizeHandles: false. > > > > ProportionalSplitterMorph > > > > showSplitterHandles: false; > > > > smartHorizontalSplitters: false; > > > > smartVerticalSplitters: false. > > > > - > > > > + > > > > "Scroll bars." > > > > Preferences > > > > enable: #scrollBarsNarrow; > > > > enable: #scrollBarsOnRight; > > > > enable: #alwaysHideHScrollbar; > > > > disable: #alwaysShowHScrollbar; > > > > disable: #alwaysShowVScrollbar. > > > > ScrollBar > > > > scrollBarsWithoutArrowButtons: true; > > > > scrollBarsWithoutMenuButton: true. > > > > - ScrollPane useRetractableScrollBars: false. > > > > - > > > > + ScrollPane > > > > + useRetractableScrollBars: false. > > > > + > > > > "Rounded corners." > > > > Morph preferredCornerRadius: 8. > > > > SystemWindow roundedWindowCorners: false. > > > > DialogWindow roundedDialogCorners: false. > > > > MenuMorph roundedMenuCorners: false. > > > > PluggableButtonMorph roundedButtonCorners: false. > > > > ScrollBar roundedScrollBarLook: false. > > > > > > > > "Gradients." > > > > SystemWindow gradientWindow: false. > > > > DialogWindow gradientDialog: false. > > > > MenuMorph gradientMenu: false. > > > > PluggableButtonMorph gradientButton: false. > > > > ScrollBar gradientScrollBar: false. > > > > - > > > > + > > > > "Shadows" > > > > Preferences enable: #menuAppearance3d. > > > > Morph useSoftDropShadow: true. > > > > > > > > "Lists and Trees" > > > > PluggableListMorph > > > > filterableLists: true; > > > > clearFilterAutomatically: false; > > > > clearFilterDelay: 500; > > > > highlightHoveredRow: true; > > > > highlightPreSelection: false; > > > > menuRequestUpdatesSelection: true. > > > > PluggableTreeMorph > > > > filterByLabelsOnly: false; > > > > maximumSearchDepth: 1. > > > > > > > > "Standard Tools" > > > > TheWorldMainDockingBar > > > > showWorldMainDockingBar: true; > > > > showSecondsInClock: true; > > > > twentyFourHourClock: true. > > > > SearchBar useSmartSearch: true. > > > > Workspace shouldStyle: false. > > > > TranscriptStream > > > > forceUpdate: true; > > > > redirectToStdOut: false; > > > > characterLimit: 20000. > > > > Browser > > > > listClassesHierarchically: true; > > > > showClassIcons: true; > > > > showMessageIcons: true; > > > > sortMessageCategoriesAlphabetically: true. > > > > SystemBrowser browseWithDragNDrop: true. > > > > MessageSet useUnifiedMessageLabels: true. > > > > Preferences > > > > enable: #annotationPanes; > > > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > > > enable: #optionalButtons; > > > > disable: #diffsWithPrettyPrint; > > > > enable: #traceMessages; > > > > enable: #alternativeBrowseIt; > > > > enable: #menuWithIcons; > > > > enable: #visualExplorer. > > > > Preferences disable: #debugLogTimestamp. > > > > + > > > > "Halo" > > > > - > > > > Preferences > > > > - enable: #showBoundsInHalo; > > > > + enable: #showBoundsInHalo ; > > > > disable: #alternateHandlesLook; > > > > disable: #showDirectionHandles. > > > > Morph > > > > haloForAll: true; > > > > metaMenuForAll: true. > > > > - > > > > + > > > > "System" > > > > - NetNameResolver enableIPv6: true. > > > > + NetNameResolver enableIPv6: false. > > > > Scanner > > > > allowUnderscoreAsAssignment: true; > > > > prefAllowUnderscoreSelectors: true. > > > > - > > > > + > > > > Deprecation showDeprecationWarnings: true > > > > + > > > > "that's all, folks" > > > > > > > > TextEditor class>>autoEnclose {preferences} B7 ct 11/1/2021 20:26 (changed) > > > > autoEnclose > > > > - <preference: 'Auto enclose brackets () {} []' > > > > - categoryList: #('Morphic' 'editing') > > > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > > > - type: #Boolean> > > > > - > > > > - ^ AutoEnclose ifNil: [ false ] > > > > + > > > > + ^ AutoEnclose ifNil: [#never] > > > > > > > > TextEditor class>>autoEnclose: {preferences} B7 ct 11/1/2021 20:30 (changed) > > > > - autoEnclose: aBoolean > > > > - AutoEnclose := aBoolean > > > > + autoEnclose: aSymbol > > > > + > > > > + aSymbol == true ifTrue: [ > > > > + "backward compatibility." > > > > + ^ self autoEnclose: #always]. > > > > + > > > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > > > + > > > > + AutoEnclose := aSymbol. > > > > > > > > TextEditor class>>autoEncloseAlways {preferences} B7 ct 11/1/2021 21:48 > > > > + autoEncloseAlways > > > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > > > + categoryList: #('Morphic' 'editing') > > > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > > > + type: #Boolean> > > > > + > > > > + ^ self autoEnclose = #always > > > > > > > > TextEditor class>>autoEncloseAlways: {preferences} B7 ct 11/1/2021 20:32 > > > > + autoEncloseAlways: aBoolean > > > > + > > > > + self autoEnclose: (aBoolean > > > > + ifTrue: [#always] > > > > + ifFalse: [#never]). > > > > > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} B7 ct 11/1/2021 21:49 > > > > + autoEncloseBeforeSpaces > > > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > > > + categoryList: #('Morphic' 'editing') > > > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > > > + type: #Boolean> > > > > + > > > > + ^ self autoEnclose = #beforeSpaces > > > > > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} B7 ct 11/1/2021 20:32 > > > > + autoEncloseBeforeSpaces: aBoolean > > > > + > > > > + self autoEnclose: (aBoolean > > > > + ifTrue: [#beforeSpaces] > > > > + ifFalse: [#never]). > > > > > > > > TextEditor>>autoEncloseFor: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > > autoEncloseFor: typedChar > > > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > > > | openers closers | > > > > + self class autoEnclose = #never > > > > + ifTrue: [ ^ false ]. > > > > + (self class autoEnclose = #beforeSpaces > > > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > > > + ifFalse: [ ^ false ]. > > > > + > > > > openers := '([{'. > > > > closers := ')]}'. > > > > (closers includes: typedChar) ifTrue: > > > > [ | pos | > > > > self blinkPrevParen: typedChar. > > > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > > > ifTrue: > > > > [ self > > > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > > > forward: true > > > > select: false. > > > > ^ true ] > > > > ifFalse: [ ^ false ] ]. > > > > (openers includes: typedChar) ifTrue: > > > > [ self > > > > openTypeIn; > > > > addString: typedChar asString; > > > > addString: (closers at: (openers indexOf: typedChar)) asString; > > > > insertAndCloseTypeIn; > > > > > > > > moveCursor: [ : position | position - 1 ] > > > > forward: false > > > > select: false. > > > > ^ true ]. > > > > ^ false > > > > > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} B7 ct 11/1/2021 20:28 (changed) > > > > dispatchOnKeyboardEvent: aKeyboardEvent > > > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > > > > > | honorCommandKeys typedChar | > > > > typedChar := aKeyboardEvent keyCharacter. > > > > > > > > "Handle one-line input fields." > > > > (typedChar == Character cr and: [morph acceptOnCR]) > > > > ifTrue: [^ true]. > > > > > > > > "Clear highlight for last opened parenthesis." > > > > self clearParens. > > > > > > > > "Handle line breaks and auto indent." > > > > typedChar == Character cr ifTrue: [ > > > > aKeyboardEvent controlKeyPressed > > > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > > > aKeyboardEvent shiftPressed > > > > ifTrue: [^ self lf: aKeyboardEvent]. > > > > aKeyboardEvent commandKeyPressed > > > > ifTrue: [^ self crlf: aKeyboardEvent]. > > > > ^ self crWithIndent: aKeyboardEvent]. > > > > > > > > "Handle indent/outdent with selected text block." > > > > typedChar == Character tab ifTrue: [ > > > > aKeyboardEvent shiftPressed > > > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > > > ifFalse: [self hasMultipleLinesSelected > > > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > > > > > (honorCommandKeys and: [typedChar == Character enter]) > > > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > > > and: [aKeyboardEvent keyValue < 27]) > > > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > > > ifTrue: [self > > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > > with: aKeyboardEvent] > > > > ifFalse: [self > > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > > with: aKeyboardEvent]]. > > > > > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > > > ifTrue: [self > > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > > with: aKeyboardEvent] > > > > ifFalse: [self > > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > > with: aKeyboardEvent]]. > > > > > > > > "the control key can be used to invoke shift-cmd shortcuts" > > > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > > > ifTrue: [^ self > > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > > with: aKeyboardEvent]. > > > > > > > > "Enclose selection with brackets etc." > > > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > > > ifTrue: [^ true]. > > > > > > > > "Automatically enclose paired characters such as brackets." > > > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > > > + (self autoEncloseFor: typedChar) > > > > ifTrue: [^ true]. > > > > > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > > > (')]}' includes: typedChar) > > > > ifTrue: [self blinkPrevParen: typedChar]. > > > > > > > > self normalCharacter: aKeyboardEvent. > > > > ^ false > > > > > > > > --- > > > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > > > > > Hi Christoph, > > > > > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > > > having inserted enclosing brackets always, you can now activate a new > > > > > > preference to only insert these characters if there is any space after the > > > > > > cursor. > > > > > > > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > > > test it). > > > > > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > > which is what I made autoEnclose for. > > > > > > > > > > Thanks, > > > > > Chris > > > > >
On 2021-12-06, at 1:45 PM, mail@jaromir.net wrote:
Like "commenting" inside a comment? Does it makes sense?
Not within Smalltalk code; you'd effectively be uncommenting stuff you wanted commented out. Consider
"this is my comment about commenting using "double quotes" for comments"
The double quotes is now active code. Imagine the fun possibilities that provides. Of course, the Shout highlighter will show it as not-comment, but that can be very difficult to spot in certain theme/screen/colour-blindness mixes. I've been adding set: #comment for: #SHTextStylerST80 to: {Color cyan muchDarker. TextEmphasis italic}; in SqueakTheme class>>#addSyntaxHighlighting: to help with that.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful Latin Phrases:- Illiud Latine dici non potest = You can't say that in Latin.
On Wed, Dec 1, 2021 at 11:40 AM mail@jaromir.net wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets and
enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient
"toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a
second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de >: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [ https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel Am 14.12.2021 23:09:22 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Wed, Dec 1, 2021 at 11:40 AM <mail@jaromir.net [mailto:mail@jaromir.net]> wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de [mailto:christoph.thiede@student.hpi.uni-potsdam.de] wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org [http://lists.squeakfoundation.org%5D%3E im Auftrag von mail at jaromir.net [http://jaromir.net] <mail at jaromir.net [http://jaromir.net%5D%3E Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.org [http://lists.squeakfoundation.org]; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de [http://hpi.de] wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de] <christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de]>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com [http://gmail.com] wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > >
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
1. there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel
Am 14.12.2021 23:09:22 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Wed, Dec 1, 2021 at 11:40 AM mail@jaromir.net wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets
and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient
"toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a
second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [ https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
- there is no gesture to create a pair of brackets around the empty
selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel
Am 14.12.2021 23:09:22 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Wed, Dec 1, 2021 at 11:40 AM mail@jaromir.net wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets
and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient
"toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert
a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [ https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
Hi Eliot, Marcel, Christoph,
Christoph suggested a nice solution for removing quotes around a selection in a previous post here: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217443....
It would toggle the quotes (double, single and vertical line) instead of adding levels...
enclose: aKeyboardEvent "Insert or remove bracket characters around the current selection."
| 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]]) "<------------------here's Christoph's change" 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 ifFalse: [ self replaceSelectionWith: (Text string: (String with: left), oldSelection string, (String with: right) attributes: emphasisHere). self selectFrom: startIndex+1 to: stopIndex] ]. ^true
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-21T12:22:57-08:00, eliot.miranda@gmail.com wrote:
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda <eliot.miranda at gmail.com> wrote:
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
- there is no gesture to create a pair of brackets around the empty
selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel <marcel.taeumel at hpi.de> wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel
Am 14.12.2021 23:09:22 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
On Wed, Dec 1, 2021 at 11:40 AM <mail at jaromir.net> wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets
and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient
"toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert
a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
^[^ Jaromir Sent from Squeak Inbox Talk On 2021-12-01T19:08:57+00:00, christoph.thiede at student.hpi.uni-potsdam.de wrote: > Hi Marcel, hi Jaromir, > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > Best, > > Christoph > > ________________________________ > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > Hi Marcel, > > > Please find attached another take on this idea. No extra preference. > > ... more than happy :) > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > Thanks, > > > ~~~ > ^[^ > -- Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > Best, > > Marcel > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > Hi Chris, > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > Yes, it does. :-) > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > Best, > > Christoph > > > > > > =============== Postscript =============== > > > > "Postscript: > > Leave the line above, and replace the rest of this comment by a useful one. > > Executable statements should follow this comment, and should > > be separated by periods, with no exclamation points (!). > > Be sure to put any further comments in double-quotes, like this one." > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > =============== Diff =============== > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > > initializePage03Interaction > > > > | currentPage pane | > > currentPage := pages add: self createPage. > > pane := self createScrollPane. > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > currentPage addMorphBack: pane. > > > > pane scroller firstSubmorph addAllMorphsBack: { > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > self createVerticalSpace. > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > self createVerticalSpace. > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > }. > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseAlways > > + > > + ^ TextEditor autoEncloseAlways > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > > + stateAutoEncloseBeforeSpaces > > + > > + ^ TextEditor autoEncloseBeforeSpaces > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseAlways > > + > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > > + toggleAutoEncloseBeforeSpaces > > + > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > + self > > + changed: #stateAutoEncloseAlways; > > + changed: #stateAutoEncloseBeforeSpaces. > > > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > > setPreferences > > "Preferences class defaultValueTableForCurrentRelease" > > - " Preferences outOfTheBox." > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > - "General User interaction" > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > + > > + "General User interaction" > > Preferences > > - enable: #generalizedYellowButtonMenu; > > + enable: #generalizedYellowButtonMenu ; > > enable: #swapMouseButtons; > > disable: #mouseOverForKeyboardFocus. > > Morph indicateKeyboardFocus: true. > > Project uiManager openToolsAttachedToMouseCursor: false. > > SearchBar useScratchPad: false. > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > HandMorph synthesizeMouseWheelEvents: true. > > > > "Text input." > > TextEditor > > - autoEnclose: true; > > - autoIndent: true; > > - encloseSelection: false; > > - destructiveBackWord: false; > > - blinkingCursor: true; > > - dumbbellCursor: false. > > + autoEnclose: #beforeSpaces ; > > + autoIndent: true ; > > + encloseSelection: false ; > > + destructiveBackWord: false ; > > + blinkingCursor: true ; > > + dumbbellCursor: false. > > PluggableTextMorph simpleFrameAdornments: false. > > TextMorphForEditView draggableTextSelection: true. > > - "Windows" > > > > + "Windows" > > SystemWindow reuseWindows: false. > > SystemWindow windowsRaiseOnClick: true. > > SystemWindow windowTitleActiveOnFirstClick: true. > > - Model windowActiveOnFirstClick: false. > > - "Not good for little screen real estate." > > - Model useColorfulWindows: false. > > - > > - Preferences disable: #fastDragWindowForMorphic. > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > + Model useColorfulWindows: false. > > + > > + Preferences > > + disable: #fastDragWindowForMorphic. > > AbstractResizerMorph > > gripThickness: 4; > > handleLength: 25. > > CornerGripMorph > > drawCornerResizeHandles: false; > > drawEdgeResizeHandles: false. > > ProportionalSplitterMorph > > showSplitterHandles: false; > > smartHorizontalSplitters: false; > > smartVerticalSplitters: false. > > - > > + > > "Scroll bars." > > Preferences > > enable: #scrollBarsNarrow; > > enable: #scrollBarsOnRight; > > enable: #alwaysHideHScrollbar; > > disable: #alwaysShowHScrollbar; > > disable: #alwaysShowVScrollbar. > > ScrollBar > > scrollBarsWithoutArrowButtons: true; > > scrollBarsWithoutMenuButton: true. > > - ScrollPane useRetractableScrollBars: false. > > - > > + ScrollPane > > + useRetractableScrollBars: false. > > + > > "Rounded corners." > > Morph preferredCornerRadius: 8. > > SystemWindow roundedWindowCorners: false. > > DialogWindow roundedDialogCorners: false. > > MenuMorph roundedMenuCorners: false. > > PluggableButtonMorph roundedButtonCorners: false. > > ScrollBar roundedScrollBarLook: false. > > > > "Gradients." > > SystemWindow gradientWindow: false. > > DialogWindow gradientDialog: false. > > MenuMorph gradientMenu: false. > > PluggableButtonMorph gradientButton: false. > > ScrollBar gradientScrollBar: false. > > - > > + > > "Shadows" > > Preferences enable: #menuAppearance3d. > > Morph useSoftDropShadow: true. > > > > "Lists and Trees" > > PluggableListMorph > > filterableLists: true; > > clearFilterAutomatically: false; > > clearFilterDelay: 500; > > highlightHoveredRow: true; > > highlightPreSelection: false; > > menuRequestUpdatesSelection: true. > > PluggableTreeMorph > > filterByLabelsOnly: false; > > maximumSearchDepth: 1. > > > > "Standard Tools" > > TheWorldMainDockingBar > > showWorldMainDockingBar: true; > > showSecondsInClock: true; > > twentyFourHourClock: true. > > SearchBar useSmartSearch: true. > > Workspace shouldStyle: false. > > TranscriptStream > > forceUpdate: true; > > redirectToStdOut: false; > > characterLimit: 20000. > > Browser > > listClassesHierarchically: true; > > showClassIcons: true; > > showMessageIcons: true; > > sortMessageCategoriesAlphabetically: true. > > SystemBrowser browseWithDragNDrop: true. > > MessageSet useUnifiedMessageLabels: true. > > Preferences > > enable: #annotationPanes; > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > enable: #optionalButtons; > > disable: #diffsWithPrettyPrint; > > enable: #traceMessages; > > enable: #alternativeBrowseIt; > > enable: #menuWithIcons; > > enable: #visualExplorer. > > Preferences disable: #debugLogTimestamp. > > + > > "Halo" > > - > > Preferences > > - enable: #showBoundsInHalo; > > + enable: #showBoundsInHalo ; > > disable: #alternateHandlesLook; > > disable: #showDirectionHandles. > > Morph > > haloForAll: true; > > metaMenuForAll: true. > > - > > + > > "System" > > - NetNameResolver enableIPv6: true. > > + NetNameResolver enableIPv6: false. > > Scanner > > allowUnderscoreAsAssignment: true; > > prefAllowUnderscoreSelectors: true. > > - > > + > > Deprecation showDeprecationWarnings: true > > + > > "that's all, folks" > > > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > > autoEnclose > > - <preference: 'Auto enclose brackets () {} []' > > - categoryList: #('Morphic' 'editing') > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > - type: #Boolean> > > - > > - ^ AutoEnclose ifNil: [ false ] > > + > > + ^ AutoEnclose ifNil: [#never] > > > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > > - autoEnclose: aBoolean > > - AutoEnclose := aBoolean > > + autoEnclose: aSymbol > > + > > + aSymbol == true ifTrue: [ > > + "backward compatibility." > > + ^ self autoEnclose: #always]. > > + > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > + > > + AutoEnclose := aSymbol. > > > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > > + autoEncloseAlways > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #always > > > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseAlways: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#always] > > + ifFalse: [#never]). > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > > + autoEncloseBeforeSpaces > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > + categoryList: #('Morphic' 'editing') > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > + type: #Boolean> > > + > > + ^ self autoEnclose = #beforeSpaces > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > > + autoEncloseBeforeSpaces: aBoolean > > + > > + self autoEnclose: (aBoolean > > + ifTrue: [#beforeSpaces] > > + ifFalse: [#never]). > > > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > > autoEncloseFor: typedChar > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > | openers closers | > > + self class autoEnclose = #never > > + ifTrue: [ ^ false ]. > > + (self class autoEnclose = #beforeSpaces > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > + ifFalse: [ ^ false ]. > > + > > openers := '([{'. > > closers := ')]}'. > > (closers includes: typedChar) ifTrue: > > [ | pos | > > self blinkPrevParen: typedChar. > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > ifTrue: > > [ self > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > forward: true > > select: false. > > ^ true ] > > ifFalse: [ ^ false ] ]. > > (openers includes: typedChar) ifTrue: > > [ self > > openTypeIn; > > addString: typedChar asString; > > addString: (closers at: (openers indexOf: typedChar)) asString; > > insertAndCloseTypeIn; > > > > moveCursor: [ : position | position - 1 ] > > forward: false > > select: false. > > ^ true ]. > > ^ false > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > > dispatchOnKeyboardEvent: aKeyboardEvent > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > | honorCommandKeys typedChar | > > typedChar := aKeyboardEvent keyCharacter. > > > > "Handle one-line input fields." > > (typedChar == Character cr and: [morph acceptOnCR]) > > ifTrue: [^ true]. > > > > "Clear highlight for last opened parenthesis." > > self clearParens. > > > > "Handle line breaks and auto indent." > > typedChar == Character cr ifTrue: [ > > aKeyboardEvent controlKeyPressed > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > aKeyboardEvent shiftPressed > > ifTrue: [^ self lf: aKeyboardEvent]. > > aKeyboardEvent commandKeyPressed > > ifTrue: [^ self crlf: aKeyboardEvent]. > > ^ self crWithIndent: aKeyboardEvent]. > > > > "Handle indent/outdent with selected text block." > > typedChar == Character tab ifTrue: [ > > aKeyboardEvent shiftPressed > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > ifFalse: [self hasMultipleLinesSelected > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > (honorCommandKeys and: [typedChar == Character enter]) > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > and: [aKeyboardEvent keyValue < 27]) > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > ifTrue: [self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent] > > ifFalse: [self > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]]. > > > > "the control key can be used to invoke shift-cmd shortcuts" > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > ifTrue: [^ self > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > with: aKeyboardEvent]. > > > > "Enclose selection with brackets etc." > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > ifTrue: [^ true]. > > > > "Automatically enclose paired characters such as brackets." > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > + (self autoEncloseFor: typedChar) > > ifTrue: [^ true]. > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > (')]}' includes: typedChar) > > ifTrue: [self blinkPrevParen: typedChar]. > > > > self normalCharacter: aKeyboardEvent. > > ^ false > > > > --- > > Sent from Squeak Inbox Talk [ https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > Hi Christoph, > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > having inserted enclosing brackets always, you can now activate a new > > > > preference to only insert these characters if there is any space after the > > > > cursor. > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > test it). > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > which is what I made autoEnclose for. > > > > > > Thanks, > > > Chris > > >
Hi Eliot --
1. there is no gesture to create a pair of brackets around the empty selection
You can enable the preference "Auto enclose brackets", which we recently tweaked to match the expected behavior or other text editors. Then you only have to type that opening bracket and get the closing one for free.
We will enable this preference by default in the next release, along with "Enclose selection with brackets".
But quotes are a different matter.
I will follow up on what Christoph and Jaromir suggested.
***
Sorry for any inconvenience. I am sure that, at some point, we will allow users to specify their own gestures that fit their specific language and keyboard layout.
Best, Marcel
Am 21.12.2021 21:23:27 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda <eliot.miranda@gmail.com [mailto:eliot.miranda@gmail.com]> wrote:
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
1. there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel <marcel.taeumel@hpi.de [mailto:marcel.taeumel@hpi.de]> wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel Am 14.12.2021 23:09:22 schrieb Eliot Miranda <eliot.miranda@gmail.com [mailto:eliot.miranda@gmail.com]>:
On Wed, Dec 1, 2021 at 11:40 AM <mail@jaromir.net [mailto:mail@jaromir.net]> wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de [mailto:christoph.thiede@student.hpi.uni-potsdam.de] wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org [http://lists.squeakfoundation.org%5D%3E im Auftrag von mail at jaromir.net [http://jaromir.net] <mail at jaromir.net [http://jaromir.net%5D%3E Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.org [http://lists.squeakfoundation.org]; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de [http://hpi.de] wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de] <christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de]>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com [http://gmail.com] wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > >
Hi all --
Symmetric enclosures "" '' || now toggled as of Morphic-mt.1828 (Trunk).
Note that, depending on the keyboard layout, dead keys are still an issue for toggling as two characters arrive in the image after hitting them twice.
Best, Marcel Am 22.12.2021 10:04:08 schrieb Marcel Taeumel marcel.taeumel@hpi.de: Hi Eliot --
1. there is no gesture to create a pair of brackets around the empty selection
You can enable the preference "Auto enclose brackets", which we recently tweaked to match the expected behavior or other text editors. Then you only have to type that opening bracket and get the closing one for free.
We will enable this preference by default in the next release, along with "Enclose selection with brackets".
But quotes are a different matter.
I will follow up on what Christoph and Jaromir suggested.
***
Sorry for any inconvenience. I am sure that, at some point, we will allow users to specify their own gestures that fit their specific language and keyboard layout.
Best, Marcel
Am 21.12.2021 21:23:27 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda <eliot.miranda@gmail.com [mailto:eliot.miranda@gmail.com]> wrote:
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
1. there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel <marcel.taeumel@hpi.de [mailto:marcel.taeumel@hpi.de]> wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel Am 14.12.2021 23:09:22 schrieb Eliot Miranda <eliot.miranda@gmail.com [mailto:eliot.miranda@gmail.com]>:
On Wed, Dec 1, 2021 at 11:40 AM <mail@jaromir.net [mailto:mail@jaromir.net]> wrote:
Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de [mailto:christoph.thiede@student.hpi.uni-potsdam.de] wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org [http://lists.squeakfoundation.org%5D%3E im Auftrag von mail at jaromir.net [http://jaromir.net] <mail at jaromir.net [http://jaromir.net%5D%3E Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.org [http://lists.squeakfoundation.org]; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de [http://hpi.de] wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de] <christoph.thiede at student.hpi.uni-potsdam.de [http://student.hpi.uni-potsdam.de]>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com [http://gmail.com] wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > >
On Dec 22, 2021, at 1:12 AM, Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all --
Symmetric enclosures "" '' || now toggled as of Morphic-mt.1828 (Trunk).
Note that, depending on the keyboard layout, dead keys are still an issue for toggling as two characters arrive in the image after hitting them twice.
Best, Marcel
Am 22.12.2021 10:04:08 schrieb Marcel Taeumel marcel.taeumel@hpi.de:
Hi Eliot --
- there is no gesture to create a pair of brackets around the empty selection
You can enable the preference "Auto enclose brackets", which we recently tweaked to match the expected behavior or other text editors. Then you only have to type that opening bracket and get the closing one for free.
We will enable this preference by default in the next release, along with "Enclose selection with brackets".
I *HATE* this!! Please don’t. I want to be able to do either; type a single bracket of a pair. I do *not* want to lose the ability to tile a fungus bracket.
But quotes are a different matter.
I will follow up on what Christoph and Jaromir suggested.
Sorry for any inconvenience. I am sure that, at some point, we will allow users to specify their own gestures that fit their specific language and keyboard layout.
Best, Marcel
Am 21.12.2021 21:23:27 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
- there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:.
- there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel
Am 14.12.2021 23:09:22 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Wed, Dec 1, 2021 at 11:40 AM mail@jaromir.net wrote: > Hi Christoph, > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. > > Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird). > > > Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... > > A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1 > > Thanks > > ~~~ > ^[^ Jaromir > > Sent from Squeak Inbox Talk > > On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.de wrote: > > > Hi Marcel, hi Jaromir, > > > > > > works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk. > > > > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > > > I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-) > > > > > > Best, > > > > Christoph > > > > ________________________________ > > Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von mail at jaromir.net <mail at jaromir.net> > > Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 > > An: squeak-dev at lists.squeakfoundation.org; Taeumel, Marcel > > Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs > > > > Hi Marcel, > > > > > Please find attached another take on this idea. No extra preference. > > > > ... more than happy :) > > > > > Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed. > > > > Thanks, > > > > > > ~~~ > > ^[^ > > -- Jaromir > > > > Sent from Squeak Inbox Talk > > > > On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de wrote: > > > > > Hi Chris, hi Christoph, hi Jaromir, hi all! > > > > > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > > > > > Best, > > > Marcel > > > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: > > > Hi Chris, > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > > > > > Yes, it does. :-) > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > > > > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > > > > > Best, > > > Christoph > > > > > > > > > =============== Postscript =============== > > > > > > "Postscript: > > > Leave the line above, and replace the rest of this comment by a useful one. > > > Executable statements should follow this comment, and should > > > be separated by periods, with no exclamation points (!). > > > Be sure to put any further comments in double-quotes, like this one." > > > > > > TextEditor autoEnclose: TextEditor autoEnclose. > > > > > > =============== Diff =============== > > > > > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > > > initializePage03Interaction > > > > > > | currentPage pane | > > > currentPage := pages add: self createPage. > > > pane := self createScrollPane. > > > > > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > > > currentPage addMorphBack: pane. > > > > > > pane scroller firstSubmorph addAllMorphsBack: { > > > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > > > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > > > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > > > self createVerticalSpace. > > > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > > > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > > > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > > > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > > > self createVerticalSpace. > > > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > > > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > > > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > > > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > > > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > > > > > }. > > > > > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > > > + stateAutoEncloseAlways > > > + > > > + ^ TextEditor autoEncloseAlways > > > > > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > > > + stateAutoEncloseBeforeSpaces > > > + > > > + ^ TextEditor autoEncloseBeforeSpaces > > > > > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > > > + toggleAutoEncloseAlways > > > + > > > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > > > + toggleAutoEncloseBeforeSpaces > > > + > > > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > > > + self > > > + changed: #stateAutoEncloseAlways; > > > + changed: #stateAutoEncloseBeforeSpaces. > > > > > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > > > setPreferences > > > "Preferences class defaultValueTableForCurrentRelease" > > > - " Preferences outOfTheBox." > > > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > - "General User interaction" > > > > > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > > > + > > > + "General User interaction" > > > Preferences > > > - enable: #generalizedYellowButtonMenu; > > > + enable: #generalizedYellowButtonMenu ; > > > enable: #swapMouseButtons; > > > disable: #mouseOverForKeyboardFocus. > > > Morph indicateKeyboardFocus: true. > > > Project uiManager openToolsAttachedToMouseCursor: false. > > > SearchBar useScratchPad: false. > > > > > > HandMorph sendMouseWheelToKeyboardFocus: false. > > > HandMorph synthesizeMouseWheelEvents: true. > > > > > > "Text input." > > > TextEditor > > > - autoEnclose: true; > > > - autoIndent: true; > > > - encloseSelection: false; > > > - destructiveBackWord: false; > > > - blinkingCursor: true; > > > - dumbbellCursor: false. > > > + autoEnclose: #beforeSpaces ; > > > + autoIndent: true ; > > > + encloseSelection: false ; > > > + destructiveBackWord: false ; > > > + blinkingCursor: true ; > > > + dumbbellCursor: false. > > > PluggableTextMorph simpleFrameAdornments: false. > > > TextMorphForEditView draggableTextSelection: true. > > > - "Windows" > > > > > > + "Windows" > > > SystemWindow reuseWindows: false. > > > SystemWindow windowsRaiseOnClick: true. > > > SystemWindow windowTitleActiveOnFirstClick: true. > > > - Model windowActiveOnFirstClick: false. > > > - "Not good for little screen real estate." > > > - Model useColorfulWindows: false. > > > - > > > - Preferences disable: #fastDragWindowForMorphic. > > > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > > > + Model useColorfulWindows: false. > > > + > > > + Preferences > > > + disable: #fastDragWindowForMorphic. > > > AbstractResizerMorph > > > gripThickness: 4; > > > handleLength: 25. > > > CornerGripMorph > > > drawCornerResizeHandles: false; > > > drawEdgeResizeHandles: false. > > > ProportionalSplitterMorph > > > showSplitterHandles: false; > > > smartHorizontalSplitters: false; > > > smartVerticalSplitters: false. > > > - > > > + > > > "Scroll bars." > > > Preferences > > > enable: #scrollBarsNarrow; > > > enable: #scrollBarsOnRight; > > > enable: #alwaysHideHScrollbar; > > > disable: #alwaysShowHScrollbar; > > > disable: #alwaysShowVScrollbar. > > > ScrollBar > > > scrollBarsWithoutArrowButtons: true; > > > scrollBarsWithoutMenuButton: true. > > > - ScrollPane useRetractableScrollBars: false. > > > - > > > + ScrollPane > > > + useRetractableScrollBars: false. > > > + > > > "Rounded corners." > > > Morph preferredCornerRadius: 8. > > > SystemWindow roundedWindowCorners: false. > > > DialogWindow roundedDialogCorners: false. > > > MenuMorph roundedMenuCorners: false. > > > PluggableButtonMorph roundedButtonCorners: false. > > > ScrollBar roundedScrollBarLook: false. > > > > > > "Gradients." > > > SystemWindow gradientWindow: false. > > > DialogWindow gradientDialog: false. > > > MenuMorph gradientMenu: false. > > > PluggableButtonMorph gradientButton: false. > > > ScrollBar gradientScrollBar: false. > > > - > > > + > > > "Shadows" > > > Preferences enable: #menuAppearance3d. > > > Morph useSoftDropShadow: true. > > > > > > "Lists and Trees" > > > PluggableListMorph > > > filterableLists: true; > > > clearFilterAutomatically: false; > > > clearFilterDelay: 500; > > > highlightHoveredRow: true; > > > highlightPreSelection: false; > > > menuRequestUpdatesSelection: true. > > > PluggableTreeMorph > > > filterByLabelsOnly: false; > > > maximumSearchDepth: 1. > > > > > > "Standard Tools" > > > TheWorldMainDockingBar > > > showWorldMainDockingBar: true; > > > showSecondsInClock: true; > > > twentyFourHourClock: true. > > > SearchBar useSmartSearch: true. > > > Workspace shouldStyle: false. > > > TranscriptStream > > > forceUpdate: true; > > > redirectToStdOut: false; > > > characterLimit: 20000. > > > Browser > > > listClassesHierarchically: true; > > > showClassIcons: true; > > > showMessageIcons: true; > > > sortMessageCategoriesAlphabetically: true. > > > SystemBrowser browseWithDragNDrop: true. > > > MessageSet useUnifiedMessageLabels: true. > > > Preferences > > > enable: #annotationPanes; > > > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > > > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > > > enable: #optionalButtons; > > > disable: #diffsWithPrettyPrint; > > > enable: #traceMessages; > > > enable: #alternativeBrowseIt; > > > enable: #menuWithIcons; > > > enable: #visualExplorer. > > > Preferences disable: #debugLogTimestamp. > > > + > > > "Halo" > > > - > > > Preferences > > > - enable: #showBoundsInHalo; > > > + enable: #showBoundsInHalo ; > > > disable: #alternateHandlesLook; > > > disable: #showDirectionHandles. > > > Morph > > > haloForAll: true; > > > metaMenuForAll: true. > > > - > > > + > > > "System" > > > - NetNameResolver enableIPv6: true. > > > + NetNameResolver enableIPv6: false. > > > Scanner > > > allowUnderscoreAsAssignment: true; > > > prefAllowUnderscoreSelectors: true. > > > - > > > + > > > Deprecation showDeprecationWarnings: true > > > + > > > "that's all, folks" > > > > > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > > > autoEnclose > > > - <preference: 'Auto enclose brackets () {} []' > > > - categoryList: #('Morphic' 'editing') > > > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > > > - type: #Boolean> > > > - > > > - ^ AutoEnclose ifNil: [ false ] > > > + > > > + ^ AutoEnclose ifNil: [#never] > > > > > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > > > - autoEnclose: aBoolean > > > - AutoEnclose := aBoolean > > > + autoEnclose: aSymbol > > > + > > > + aSymbol == true ifTrue: [ > > > + "backward compatibility." > > > + ^ self autoEnclose: #always]. > > > + > > > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > > > + > > > + AutoEnclose := aSymbol. > > > > > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > > > + autoEncloseAlways > > > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #always > > > > > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > > > + autoEncloseAlways: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#always] > > > + ifFalse: [#never]). > > > > > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > > > + autoEncloseBeforeSpaces > > > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > > > + categoryList: #('Morphic' 'editing') > > > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > > > + type: #Boolean> > > > + > > > + ^ self autoEnclose = #beforeSpaces > > > > > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > > > + autoEncloseBeforeSpaces: aBoolean > > > + > > > + self autoEnclose: (aBoolean > > > + ifTrue: [#beforeSpaces] > > > + ifFalse: [#never]). > > > > > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > > > autoEncloseFor: typedChar > > > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > > > | openers closers | > > > + self class autoEnclose = #never > > > + ifTrue: [ ^ false ]. > > > + (self class autoEnclose = #beforeSpaces > > > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > > > + ifFalse: [ ^ false ]. > > > + > > > openers := '([{'. > > > closers := ')]}'. > > > (closers includes: typedChar) ifTrue: > > > [ | pos | > > > self blinkPrevParen: typedChar. > > > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > > > ifTrue: > > > [ self > > > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > > > forward: true > > > select: false. > > > ^ true ] > > > ifFalse: [ ^ false ] ]. > > > (openers includes: typedChar) ifTrue: > > > [ self > > > openTypeIn; > > > addString: typedChar asString; > > > addString: (closers at: (openers indexOf: typedChar)) asString; > > > insertAndCloseTypeIn; > > > > > > moveCursor: [ : position | position - 1 ] > > > forward: false > > > select: false. > > > ^ true ]. > > > ^ false > > > > > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > > > dispatchOnKeyboardEvent: aKeyboardEvent > > > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > > > > > | honorCommandKeys typedChar | > > > typedChar := aKeyboardEvent keyCharacter. > > > > > > "Handle one-line input fields." > > > (typedChar == Character cr and: [morph acceptOnCR]) > > > ifTrue: [^ true]. > > > > > > "Clear highlight for last opened parenthesis." > > > self clearParens. > > > > > > "Handle line breaks and auto indent." > > > typedChar == Character cr ifTrue: [ > > > aKeyboardEvent controlKeyPressed > > > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > > > aKeyboardEvent shiftPressed > > > ifTrue: [^ self lf: aKeyboardEvent]. > > > aKeyboardEvent commandKeyPressed > > > ifTrue: [^ self crlf: aKeyboardEvent]. > > > ^ self crWithIndent: aKeyboardEvent]. > > > > > > "Handle indent/outdent with selected text block." > > > typedChar == Character tab ifTrue: [ > > > aKeyboardEvent shiftPressed > > > ifTrue: [self outdent: aKeyboardEvent. ^ true] > > > ifFalse: [self hasMultipleLinesSelected > > > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > > > > > honorCommandKeys := Preferences cmdKeysInText. > > > > > > (honorCommandKeys and: [typedChar == Character enter]) > > > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > > > > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > > > conflict, assume that keys other than cursor keys aren't used together with Crtl." > > > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > > > and: [aKeyboardEvent keyValue < 27]) > > > ifTrue: [^ aKeyboardEvent controlKeyPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "backspace, and escape keys (ascii 8 and 27) are command keys" > > > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > > > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > > > ifTrue: [ ^ aKeyboardEvent shiftPressed > > > ifTrue: [self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent] > > > ifFalse: [self > > > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]]. > > > > > > "the control key can be used to invoke shift-cmd shortcuts" > > > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > > > ifTrue: [^ self > > > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > > > with: aKeyboardEvent]. > > > > > > "Enclose selection with brackets etc." > > > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > > > ifTrue: [^ true]. > > > > > > "Automatically enclose paired characters such as brackets." > > > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > > > + (self autoEncloseFor: typedChar) > > > ifTrue: [^ true]. > > > > > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > > > (')]}' includes: typedChar) > > > ifTrue: [self blinkPrevParen: typedChar]. > > > > > > self normalCharacter: aKeyboardEvent. > > > ^ false > > > > > > --- > > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > > > > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com wrote: > > > > > > > Hi Christoph, > > > > > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > > > having inserted enclosing brackets always, you can now activate a new > > > > > preference to only insert these characters if there is any space after the > > > > > cursor. > > > > > > > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > > > test it). > > > > > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > > > > > It seems like this feature should not disrupt expression-editing at all, > > > > which is what I made autoEnclose for. > > > > > > > > Thanks, > > > > Chris > > > >
Hi Eliot,
I have tried to reproduce your concerns but was unable to do so. Could you maybe help me please? :)
- there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:.
I cannot reproduce this. What is your exact keyboard sequence? If I start with an empty workspace and type
* true * <space> * <cmd>T * space * <open square bracket>
then I end up with: "true ifTrue: []"
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
- there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
I can also not reproduce that. :-) Given "[1|2]" where | is the caret, you would just press command + [ or command + ] to remove the quotes, without a real selection? Sounds like a nice idea, but no one that is implemented in Squeak so far AFAIK. But you can press command + Space before to select everything between the brackets and then press command + ] to remove the brackets.
I want to be able to do either; type a single bracket of a pair. I do *not* want to lose the ability to tile a fungus bracket.
If you turn off "Auto enclose brackets () {} []", neither ( nor ) will be completed. I was not sure what you mean by "fungus bracket".
Looking forward to your clarification! I am confident that we should be able to define a default set of preferences on which all high-frequent Trunk contributors can agree. :-)
Best, Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Eliot Miranda eliot.miranda@gmail.com Gesendet: Mittwoch, 22. Dezember 2021 16:56 Uhr An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On Dec 22, 2021, at 1:12 AM, Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all --
Symmetric enclosures "" '' || now toggled as of Morphic-mt.1828 (Trunk).
Note that, depending on the keyboard layout, dead keys are still an issue for toggling as two characters arrive in the image after hitting them twice.
Best, Marcel
Am 22.12.2021 10:04:08 schrieb Marcel Taeumel marcel.taeumel@hpi.de:
Hi Eliot --
- there is no gesture to create a pair of brackets around the empty selection
You can enable the preference "Auto enclose brackets", which we recently tweaked to match the expected behavior or other text editors. Then you only have to type that opening bracket and get the closing one for free.
We will enable this preference by default in the next release, along with "Enclose selection with brackets".
I *HATE* this!! Please don’t. I want to be able to do either; type a single bracket of a pair. I do *not* want to lose the ability to tile a fungus bracket.
But quotes are a different matter.
I will follow up on what Christoph and Jaromir suggested.
***
Sorry for any inconvenience. I am sure that, at some point, we will allow users to specify their own gestures that fit their specific language and keyboard layout.
Best, Marcel
Am 21.12.2021 21:23:27 schrieb Eliot Miranda eliot.miranda@gmail.com:
On Tue, Dec 21, 2021 at 12:20 PM Eliot Miranda <eliot.miranda@gmail.commailto:eliot.miranda@gmail.com> wrote: Hi Marcel,
I'm finding myself enormously frustrated by the new enclose scheme. Two main causes:
1. there is no gesture to create a pair of brackets around the empty selection. This is something i do reflexively, e.g. command-T for ifTrue:, space, then command-[ to get a pair of brackets for the argument to ifTrue:. 2. there is no gesture to remove brackets/quotes from a selection surrounded by brackets/quotes. I do this reflexively too. Click inside a bracketed/quoted sequence of characters, then hit command-quote/bracket to remove the brackets/quotes from the selection.
Forget the mention of brackets in point 2. The "type a close bracket to remove" works well. I like it. But quotes are a different matter.
What solutions exist/are planned for these? Any possibility of bringing back the old scheme as a preference? I have 40 years of muscle memory in this. It is, um, painful.
On Wed, Dec 15, 2021 at 8:17 AM Marcel Taeumel <marcel.taeumel@hpi.demailto:marcel.taeumel@hpi.de> wrote: Hi all --
Merged. See Morphic-mt.1824.
Best, Marcel
Am 14.12.2021 23:09:22 schrieb Eliot Miranda <eliot.miranda@gmail.commailto:eliot.miranda@gmail.com>:
On Wed, Dec 1, 2021 at 11:40 AM <mail@jaromir.netmailto:mail@jaromir.net> wrote: Hi Christoph,
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option.
Toggling is good! Hmm, pressing CTRL and a bracket (or CTRL SHIFT and a bracket or ALT and a bracket) also toggles brackets around a selection but the logic is a bit chaotic (e.g. CTRL-[ encloses with {}... weird).
Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ...
A quick idea: an opener bracket on a selection adds a level and a closer bracket removes a level?
+1
Thanks
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-01T19:08:57+00:00, christoph.thiede@student.hpi.uni-potsdam.demailto:christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Marcel, hi Jaromir,
works like a charm for me! :-) Unless anyone misses the classical mode, I would love to see this in the Trunk.
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
I think this is intentional. Take it as a more or less convenient "toggle brackets" option. Unfortunately, it can be hard to use when you actually want to insert a second level of brackets ... In this case, my current heuristic is to advance/shrink the selection by one character so that typing the bracket again will actually enclose the selection into new brackets. But this is a bit tricky, do you have any idea to make it more convenient? :-)
Best,
Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.orghttp://lists.squeakfoundation.org> im Auftrag von mail at jaromir.nethttp://jaromir.net <mail at jaromir.nethttp://jaromir.net> Gesendet: Mittwoch, 1. Dezember 2021 19:25:24 An: squeak-dev at lists.squeakfoundation.orghttp://lists.squeakfoundation.org; Taeumel, Marcel Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Marcel,
Please find attached another take on this idea. No extra preference.
... more than happy :)
Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection".
About "enclose selection": if you select text between two brackets and enter the opener bracket, both enclosing brackets will be removed... that's intentional, right? Without a hint in the preference comment I never noticed.
Thanks,
^[^ -- Jaromir Sent from Squeak Inbox Talk On 2021-12-01T14:46:45+01:00, marcel.taeumel at hpi.de<http://hpi.de> wrote: > Hi Chris, hi Christoph, hi Jaromir, hi all! > > Please find attached another take on this idea. No extra preference. Just tweaking the current autoEnclose-feature. In this form, I would consider using it. :-D Together with "Enclose selection". > > Best, > Marcel > Am 06.11.2021 23:34:06 schrieb christoph.thiede at student.hpi.uni-potsdam.de<http://student.hpi.uni-potsdam.de> <christoph.thiede at student.hpi.uni-potsdam.de<http://student.hpi.uni-potsdam.de>>: > Hi Chris, > > > Hopefully also when the cursor is at the end of the text, too (I didn't test it). > > Yes, it does. :-) > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > Sure, but without knowing everyone's personal preferences, anyone might be used the existing workflow. Shall we keep the old preference for this eventuality or would it be okay to remove until anyone shouts? :-) > > Below the complete diff of the changeset for convenience, just because my new diff generators is so funny. > > Best, > Christoph > > > =============== Postscript =============== > > "Postscript: > Leave the line above, and replace the rest of this comment by a useful one. > Executable statements should follow this comment, and should > be separated by periods, with no exclamation points (!). > Be sure to put any further comments in double-quotes, like this one." > > TextEditor autoEnclose: TextEditor autoEnclose. > > =============== Diff =============== > > PreferenceWizardMorph>>initializePage03Interaction {initialization - pages} · ct 11/1/2021 20:19 (changed) > initializePage03Interaction > > | currentPage pane | > currentPage := pages add: self createPage. > pane := self createScrollPane. > > currentPage addMorphBack: (self createLabel: 'Choose interaction settings' color: Color white). > currentPage addMorphBack: pane. > > pane scroller firstSubmorph addAllMorphsBack: { > self createCheckbox: 'Swap mouse buttons' translated for: #SwapMouseButtons help: #(swap mouse). > self createCheckbox: 'Focus follows mouse' translated for: #FocusFollowsMouse help: #(mouse over keyboard). > self createCheckbox: 'Mouse wheel to focus' translated for: #SendMouseWheelToKeyboardFocus help: #(wheel keyboard). > self createVerticalSpace. > - self createCheckbox: 'Auto enclose brackets' translated for: #AutoEnclose help: #(auto enclose). > + self createCheckbox: 'Auto enclose all brackets' translated for: #AutoEncloseAlways help: #(auto enclose). > + self createCheckbox: 'Auto enclose brackets before spaces only' translated for: #AutoEncloseBeforeSpaces help: #(auto enclose). > self createCheckbox: 'Auto indent lines' translated for: #AutoIndent help: #(auto indent). > self createCheckbox: 'Enclose text selections' translated for: #EncloseSelection help: #(enclose selection). > self createVerticalSpace. > self createCheckbox: 'Arrows in scrollbar' translated for: #ScrollBarsWithoutArrowButtons help: 'Whether to show arrows for scrolling or not.' translated. > self createCheckbox: 'Menu in scrollbar' translated for: #ScrollBarsWithoutMenuButton help: 'Whether to show a menu button or not.' translated. > self createCheckbox: 'Scrollbars on the right' translated for: #ScrollBarsOnRight help: #(right scroll). > self createCheckbox: 'Retractable scrollbars' translated for: #UseRetractableScrollBars help: #(retractable). > self createCheckbox: 'Narrow scrollbars' translated for: #ScrollBarsNarrow help: #(narrow scroll). > > }. > > PreferenceWizardMorph>>stateAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseAlways > + > + ^ TextEditor autoEncloseAlways > > PreferenceWizardMorph>>stateAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:19 > + stateAutoEncloseBeforeSpaces > + > + ^ TextEditor autoEncloseBeforeSpaces > > PreferenceWizardMorph>>toggleAutoEncloseAlways {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseAlways > + > + TextEditor autoEncloseAlways: TextEditor autoEncloseAlways not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > PreferenceWizardMorph>>toggleAutoEncloseBeforeSpaces {actions - buttons} · ct 11/1/2021 20:20 > + toggleAutoEncloseBeforeSpaces > + > + TextEditor autoEncloseBeforeSpaces: TextEditor autoEncloseBeforeSpaces not. > + self > + changed: #stateAutoEncloseAlways; > + changed: #stateAutoEncloseBeforeSpaces. > > ReleaseBuilder class>>setPreferences {scripts} · ct 11/1/2021 20:18 (changed) > setPreferences > "Preferences class defaultValueTableForCurrentRelease" > - " Preferences outOfTheBox." > - "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > - "General User interaction" > > + " Preferences outOfTheBox." "<-- uncomment after #defaultValueTableForCurrentRelease is fixed up." > + > + "General User interaction" > Preferences > - enable: #generalizedYellowButtonMenu; > + enable: #generalizedYellowButtonMenu ; > enable: #swapMouseButtons; > disable: #mouseOverForKeyboardFocus. > Morph indicateKeyboardFocus: true. > Project uiManager openToolsAttachedToMouseCursor: false. > SearchBar useScratchPad: false. > > HandMorph sendMouseWheelToKeyboardFocus: false. > HandMorph synthesizeMouseWheelEvents: true. > > "Text input." > TextEditor > - autoEnclose: true; > - autoIndent: true; > - encloseSelection: false; > - destructiveBackWord: false; > - blinkingCursor: true; > - dumbbellCursor: false. > + autoEnclose: #beforeSpaces ; > + autoIndent: true ; > + encloseSelection: false ; > + destructiveBackWord: false ; > + blinkingCursor: true ; > + dumbbellCursor: false. > PluggableTextMorph simpleFrameAdornments: false. > TextMorphForEditView draggableTextSelection: true. > - "Windows" > > + "Windows" > SystemWindow reuseWindows: false. > SystemWindow windowsRaiseOnClick: true. > SystemWindow windowTitleActiveOnFirstClick: true. > - Model windowActiveOnFirstClick: false. > - "Not good for little screen real estate." > - Model useColorfulWindows: false. > - > - Preferences disable: #fastDragWindowForMorphic. > + Model windowActiveOnFirstClick: false. "Not good for little screen real estate." > + Model useColorfulWindows: false. > + > + Preferences > + disable: #fastDragWindowForMorphic. > AbstractResizerMorph > gripThickness: 4; > handleLength: 25. > CornerGripMorph > drawCornerResizeHandles: false; > drawEdgeResizeHandles: false. > ProportionalSplitterMorph > showSplitterHandles: false; > smartHorizontalSplitters: false; > smartVerticalSplitters: false. > - > + > "Scroll bars." > Preferences > enable: #scrollBarsNarrow; > enable: #scrollBarsOnRight; > enable: #alwaysHideHScrollbar; > disable: #alwaysShowHScrollbar; > disable: #alwaysShowVScrollbar. > ScrollBar > scrollBarsWithoutArrowButtons: true; > scrollBarsWithoutMenuButton: true. > - ScrollPane useRetractableScrollBars: false. > - > + ScrollPane > + useRetractableScrollBars: false. > + > "Rounded corners." > Morph preferredCornerRadius: 8. > SystemWindow roundedWindowCorners: false. > DialogWindow roundedDialogCorners: false. > MenuMorph roundedMenuCorners: false. > PluggableButtonMorph roundedButtonCorners: false. > ScrollBar roundedScrollBarLook: false. > > "Gradients." > SystemWindow gradientWindow: false. > DialogWindow gradientDialog: false. > MenuMorph gradientMenu: false. > PluggableButtonMorph gradientButton: false. > ScrollBar gradientScrollBar: false. > - > + > "Shadows" > Preferences enable: #menuAppearance3d. > Morph useSoftDropShadow: true. > > "Lists and Trees" > PluggableListMorph > filterableLists: true; > clearFilterAutomatically: false; > clearFilterDelay: 500; > highlightHoveredRow: true; > highlightPreSelection: false; > menuRequestUpdatesSelection: true. > PluggableTreeMorph > filterByLabelsOnly: false; > maximumSearchDepth: 1. > > "Standard Tools" > TheWorldMainDockingBar > showWorldMainDockingBar: true; > showSecondsInClock: true; > twentyFourHourClock: true. > SearchBar useSmartSearch: true. > Workspace shouldStyle: false. > TranscriptStream > forceUpdate: true; > redirectToStdOut: false; > characterLimit: 20000. > Browser > listClassesHierarchically: true; > showClassIcons: true; > showMessageIcons: true; > sortMessageCategoriesAlphabetically: true. > SystemBrowser browseWithDragNDrop: true. > MessageSet useUnifiedMessageLabels: true. > Preferences > enable: #annotationPanes; > - defaultAnnotationRequests: #(#timeStamp #author #messageCategory #implementorsCount #allChangeSets); > + defaultAnnotationRequests: #(timeStamp author messageCategory implementorsCount allChangeSets); > enable: #optionalButtons; > disable: #diffsWithPrettyPrint; > enable: #traceMessages; > enable: #alternativeBrowseIt; > enable: #menuWithIcons; > enable: #visualExplorer. > Preferences disable: #debugLogTimestamp. > + > "Halo" > - > Preferences > - enable: #showBoundsInHalo; > + enable: #showBoundsInHalo ; > disable: #alternateHandlesLook; > disable: #showDirectionHandles. > Morph > haloForAll: true; > metaMenuForAll: true. > - > + > "System" > - NetNameResolver enableIPv6: true. > + NetNameResolver enableIPv6: false. > Scanner > allowUnderscoreAsAssignment: true; > prefAllowUnderscoreSelectors: true. > - > + > Deprecation showDeprecationWarnings: true > + > "that's all, folks" > > TextEditor class>>autoEnclose {preferences} · ct 11/1/2021 20:26 (changed) > autoEnclose > - <preference: 'Auto enclose brackets () {} []' > - categoryList: #('Morphic' 'editing') > - description: 'When true, typing an opening parenthesis, bracket or square-bracket will also add its corresponding closing character after the cursor so you can type within the bracket.' > - type: #Boolean> > - > - ^ AutoEnclose ifNil: [ false ] > + > + ^ AutoEnclose ifNil: [#never] > > TextEditor class>>autoEnclose: {preferences} · ct 11/1/2021 20:30 (changed) > - autoEnclose: aBoolean > - AutoEnclose := aBoolean > + autoEnclose: aSymbol > + > + aSymbol == true ifTrue: [ > + "backward compatibility." > + ^ self autoEnclose: #always]. > + > + self assert: [#(always beforeSpaces never) includes: aSymbol]. > + > + AutoEnclose := aSymbol. > > TextEditor class>>autoEncloseAlways {preferences} · ct 11/1/2021 21:48 > + autoEncloseAlways > + <preference: 'Auto enclose all brackets () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character will ALWAYS add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #always > > TextEditor class>>autoEncloseAlways: {preferences} · ct 11/1/2021 20:32 > + autoEncloseAlways: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#always] > + ifFalse: [#never]). > > TextEditor class>>autoEncloseBeforeSpaces {preferences} · ct 11/1/2021 21:49 > + autoEncloseBeforeSpaces > + <preference: 'Auto enclose brackets before spaces only () {} [] '''' "" || <>' > + categoryList: #('Morphic' 'editing') > + description: 'When true, typing an opening character BEFORE some space will add its corresponding closing character after the cursor so you can type within the bracket.' > + type: #Boolean> > + > + ^ self autoEnclose = #beforeSpaces > > TextEditor class>>autoEncloseBeforeSpaces: {preferences} · ct 11/1/2021 20:32 > + autoEncloseBeforeSpaces: aBoolean > + > + self autoEnclose: (aBoolean > + ifTrue: [#beforeSpaces] > + ifFalse: [#never]). > > TextEditor>>autoEncloseFor: {typing support} · ct 11/1/2021 20:28 (changed) > autoEncloseFor: typedChar > "Answer whether typeChar was handled by auto-enclosure. Caller should call normalCharacter if not." > | openers closers | > + self class autoEnclose = #never > + ifTrue: [ ^ false ]. > + (self class autoEnclose = #beforeSpaces > + ==> [ self string at: self startIndex ifPresent: [:c | c isSeparator] ifAbsent: [true] ]) > + ifFalse: [ ^ false ]. > + > openers := '([{'. > closers := ')]}'. > (closers includes: typedChar) ifTrue: > [ | pos | > self blinkPrevParen: typedChar. > ((pos := self indexOfNextNonwhitespaceCharacter) notNil and: [ (paragraph string at: pos) = typedChar ]) > ifTrue: > [ self > moveCursor: [ : position | position + pos - pointBlock stringIndex + 1 ] > forward: true > select: false. > ^ true ] > ifFalse: [ ^ false ] ]. > (openers includes: typedChar) ifTrue: > [ self > openTypeIn; > addString: typedChar asString; > addString: (closers at: (openers indexOf: typedChar)) asString; > insertAndCloseTypeIn; > > moveCursor: [ : position | position - 1 ] > forward: false > select: false. > ^ true ]. > ^ false > > TextEditor>>dispatchOnKeyboardEvent: {typing support} · ct 11/1/2021 20:28 (changed) > dispatchOnKeyboardEvent: aKeyboardEvent > "Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it." > > | honorCommandKeys typedChar | > typedChar := aKeyboardEvent keyCharacter. > > "Handle one-line input fields." > (typedChar == Character cr and: [morph acceptOnCR]) > ifTrue: [^ true]. > > "Clear highlight for last opened parenthesis." > self clearParens. > > "Handle line breaks and auto indent." > typedChar == Character cr ifTrue: [ > aKeyboardEvent controlKeyPressed > ifTrue: [^ self normalCharacter: aKeyboardEvent]. > aKeyboardEvent shiftPressed > ifTrue: [^ self lf: aKeyboardEvent]. > aKeyboardEvent commandKeyPressed > ifTrue: [^ self crlf: aKeyboardEvent]. > ^ self crWithIndent: aKeyboardEvent]. > > "Handle indent/outdent with selected text block." > typedChar == Character tab ifTrue: [ > aKeyboardEvent shiftPressed > ifTrue: [self outdent: aKeyboardEvent. ^ true] > ifFalse: [self hasMultipleLinesSelected > ifTrue: [self indent: aKeyboardEvent. ^ true]]]. > > honorCommandKeys := Preferences cmdKeysInText. > > (honorCommandKeys and: [typedChar == Character enter]) > ifTrue: [^ self dispatchOnEnterWith: aKeyboardEvent]. > > "Special keys overwrite crtl+key combinations - at least on Windows. To resolve this > conflict, assume that keys other than cursor keys aren't used together with Crtl." > ((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) > and: [aKeyboardEvent keyValue < 27]) > ifTrue: [^ aKeyboardEvent controlKeyPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "backspace, and escape keys (ascii 8 and 27) are command keys" > ((honorCommandKeys and: [aKeyboardEvent commandKeyPressed]) > or: [self class specialShiftCmdKeys includes: aKeyboardEvent keyValue]) > ifTrue: [ ^ aKeyboardEvent shiftPressed > ifTrue: [self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent] > ifFalse: [self > perform: (self class cmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]]. > > "the control key can be used to invoke shift-cmd shortcuts" > (honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) > ifTrue: [^ self > perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1) > with: aKeyboardEvent]. > > "Enclose selection with brackets etc." > ((self class encloseSelection and: [self hasSelection]) and: [self enclose: aKeyboardEvent]) > ifTrue: [^ true]. > > "Automatically enclose paired characters such as brackets." > - (self class autoEnclose and: [self autoEncloseFor: typedChar]) > + (self autoEncloseFor: typedChar) > ifTrue: [^ true]. > > "Even if no enclosing feature was used, highlight the matching bracket when closing one." > (')]}' includes: typedChar) > ifTrue: [self blinkPrevParen: typedChar]. > > self normalCharacter: aKeyboardEvent. > ^ false > > --- > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk] > > On 2021-11-05T19:46:16-05:00, asqueaker at gmail.com<http://gmail.com> wrote: > > > Hi Christoph, > > > > This changeset refines the existing autoEnclose mechanism. Instead of > > > having inserted enclosing brackets always, you can now activate a new > > > preference to only insert these characters if there is any space after the > > > cursor. > > > > > > Hopefully also when the cursor is at the end of the text, too (I didn't > > test it). > > > > > I am not sure whether a single preference would fit everyone's needs. > > > > It seems like this feature should not disrupt expression-editing at all, > > which is what I made autoEnclose for. > > > > Thanks, > > Chris > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211105/7d2cc226/attachment.html> > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211201/9eecd3ee/attachment.html> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: TextEditor-autoEncloseFor.st > Type: application/octet-stream > Size: 1261 bytes > Desc: not available > URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211201/9eecd3ee/attachment.obj> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211201/3c0fafb7/attachment.html>
-- _,,,^..^,,,_ best, Eliot
-- _,,,^..^,,,_ best, Eliot
-- _,,,^..^,,,_ best, Eliot
On 2021-12-22, at 10:10 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
Err, yeah; it's only the way we old farts have been doing it for about 40 years. The idea of simply hitting '[' and not getting an actual [ on its own is horrifying. If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[ ; I'll admit that the idea of using cmd-] to remove has some possible merit and might be enough to make me remember it.
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
And surely any cmd-T to make an ifTrue should actually insert ifTrue: [ anyway? And then maybe cmd-ctl-shift-t with a selection should make it ifTrue: [previous selection] ?? And then clearly cmd-shift-ctl-meta-t should do ifTrue: [previous selection] ifFalse: [] ?
I mean, let's go the whole emacs while we're at it...
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RBR: Remove Bits Randomly
Hi Tim,
thanks for the clarification. This (command + bracket) does indeed seem not tto work on Windows (at least for me) neither with the Alt nor with the Command key (handling of the latter is currently buggish at the VM side for win32). To help me to reproduce this, could you maybe send me a screenshot of the keyboard exerciser (in the parts bin tool > demo) after pressing command + bracket and hover the recorded event? :-)
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
No objection.
And surely any cmd-T to make an ifTrue should actually insert
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von tim Rowledge tim@rowledge.org Gesendet: Mittwoch, 22. Dezember 2021 19:28:02 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On 2021-12-22, at 10:10 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
Err, yeah; it's only the way we old farts have been doing it for about 40 years. The idea of simply hitting '[' and not getting an actual [ on its own is horrifying. If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[ ; I'll admit that the idea of using cmd-] to remove has some possible merit and might be enough to make me remember it.
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
And surely any cmd-T to make an ifTrue should actually insert ifTrue: [ anyway? And then maybe cmd-ctl-shift-t with a selection should make it ifTrue: [previous selection] ?? And then clearly cmd-shift-ctl-meta-t should do ifTrue: [previous selection] ifFalse: [] ?
I mean, let's go the whole emacs while we're at it...
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RBR: Remove Bits Randomly
On Dec 22, 2021, at 11:03 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Hi Tim,
thanks for the clarification. This (command + bracket) does indeed seem not tto work on Windows (at least for me) neither with the Alt nor with the Command key (handling of the latter is currently buggish at the VM side for win32). To help me to reproduce this, could you maybe send me a screenshot of the keyboard exerciser (in the parts bin tool > demo) after pressing command + bracket and hover the recorded event? :-)
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
No objection.
And surely any cmd-T to make an ifTrue should actually insert
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
?!?! This is a Smalltalk editor we’re talking about and ifTrue:/ifFalse: is an extremely common sequence, in good code. I find it alarmingly arrogant that you express skepticism about something that has been supported for decades.
Best,
Christoph
Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von tim Rowledge tim@rowledge.org Gesendet: Mittwoch, 22. Dezember 2021 19:28:02 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On 2021-12-22, at 10:10 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
Err, yeah; it's only the way we old farts have been doing it for about 40 years. The idea of simply hitting '[' and not getting an actual [ on its own is horrifying. If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[ ; I'll admit that the idea of using cmd-] to remove has some possible merit and might be enough to make me remember it.
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
And surely any cmd-T to make an ifTrue should actually insert ifTrue: [ anyway? And then maybe cmd-ctl-shift-t with a selection should make it ifTrue: [previous selection] ?? And then clearly cmd-shift-ctl-meta-t should do ifTrue: [previous selection] ifFalse: [] ?
I mean, let's go the whole emacs while we're at it...
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RBR: Remove Bits Randomly
Hi Eliot,
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
?!?! This is a Smalltalk editor we’re talking about and ifTrue:/ifFalse: is an extremely common sequence, in good code. I find it alarmingly arrogant that you express skepticism about something that has been supported for decades.
I did *not* request to remove this shortcut because I understand that some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains. A developer working in another domain (that abstracts from booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
Best, Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Eliot Miranda eliot.miranda@gmail.com Gesendet: Mittwoch, 22. Dezember 2021 20:49:00 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On Dec 22, 2021, at 11:03 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Hi Tim,
thanks for the clarification. This (command + bracket) does indeed seem not tto work on Windows (at least for me) neither with the Alt nor with the Command key (handling of the latter is currently buggish at the VM side for win32). To help me to reproduce this, could you maybe send me a screenshot of the keyboard exerciser (in the parts bin tool > demo) after pressing command + bracket and hover the recorded event? :-)
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
No objection.
And surely any cmd-T to make an ifTrue should actually insert
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
?!?! This is a Smalltalk editor we’re talking about and ifTrue:/ifFalse: is an extremely common sequence, in good code. I find it alarmingly arrogant that you express skepticism about something that has been supported for decades.
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von tim Rowledge tim@rowledge.org Gesendet: Mittwoch, 22. Dezember 2021 19:28:02 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On 2021-12-22, at 10:10 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
Err, yeah; it's only the way we old farts have been doing it for about 40 years. The idea of simply hitting '[' and not getting an actual [ on its own is horrifying. If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[ ; I'll admit that the idea of using cmd-] to remove has some possible merit and might be enough to make me remember it.
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
And surely any cmd-T to make an ifTrue should actually insert ifTrue: [ anyway? And then maybe cmd-ctl-shift-t with a selection should make it ifTrue: [previous selection] ?? And then clearly cmd-shift-ctl-meta-t should do ifTrue: [previous selection] ifFalse: [] ?
I mean, let's go the whole emacs while we're at it...
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RBR: Remove Bits Randomly
On 2021-12-22, at 11:59 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
I did *not* request to remove this shortcut because I understand that some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
Eliot's point is important - this is a *Smalltalk* editor we are dealing with. *If* you are intending to write a general purpose editor then there are quite different needs and the keystroke programming tool I mentioned a moment ago would be of considerable help.
A developer working in another domain (that abstracts from booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc.
General purpose, programmable, mumble, see above. It seems as if you are making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty much all text-things being the same with the same menu even when inappropriate. We should do better.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Full of wisdumb.
On 2021-12-22, at 12:06 PM, tim Rowledge tim@rowledge.org wrote: *If* you are intending to write a general purpose editor then there are quite different needs and the keystroke programming tool I mentioned a moment ago would be of considerable help.
For some idea about how complex this can be, look at the history of the Sophie project fr om - good grief! - 15+ years ago.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: BPB: Branch on Program Bug
Hi Christoph,
On Dec 22, 2021, at 11:59 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Hi Eliot,
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
?!?! This is a Smalltalk editor we’re talking about and ifTrue:/ifFalse: is an extremely common sequence, in good code. I find it alarmingly arrogant that you express skepticism about something that has been supported for decades.
I did *not* request to remove this shortcut because I understand that some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
But the editor is explicitly divided into a domain-independent TextEditor and a domain-specific SmalltalkEditor anyway. So your objection is not relevant. We’re discussing (I hope) the accelerator keys for the SmalltalkEditor.
A developer working in another domain (that abstracts from booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are they?
Best, Christoph Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Eliot Miranda eliot.miranda@gmail.com Gesendet: Mittwoch, 22. Dezember 2021 20:49:00 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On Dec 22, 2021, at 11:03 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Hi Tim,
thanks for the clarification. This (command + bracket) does indeed seem not tto work on Windows (at least for me) neither with the Alt nor with the Command key (handling of the latter is currently buggish at the VM side for win32). To help me to reproduce this, could you maybe send me a screenshot of the keyboard exerciser (in the parts bin tool > demo) after pressing command + bracket and hover the recorded event? :-)
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
No objection.
And surely any cmd-T to make an ifTrue should actually insert
Please let's not raise a fuss for this in this thread. :-) I'm skeptical about cmd-F/T at all. Smalltalk is a general-purpose language that (thankfully!) does not even have any built-in syntactic overhead for logical constructs such as conditions or loops. Providing such domain-specific shortcuts in the default tooling feels completely wrong to me. Apart from that, we will need to discuss pretty-printers and coding style preferences in a broader context at some later point in time. See also: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-May/215416.html
?!?! This is a Smalltalk editor we’re talking about and ifTrue:/ifFalse: is an extremely common sequence, in good code. I find it alarmingly arrogant that you express skepticism about something that has been supported for decades.
Best,
Christoph
Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von tim Rowledge tim@rowledge.org Gesendet: Mittwoch, 22. Dezember 2021 19:28:02 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
On 2021-12-22, at 10:10 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote:
Or do you actually hit *command* + [ rather than just [? If yes, why? On Windows, command + bracket does not show any effect at all for me.
Err, yeah; it's only the way we old farts have been doing it for about 40 years. The idea of simply hitting '[' and not getting an actual [ on its own is horrifying. If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[ ; I'll admit that the idea of using cmd-] to remove has some possible merit and might be enough to make me remember it.
An important point that seems to get forgotten too often is that *typing* some text is a small fraction of the job. *Editing* it will usually occupy much more time, and is typically more fiddly because you have to fairly precisely select text and then operate on it. I'll take improvements to *editing* over improvements on *typing afresh* any day. Anyone that doesn't pretend they get it perfectly correct first time (and they are lying) should prefer it.
And surely any cmd-T to make an ifTrue should actually insert ifTrue: [ anyway? And then maybe cmd-ctl-shift-t with a selection should make it ifTrue: [previous selection] ?? And then clearly cmd-shift-ctl-meta-t should do ifTrue: [previous selection] ifFalse: [] ?
I mean, let's go the whole emacs while we're at it...
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: RBR: Remove Bits Randomly
On 2021-12-22, at 11:03 AM, Thiede, Christoph Christoph.Thiede@student.hpi.uni-potsdam.de wrote: To help me to reproduce this, could you maybe send me a screenshot of the keyboard exerciser (in the parts bin tool > demo) after pressing command + bracket and hover the recorded event? :-)
Can't help with anything to do with Windows since I Don't Do Windows. Other than a few minutes exposure occasionally when using the Nanaimo MakerSPace 3D printers I haven't used it since about 1996.
This is on a Pi 64bit OS -
I updated an image to 20892 to try this out. The current default setting is most *definitely* not my choice. Turning on 'Enclose selection with..' at least makes wrapping a selection work ... but without cmd? Absolutely unacceptable. I cannot imagine where that would be a good thing and I certainly won't allow it in my images.
Why does this tool show that [ and \ are both 'squeak1'? OK, it does show the actual key char properly in the hover-thing... weird.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Do you like me for my brain or my baud?
I don't think there are any keys (outside of the small list of control keys such as backspace, arrow-X and maybe one or two others that escape me right now) that should have any meta effect on their own. If I type a { then it should obey the standard rules - which really haven't needed any notable change since Larry Tesler came up with them circa 1978 (?) - of replacing the selection. cmd=[ can do whatever is needed since it is a command.
If you really want to mess around with this kind of thing I'd suggest making a proper config tool that let's you configure every available key and meta combination, with saveable mappings attached to the prefs so you can have whatever you personally want.
BBEdit has one such tool -
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Mommy! The cursor's winking at me!
Hi,
Am Mi., 22. Dez. 2021 um 19:28 Uhr schrieb tim Rowledge tim@rowledge.org:
If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Kind regards, Jakob
PS. For what it's worth, I always enable auto enclose and enclose selection, as well as Autocompletion.
On 2021-12-22, at 1:04 PM, Jakob Reschke jakres+squeak@gmail.com wrote:
Hi,
Am Mi., 22. Dez. 2021 um 19:28 Uhr schrieb tim Rowledge tim@rowledge.org:
If I want to enclose a block of text I expect to do cmd-[. If I want to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Good grief; that's awful! But see previous comments about not using Windows....
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful Latin Phrases:- Fac ut vivas. = Get a life.
Am Do., 23. Dez. 2021 um 01:44 Uhr schrieb tim Rowledge tim@rowledge.org:
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Good grief; that's awful! But see previous comments about not using Windows....
To be fair, it would be the same on Linux. Until I activate my power user genes and do something about the keyboard input handling, which I can also do on Windows. I just don't want to, only to support one program's shortcut that I can even live without thanks to enclose selection. ;-)
I think you're adding a lot of evidence to support the need for a proper keyboard configuration tool/pref. Sadly it's almost certainly too late to make one for this release.
On 2021-12-23, at 3:05 AM, Jakob Reschke jakres+squeak@gmail.com wrote:
Am Do., 23. Dez. 2021 um 01:44 Uhr schrieb tim Rowledge tim@rowledge.org:
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Good grief; that's awful! But see previous comments about not using Windows....
To be fair, it would be the same on Linux. Until I activate my power user genes and do something about the keyboard input handling, which I can also do on Windows. I just don't want to, only to support one program's shortcut that I can even live without thanks to enclose selection. ;-)
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Life by Norman Rockwell, but screenplay by Stephen King.
I am not following this discussion closely, mainly because I do not use keyboard shortcuts very much. However, it strikes me that we have two competing discussions going on here, and I suspect that we may be "talking past each other".
On Wed, Dec 22, 2021 at 10:04:45PM +0100, Jakob Reschke wrote:
Am Mi., 22. Dez. 2021 um 19:28 Uhr schrieb tim Rowledge tim@rowledge.org:
If I want to enclose a block of text I expect to do cmd-[. If I want
to remove the [] from an enclosed block I expect to select the text inside the [] and hit cmd-[
Discussion theme #1: Keyboard shortcuts should not do strange and unexpected things. Expectations vary, but muscle memory is important.
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Dicussion theme #2: Keyboard shortcuts should behave in sensible ways for international keyboards, not just for US or British layouts.
It is not easy to address theme #2 without causing problems for theme #1.
Jakob
PS. For what it's worth, I always enable auto enclose and enclose selection, as well as Autocompletion.
And I always turn them off right away, which is why I probably should not be commenting on this thread ;-)
Dave
Am Do., 23. Dez. 2021 um 01:51 Uhr schrieb David T. Lewis lewis@mail.msen.com:
Discussion theme #1: Keyboard shortcuts should not do strange and unexpected things. Expectations vary, but muscle memory is important.
Dicussion theme #2: Keyboard shortcuts should behave in sensible ways for international keyboards, not just for US or British layouts.
Discussion theme #3: the merits of ifTrue:ifFalse: shortcuts or language support. I use them a lot. I like it when the computer does some work for me.
And I always turn them off right away, which is why I probably should not be commenting on this thread ;-)
Always welcome for the statistics ;-)
Hi,
Am Do., 23. Dez. 2021 um 01:51 Uhr schrieb David T. Lewis lewis@mail.msen.com:
Discussion theme #1: Keyboard shortcuts should not do strange and unexpected things. Expectations vary, but muscle memory is important.
As a matter of fact, modern code editors (e. g. VS Code, Atom, Brackets) adopt the enclose selection and auto enclose behaviors as defaults. But one can find debates over it elsewhere, just like it is a requested feature if it is missing [1][2][3][4][5].
So I do not believe we will be able to agree on the "best" default for these preferences. Under these circumstances, to not require further clicks from either group in the future, we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time (and tell the user about it), and for each fresh image to come, load that before showing the wizard (and tell the user about it). I believe similar things have already been proposed multiple times in previous threads. If an error occurs while reading the file, ignore it and show the wizard with "factory settings".
Most young people arriving in my team at work naturally start working on our C codebase with VS Code (rather than with what is recommended in the Wiki, so it seems to be a general contemporary favorite). So they may already be used to the enclose behavior from their modern code editors. When they also encounter it in Squeak they *may* think: "oh nice, Squeak can do that too." If they do hate it here and there, I think they will actively seek ways to turn it off. If they did like it in other editors but never see it in Squeak by default, I believe it is more likely that they will mistakenly assume that Squeak simply does not support it. I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
That's why I would vote for showing off all the bells and whistles by default, and make it easy to disable them if they are annoying. Combined with the automatic loading of preferences defaults, this could be achieved without bothering our experienced community members who have already found their preferences and do not want to get annoyed or do not want to click in the wizard in every new image.
When everything is on by default, another helpful thing for contested preferences could be a non-interrupting popup in a corner of the world asking something like: "Did you find that useful? If not you can disable it in the preferences _here_ ...", which goes away if not used and does not show up if the preference has already been set deliberately (e.g. through the defaults file).
If none of this meets endorsement, I will just shrug and continue to toggle the preferences in the wizard in every new image. I am relaxed about this one even though I wrote so much text once again. o:-)
Kind regards, Jakob
[1] https://github.com/microsoft/vscode/issues/34606 [2] https://stackoverflow.com/questions/46470363/disable-automatic-curly-brace-o... [3] https://www.reddit.com/r/learnpython/comments/dg16n2/serious_what_is_the_pur... [4] https://feedback.textasticapp.com/en/communities/1/topics/591-automatically-... [5] https://lists.qt-project.org/pipermail/qt-creator-old/2009-May/003163.html
On 2021-12-23, at 4:39 AM, Jakob Reschke jakres+squeak@gmail.com wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and is almost infinitely customizable. :-(
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge tim@rowledge.org:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and is almost infinitely customizable. :-(
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the "legacy shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel marcel.taeumel@hpi.de: Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge tim@rowledge.org:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and is almost infinitely customizable. :-(
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi all,
Ad discussion theme #1:
If you really want to mess around with this kind of thing I'd suggest making a proper config tool that let's you configure every available key and meta combination, with saveable mappings attached to the prefs so you can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the preferences _here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
Ad discussion theme #2:
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to make use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
Ad discussion theme #3:
General purpose, programmable, mumble, see above. It seems as if you are making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty much all text-things being the same with the same menu even when inappropriate. We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand that some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
But the editor is explicitly divided into a domain-independent TextEditor and a domain-specific SmalltalkEditor anyway. So your objection is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for adding method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are they?
They don't play a special role in the Smalltalk syntax, do they? Booleans are just objects like Collections or Morphs. #ifTrue: is just a selector like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined special selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be mentioned on the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of the most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk and personally I dislike the idea of coupling statistic insights about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative APIs (the Collection API would just be one example) that never make use of the Boolean protocol.
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-12-25T16:03:32+01:00, marcel.taeumel@hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the "legacy shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>: Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi Christoph --
Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to make use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
Did you enable "legacy keyboard shortcuts"? Works fine here on Windows with a US layout. I usually type CMD+ combois with Alt+ but Ctrl+ should work as well.
Best, Marcel Am 26.12.2021 15:52:51 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi all,
Ad discussion theme #1:
If you really want to mess around with this kind of thing I'd suggest making a proper config tool that let's you configure every available key and meta combination, with saveable mappings attached to the prefs so you can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the preferences _here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
Ad discussion theme #2:
Just a remark: out of the box, Cmd-[ is not accessible on a German Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to make use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
Ad discussion theme #3:
General purpose, programmable, mumble, see above. It seems as if you are making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty much all text-things being the same with the same menu even when inappropriate. We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand that some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
But the editor is explicitly divided into a domain-independent TextEditor and a domain-specific SmalltalkEditor anyway. So your objection is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for adding method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are they?
They don't play a special role in the Smalltalk syntax, do they? Booleans are just objects like Collections or Morphs. #ifTrue: is just a selector like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined special selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be mentioned on the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of the most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk and personally I dislike the idea of coupling statistic insights about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative APIs (the Collection API would just be one example) that never make use of the Boolean protocol.
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-12-25T16:03:32+01:00, marcel.taeumel@hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the "legacy shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>: Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here: http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi Christoph,
On Sun, Dec 26, 2021 at 6:52 AM christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all,
*Ad discussion theme #1: *
If you really want to mess around with this kind of thing I'd suggest
making a proper config tool that let's you configure every available key and meta combination, with saveable mappings attached to the prefs so you can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by
default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the preferences
_here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
*Ad discussion theme #2: *
Just a remark: out of the box, Cmd-[ is not accessible on a German
Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to make use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
*Ad discussion theme #3: *
General purpose, programmable, mumble, see above. It seems as if you are
making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty much all text-things being the same with the same menu even when inappropriate. We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand that
some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
But the editor is explicitly divided into a domain-independent
TextEditor and a domain-specific SmalltalkEditor anyway. So your objection is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for adding method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from
booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are they?
They don't play a special role in the Smalltalk syntax, do they? Booleans are just objects like Collections or Morphs. #ifTrue: is just a selector like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined special selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be mentioned on the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of the most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk [...]
but it is. In fact, it is a general property of programming languages. Choice is intrinsic in general purpose programming (less so in stream oriented programming), so much so that it is available in many different forms. Smalltalk provides polymorphic dispatch and closures, from which we derive ifTrue:ifFalse: et al. In functional languages one sees pattern matching. In machine languages one sees conditional jumps and conditional skips. In fact it is definitional that interesting programs involve choice. Even the Mandelbrot set depends on choice: the typical implementation is to ask how many iterations of [image: {\displaystyle f_{c}(z)=z^{2}+c}] does it take for z to converge or diverge to infinity.
So you can rail against ifTrue:/ifFalse: but you are pissing in the rain.
Now let's have a look at the numbers. One might think one could could keywords using:
| keywordCounts | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm selectorsDo: [:s| s isKeyword ifTrue: [keywordCounts addAll: s keywords] ifFalse: [keywordCounts add: s]]. false]]. keywordCounts sortedCounts
but of course this doesn't count inlined messages. So we have to decompile; amd let's generate a report in percentage terms:
| keywordCounts keywordCount | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm methodNode nodesDo: [:n| n isMessageNode ifTrue: [n selector key isKeyword ifTrue: [keywordCounts addAll: n selector key keywords] ifFalse: [keywordCounts add: n selector key]]]. false]]. keywordCount *:=* keywordCounts size. String streamContents: [:s| (keywordCounts sortedCounts first: 100) do: [:assoc| s nextPutAll: assoc value; space; print: assoc key * 100.0 / keywordCount maxDecimalPlaces: 2; cr]]].
#(ifTrue: 5.31 ifFalse: 3.13 = 2.65 at: 2.5 + 2.36 assert: 1.98 == 1.82 new: 1.57 to: 1.41 , 1.41 - 1.35 do: 1.32...
So ifTrue: and ifFalse: are more popular than the next three combined, almost the next four. ifTrue: is twice as likely as the third (=). And lest you think this is my style, the percentages in a VMMaker image are slightly less: ifTrue: 5.24%, ifFalse: 3.05%.
[...] and personally I dislike the idea of coupling statistic insights
about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative APIs (the Collection API would just be one example) that never make use of the Boolean protocol.
Personal preference is no argument for changing the behaviour of a community-developed programming system, is it?
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-25T16:03:32+01:00, marcel.taeumel@hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the "legacy
shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at hpi.de : Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got
lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [ http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... ]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and
is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi Eliot,
I was not sure whether we should continue this debate, because I believe that we are actually not disagreeing but just talking about different things. :-) Anyway, it is an interesting debate and I thank you for your insightful comparison of different language models for choice.
So in general, I was talking about an abstract/conceptual/a priori argument about the pure syntax only where all selectors are equal. I claim that you could *describe* an algebra or a state machine in Smalltalk without using conditional selectors. #ifTrue:/#ifFalse: is common but not without alternatives. As stated before, I did not request to change the existing behavior.
On the other hand, you are talking about statistics and numbers, and I agree with you that #ifTrue:/#ifFalse: are definitively under the top five (how could I deny it...). Actually, in my image, #at: is used more frequently than #ifFalse: (#(ifTrue: 4.56 at: 3.16 ifFalse: 2.7 = 2.33 assert: 1.93)). So consequently, we would also have to talk about mapping Cmd + Shift + A to #at:, since I do think that dynamic state accesses are a general property of programming languages just like explicit conditional choice. Please pardon me if this is an uninteded straw man, in this case I'm interested about learning the difference between those two fundamental properties. :-)
Personal preference is no argument for changing the behaviour of a community-developed programming system, is it?
You're right. :-) Neither we should break a harmless feature that many people are used to (again: I never requested this...), nor we should ignore statistical evidence when publishing a new tool. I guess I was rather having the idea of a minimum complete tool in mind which is intrinsic to Smalltalk, and which would not require any shortcuts at all. Just treat it as a small thought experiment ... :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-12-26T12:26:19-08:00, eliot.miranda@gmail.com wrote:
Hi Christoph,
On Sun, Dec 26, 2021 at 6:52 AM <christoph.thiede at student.hpi.uni-potsdam.de> wrote:
Hi all,
*Ad discussion theme #1: *
If you really want to mess around with this kind of thing I'd suggest
making a proper config tool that let's you configure every available key and meta combination, with saveable mappings attached to the prefs so you can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by
default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the preferences
_here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
*Ad discussion theme #2: *
Just a remark: out of the box, Cmd-[ is not accessible on a German
Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all modifiers that could possibly map to Cmd are already held down. Same issue with curly braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to make use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
*Ad discussion theme #3: *
General purpose, programmable, mumble, see above. It seems as if you are
making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty much all text-things being the same with the same menu even when inappropriate. We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand that
some long-standing Squeakers might have gotten used to it. My argument was only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in the same way, without putting advantages or disadvantages to certain domains.
But the editor is explicitly divided into a domain-independent
TextEditor and a domain-specific SmalltalkEditor anyway. So your objection is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for adding method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from
booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only wanted to present this perspective before we start occupying even more shortcuts for randomly chosen selectors that might be of increased importance for a subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are they?
They don't play a special role in the Smalltalk syntax, do they? Booleans are just objects like Collections or Morphs. #ifTrue: is just a selector like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined special selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be mentioned on the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of the most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk [...]
but it is. In fact, it is a general property of programming languages. Choice is intrinsic in general purpose programming (less so in stream oriented programming), so much so that it is available in many different forms. Smalltalk provides polymorphic dispatch and closures, from which we derive ifTrue:ifFalse: et al. In functional languages one sees pattern matching. In machine languages one sees conditional jumps and conditional skips. In fact it is definitional that interesting programs involve choice. Even the Mandelbrot set depends on choice: the typical implementation is to ask how many iterations of [image: {\displaystyle f_{c}(z)=z^{2}+c}] does it take for z to converge or diverge to infinity.
So you can rail against ifTrue:/ifFalse: but you are pissing in the rain.
Now let's have a look at the numbers. One might think one could could keywords using:
| keywordCounts | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm selectorsDo: [:s| s isKeyword ifTrue: [keywordCounts addAll: s keywords] ifFalse: [keywordCounts add: s]]. false]]. keywordCounts sortedCounts
but of course this doesn't count inlined messages. So we have to decompile; amd let's generate a report in percentage terms:
| keywordCounts keywordCount | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm methodNode nodesDo: [:n| n isMessageNode ifTrue: [n selector key isKeyword ifTrue: [keywordCounts addAll: n selector key
keywords] ifFalse: [keywordCounts add: n selector key]]]. false]]. keywordCount *:=* keywordCounts size. String streamContents: [:s| (keywordCounts sortedCounts first: 100) do: [:assoc| s nextPutAll: assoc value; space; print: assoc key * 100.0 / keywordCount maxDecimalPlaces: 2; cr]]].
#(ifTrue: 5.31 ifFalse: 3.13 = 2.65 at: 2.5
- 2.36
assert: 1.98 == 1.82 new: 1.57 to: 1.41 , 1.41
- 1.35
do: 1.32...
So ifTrue: and ifFalse: are more popular than the next three combined, almost the next four. ifTrue: is twice as likely as the third (=). And lest you think this is my style, the percentages in a VMMaker image are slightly less: ifTrue: 5.24%, ifFalse: 3.05%.
[...] and personally I dislike the idea of coupling statistic insights
about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative APIs (the Collection API would just be one example) that never make use of the Boolean protocol.
Personal preference is no argument for changing the behaviour of a community-developed programming system, is it?
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-25T16:03:32+01:00, marcel.taeumel at hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the "legacy
shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at hpi.de : Hi all --
I am currently collecting the US-specific TextEditor shortcuts that got
lost since Squeak 5.3 to make them available again as a preference-driven event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something like that.
You can help me do that by answering here:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... [ http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783.... ]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor, as far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there and
is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi Christoph,
On Mon, Feb 7, 2022 at 3:05 PM christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Eliot,
I was not sure whether we should continue this debate, because I believe that we are actually not disagreeing but just talking about different things. :-) Anyway, it is an interesting debate and I thank you for your insightful comparison of different language models for choice.
Agreed. It *is* interesting. One of the things I've found in working on Smalltalk and on the VM in Smalltalk is that avoiding conditionals by using polymorphism is great, a very powerful style, but one that works at a granularity of class hierarchies, and is not one that works, for example, on bit level twiddling. So in the VM there are points where the caseOf: statement is very important, and useful (and the same goes for ifTrue:/ifFalse:). I also find that it takes time to evolve a beautiful polymorphic solution and sometimes we are in a position where there is code to be written quickly, and its quality is of less importance than its timeliness. When we're lucky we get to revisit and replace the old crud with nicer, better designed code. But I do know that not all code is able to be so reduced to a beautiful minimum, and that caseOf: & ifTrue:/ifFalse: have their place, and hence that ifTrue:/ifFalse:'s static frequency argues strongly for the keyboard shortcuts.
So in general, I was talking about an abstract/conceptual/a priori argument about the pure syntax only where all selectors are equal. I claim that you could *describe* an algebra or a state machine in Smalltalk without using conditional selectors. #ifTrue:/#ifFalse: is common but not without alternatives. As stated before, I did not request to change the existing behavior.
OK.
On the other hand, you are talking about statistics and numbers, and I agree with you that #ifTrue:/#ifFalse: are definitively under the top five (how could I deny it...). Actually, in my image, #at: is used more frequently than #ifFalse: (#(ifTrue: 4.56 at: 3.16 ifFalse: 2.7 = 2.33 assert: 1.93)). So consequently, we would also have to talk about mapping Cmd + Shift + A to #at:, since I do think that dynamic state accesses are a general property of programming languages just like explicit conditional choice. Please pardon me if this is an uninteded straw man, in this case I'm interested about learning the difference between those two fundamental properties. :-)
I don't find it a straw man.
Personal preference is no argument for changing the behaviour of a
community-developed programming system, is it?
You're right. :-) Neither we should break a harmless feature that many people are used to (again: I never requested this...), nor we should ignore statistical evidence when publishing a new tool. I guess I was rather having the idea of a minimum complete tool in mind which is intrinsic to Smalltalk, and which would not require any shortcuts at all. Just treat it as a small thought experiment ... :-)
Well, I think there's a lot of work still remaining to do with completion. I find completion great only some of the time. I find myself fighting the completion tool a lot when I'm done and want to exit from selecting a completion and return to normal typing. Is it better that, for example, up or down arrow would cause one to exit completion if doing up-arrow on the first completion or down arrow on the last, or that one is trapped within the completion menu and has to type escape to leave it? Would a right arrow be a good escape choice? I think we shoudl be video taping people's editing sessions and analysing it to do a better job because my relationship with completion verges on love/hate :-)
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-26T12:26:19-08:00, eliot.miranda@gmail.com wrote:
Hi Christoph,
On Sun, Dec 26, 2021 at 6:52 AM <christoph.thiede at
student.hpi.uni-potsdam.de>
wrote:
Hi all,
*Ad discussion theme #1: *
If you really want to mess around with this kind of thing I'd suggest
making a proper config tool that let's you configure every available
key
and meta combination, with saveable mappings attached to the prefs so
you
can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by
default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the
preferences
_here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
*Ad discussion theme #2: *
Just a remark: out of the box, Cmd-[ is not accessible on a German
Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all
modifiers
that could possibly map to Cmd are already held down. Same issue with
curly
braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to
make
use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
*Ad discussion theme #3: *
General purpose, programmable, mumble, see above. It seems as if you
are
making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty
much
all text-things being the same with the same menu even when
inappropriate.
We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand
that
some long-standing Squeakers might have gotten used to it. My argument
was
only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in
the
same way, without putting advantages or disadvantages to certain
domains.
But the editor is explicitly divided into a domain-independent
TextEditor and a domain-specific SmalltalkEditor anyway. So your
objection
is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of
SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for
adding
method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from
booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only
wanted
to present this perspective before we start occupying even more
shortcuts
for randomly chosen selectors that might be of increased importance
for a
subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are
they?
They don't play a special role in the Smalltalk syntax, do they?
Booleans
are just objects like Collections or Morphs. #ifTrue: is just a
selector
like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined
special
selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be
mentioned on
the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of
the
most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk [...]
but it is. In fact, it is a general property of programming languages. Choice is intrinsic in general purpose programming (less so in stream oriented programming), so much so that it is available in many different forms. Smalltalk provides polymorphic dispatch and closures, from which we derive ifTrue:ifFalse: et al. In functional languages one sees pattern matching. In machine languages one sees conditional jumps
and
conditional skips. In fact it is definitional that interesting programs involve choice. Even the Mandelbrot set depends on choice: the typical implementation is to ask how many iterations of [image: {\displaystyle f_{c}(z)=z^{2}+c}] does it take for z to converge or diverge to infinity.
So you can rail against ifTrue:/ifFalse: but you are pissing in the rain.
Now let's have a look at the numbers. One might think one could could keywords using:
| keywordCounts | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm selectorsDo: [:s| s isKeyword ifTrue: [keywordCounts addAll: s keywords] ifFalse: [keywordCounts add: s]]. false]]. keywordCounts sortedCounts
but of course this doesn't count inlined messages. So we have to decompile; amd let's generate a report in percentage terms:
| keywordCounts keywordCount | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm methodNode nodesDo: [:n| n isMessageNode ifTrue: [n selector key isKeyword ifTrue: [keywordCounts addAll: n selector key keywords] ifFalse: [keywordCounts add: n selector key]]]. false]]. keywordCount *:=* keywordCounts size. String streamContents: [:s| (keywordCounts sortedCounts first: 100) do: [:assoc| s nextPutAll: assoc value; space; print: assoc key * 100.0 / keywordCount maxDecimalPlaces: 2; cr]]].
#(ifTrue: 5.31 ifFalse: 3.13 = 2.65 at: 2.5
- 2.36
assert: 1.98 == 1.82 new: 1.57 to: 1.41 , 1.41
- 1.35
do: 1.32...
So ifTrue: and ifFalse: are more popular than the next three combined, almost the next four. ifTrue: is twice as likely as the third (=). And lest you think this is my style, the percentages in a VMMaker image are slightly less: ifTrue: 5.24%, ifFalse: 3.05%.
[...] and personally I dislike the idea of coupling statistic insights
about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative
APIs
(the Collection API would just be one example) that never make use of
the
Boolean protocol.
Personal preference is no argument for changing the behaviour of a community-developed programming system, is it?
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-25T16:03:32+01:00, marcel.taeumel at hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the
"legacy
shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at
hpi.de
: Hi all --
I am currently collecting the US-specific TextEditor shortcuts that
got
lost since Squeak 5.3 to make them available again as a
preference-driven
event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something
like
that.
You can help me do that by answering here:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....
[
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....
]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor,
as
far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there
and
is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
On 2022-02-07, at 5:01 PM, Eliot Miranda eliot.miranda@gmail.com wrote:
I think we shoudl be video taping people's editing sessions and analysing it to do a better job because my relationship with completion verges on love/hate :-)
This Old Fart really, really, doesn't like any autocompletion yet experienced *except* for the unix filename completion stuff. Sometimes. Sometimes that sucks too.
There's a reason we call it 'autocockup'
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim An oxymoron walked into a bar, and the silence was deafening.
Hi Eliot,
Nothing more to add. Of course, conditionals have their place and n-ary dispatch is not always the most elegant solution. :-)
Well, I think there's a lot of work still remaining to do with completion. I find completion great only some of the time. I find myself fighting the completion tool a lot when I'm done and want to exit from selecting a completion and return to normal typing. Is it better that, for example, up or down arrow would cause one to exit completion if doing up-arrow on the first completion or down arrow on the last, or that one is trapped within the completion menu and has to type escape to leave it? Would a right arrow be a good escape choice? I think we shoudl be video taping people's editing sessions and analysing it to do a better job because my relationship with completion verges on love/hate :-)
Yes, this is also an interesting construction site. I'm assuming you are using oCompletion? Personally, I'm often using the Autocompletion fork https://github.com/LeonMatthes/Autocompletion which does not only have nice contextual and type-guessed suggestions but also some changes to the keyboard handling iirc. However, most of the time I'm not noticing at all when I am using Autocompletion, which speaks for the intuitivity of the keyboard shortcuts. If you did not try it out yet, you also might want to check Sandblocks https://github.com/hpi-swa/sandblocks with a refreshingly new approach on typing. :-)
Happy Squeaking, Christoph
--- Sent from Squeak Inbox Talk
On 2022-02-07T17:01:13-08:00, eliot.miranda@gmail.com wrote:
Hi Christoph,
On Mon, Feb 7, 2022 at 3:05 PM <christoph.thiede at student.hpi.uni-potsdam.de> wrote:
Hi Eliot,
I was not sure whether we should continue this debate, because I believe that we are actually not disagreeing but just talking about different things. :-) Anyway, it is an interesting debate and I thank you for your insightful comparison of different language models for choice.
Agreed. It *is* interesting. One of the things I've found in working on Smalltalk and on the VM in Smalltalk is that avoiding conditionals by using polymorphism is great, a very powerful style, but one that works at a granularity of class hierarchies, and is not one that works, for example, on bit level twiddling. So in the VM there are points where the caseOf: statement is very important, and useful (and the same goes for ifTrue:/ifFalse:). I also find that it takes time to evolve a beautiful polymorphic solution and sometimes we are in a position where there is code to be written quickly, and its quality is of less importance than its timeliness. When we're lucky we get to revisit and replace the old crud with nicer, better designed code. But I do know that not all code is able to be so reduced to a beautiful minimum, and that caseOf: & ifTrue:/ifFalse: have their place, and hence that ifTrue:/ifFalse:'s static frequency argues strongly for the keyboard shortcuts.
So in general, I was talking about an abstract/conceptual/a priori argument about the pure syntax only where all selectors are equal. I claim that you could *describe* an algebra or a state machine in Smalltalk without using conditional selectors. #ifTrue:/#ifFalse: is common but not without alternatives. As stated before, I did not request to change the existing behavior.
OK.
On the other hand, you are talking about statistics and numbers, and I agree with you that #ifTrue:/#ifFalse: are definitively under the top five (how could I deny it...). Actually, in my image, #at: is used more frequently than #ifFalse: (#(ifTrue: 4.56 at: 3.16 ifFalse: 2.7 = 2.33 assert: 1.93)). So consequently, we would also have to talk about mapping Cmd + Shift + A to #at:, since I do think that dynamic state accesses are a general property of programming languages just like explicit conditional choice. Please pardon me if this is an uninteded straw man, in this case I'm interested about learning the difference between those two fundamental properties. :-)
I don't find it a straw man.
Personal preference is no argument for changing the behaviour of a
community-developed programming system, is it?
You're right. :-) Neither we should break a harmless feature that many people are used to (again: I never requested this...), nor we should ignore statistical evidence when publishing a new tool. I guess I was rather having the idea of a minimum complete tool in mind which is intrinsic to Smalltalk, and which would not require any shortcuts at all. Just treat it as a small thought experiment ... :-)
Well, I think there's a lot of work still remaining to do with completion. I find completion great only some of the time. I find myself fighting the completion tool a lot when I'm done and want to exit from selecting a completion and return to normal typing. Is it better that, for example, up or down arrow would cause one to exit completion if doing up-arrow on the first completion or down arrow on the last, or that one is trapped within the completion menu and has to type escape to leave it? Would a right arrow be a good escape choice? I think we shoudl be video taping people's editing sessions and analysing it to do a better job because my relationship with completion verges on love/hate :-)
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-26T12:26:19-08:00, eliot.miranda at gmail.com wrote:
Hi Christoph,
On Sun, Dec 26, 2021 at 6:52 AM <christoph.thiede at
student.hpi.uni-potsdam.de>
wrote:
Hi all,
*Ad discussion theme #1: *
If you really want to mess around with this kind of thing I'd suggest
making a proper config tool that let's you configure every available
key
and meta combination, with saveable mappings attached to the prefs so
you
can have whatever you personally want.
Sure, why not? But definitely not before the release. :D
That's why I would vote for showing off all the bells and whistles by
default, and make it easy to disable them if they are annoying.
+1
"Did you find that useful? If not you can disable it in the
preferences
_here_ ..."
+1, but only if it can be turned off, and only after the release, of course. :D
*Ad discussion theme #2: *
Just a remark: out of the box, Cmd-[ is not accessible on a German
Windows-type quertz keyboard because we have to use Alt Gr (which is equivalent to Ctrl+Alt) + 8 to type [ in the first place, so all
modifiers
that could possibly map to Cmd are already held down. Same issue with
curly
braces.
Just to note what I have already written to Jakob in private: Even when switching my keyboard layout from Qwertz to Qwerty, I was not able to
make
use of Ctrl-[ or Alt+[ (Win32, VM 202112201228). Is this feature only available on Linux/macOS?
*Ad discussion theme #3: *
General purpose, programmable, mumble, see above. It seems as if you
are
making the mistake of assuming there can only be one editor setup. Currently in Squeak we do rather do that, with the editors for pretty
much
all text-things being the same with the same menu even when
inappropriate.
We should do better.
+1. We already have #pluggableTextSpec vs #pluggableCodePaneSpec but something like a #contentType flag would not harm, too. :-)
I did *not* request to remove this shortcut because I understand
that
some long-standing Squeakers might have gotten used to it. My argument
was
only not to cement this kind of "leaky abstractions". IMHO the editor should be a tool that is suitable for all applications or domains in
the
same way, without putting advantages or disadvantages to certain
domains.
But the editor is explicitly divided into a domain-independent
TextEditor and a domain-specific SmalltalkEditor anyway. So your
objection
is not relevant. We?re discussing (I hope) the accelerator keys for the SmalltalkEditor.
IMO this should rather be part of a separate subclass of
SmalltalkEditor:
Editor: Minimal tool for editing strings (e.g., backspace). TextEditor: Tool for editing formatted strings (e.g., adding/removing attributes). SmalltalkEditor: Tool for editing Smalltalk code (e.g., <opt>1 for
adding
method parameters). ControlFlowStyleSmalltalkEditor: Tool for editing Smalltalk code in the style of low-level control-flow operations such as #whileTrue, #ifTrue:/#ifFalse:, etc.
A developer working in another domain (that abstracts from
booleans/for instance, a query DSL) will be less likely interested in special shortcuts for ifTrue:/ifFalse: but more likely interested in shortcuts for message sends such as #collect:, #select:, etc. I only
wanted
to present this perspective before we start occupying even more
shortcuts
for randomly chosen selectors that might be of increased importance
for a
subset of users of the Smalltalk workspace.
ifTrue:/ifFalse: are hardly randomly selected selectors, now are
they?
They don't play a special role in the Smalltalk syntax, do they?
Booleans
are just objects like Collections or Morphs. #ifTrue: is just a
selector
like #select: or #openInWorld. They are only handled differently by the VM/interpreter for the sake of optimization (value types, inlined
special
selectors, ...). But conceptually, they are nothing special in our beautifully minimal Smalltalk grammar. They do not need to be
mentioned on
the Smalltalk Postcard.
Statistically, you are right of course that #ifTrue: might be one of
the
most popular selectors in most Smalltalk programs. But that is not an intrinsic property of Smalltalk [...]
but it is. In fact, it is a general property of programming languages. Choice is intrinsic in general purpose programming (less so in stream oriented programming), so much so that it is available in many different forms. Smalltalk provides polymorphic dispatch and closures, from which we derive ifTrue:ifFalse: et al. In functional languages one sees pattern matching. In machine languages one sees conditional jumps
and
conditional skips. In fact it is definitional that interesting programs involve choice. Even the Mandelbrot set depends on choice: the typical implementation is to ask how many iterations of [image: {\displaystyle f_{c}(z)=z^{2}+c}] does it take for z to converge or diverge to infinity.
So you can rail against ifTrue:/ifFalse: but you are pissing in the rain.
Now let's have a look at the numbers. One might think one could could keywords using:
| keywordCounts | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm selectorsDo: [:s| s isKeyword ifTrue: [keywordCounts addAll: s keywords] ifFalse: [keywordCounts add: s]]. false]]. keywordCounts sortedCounts
but of course this doesn't count inlined messages. So we have to decompile; amd let's generate a report in percentage terms:
| keywordCounts keywordCount | keywordCounts *:=* Bag new. CurrentReadOnlySourceFiles cacheDuring: [self systemNavigation allSelect: [:cm| cm methodNode nodesDo: [:n| n isMessageNode ifTrue: [n selector key isKeyword ifTrue: [keywordCounts addAll: n selector key keywords] ifFalse: [keywordCounts add: n selector key]]]. false]]. keywordCount *:=* keywordCounts size. String streamContents: [:s| (keywordCounts sortedCounts first: 100) do: [:assoc| s nextPutAll: assoc value; space; print: assoc key * 100.0 / keywordCount maxDecimalPlaces: 2; cr]]].
#(ifTrue: 5.31 ifFalse: 3.13 = 2.65 at: 2.5
- 2.36
assert: 1.98 == 1.82 new: 1.57 to: 1.41 , 1.41
- 1.35
do: 1.32...
So ifTrue: and ifFalse: are more popular than the next three combined, almost the next four. ifTrue: is twice as likely as the third (=). And lest you think this is my style, the percentages in a VMMaker image are slightly less: ifTrue: 5.24%, ifFalse: 3.05%.
[...] and personally I dislike the idea of coupling statistic insights
about API usage to globally predefined shortcuts in the default Trunk image. It is possible to write Smalltalk programs that use alternative
APIs
(the Collection API would just be one example) that never make use of
the
Boolean protocol.
Personal preference is no argument for changing the behaviour of a community-developed programming system, is it?
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2021-12-25T16:03:32+01:00, marcel.taeumel at hpi.de wrote:
Hi all --
Done. See Morphic-mt.1829. cmd+[ etc. is back if you enable the
"legacy
shortcuts" preference.
Best, Marcel Am 25.12.2021 12:47:15 schrieb Marcel Taeumel <marcel.taeumel at
hpi.de
: Hi all --
I am currently collecting the US-specific TextEditor shortcuts that
got
lost since Squeak 5.3 to make them available again as a
preference-driven
event filter on instances of TextEditor. Shouldn't be that hard. I will call the preference "Legacy keyboard shortcuts (US only)" or something
like
that.
You can help me do that by answering here:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....
[
http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217783....
]
Thanks. :-)
Best, Marcel Am 23.12.2021 21:09:53 schrieb tim Rowledge <tim at rowledge.org>:
On 2021-12-23, at 4:39 AM, Jakob Reschke wrote:
I believe that because Squeak does not have a reputation of being a state of the art, customizable code editor,
as
far as I am aware. (Admittedly, no hard facts in this paragraph.)
Which is kind of sad because of course all the code is right there
and
is almost infinitely customizable. :-(
tim
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim Eagles may soar, but weasels aren't sucked into jet engines.
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is - to access a place where some preferences values could be stored - without user input (i. e. they should not have to choose a file or directory first) - independent of the location of the current image file. - The place must be writable. - It must work eventually in a fresh image without extra plugins or packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files: - On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming) - On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1] - On the Mac I don't really know, but according to [2] $HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.) - SqueakJS in the web browser could arbitrarily define a simulated directory in the local storage. - As a last resort, FileDrectory default could be used, although in general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
Hi Jakob,
I’d love to save my preferences once and forget about them!
Sorry if this sounds too naïve but how about a parent folder of the image folder? In my case I store my all image folders under a Squeak folder somewhere… The general lookup could try more locations, the parent directory being one of them.
Thanks, I wish you succeed with this ;)
Jaromir
From: Jakob Reschkemailto:jakres+squeak@gmail.com Sent: Wednesday, December 29, 2021 14:41 To: The general-purpose Squeak developers listmailto:squeak-dev@lists.squeakfoundation.org Subject: [squeak-dev] User config directories (was: Merge Request: autoEncloseBeforeSpace.cs)
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is - to access a place where some preferences values could be stored - without user input (i. e. they should not have to choose a file or directory first) - independent of the location of the current image file. - The place must be writable. - It must work eventually in a fresh image without extra plugins or packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files: - On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming) - On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1] - On the Mac I don't really know, but according to [2] $HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.) - SqueakJS in the web browser could arbitrarily define a simulated directory in the local storage. - As a last resort, FileDrectory default could be used, although in general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
Hi Jaromir,
Using the parent of the image directory may be an improvement, but not an overall solution. I have at least two different locations where I store subdirectories with images (one cloud-synchronized directory and one that is not synchronized). But my preferences are the same in both locations, of course.
Also it might be awkward or not even writable: if you keep your images in /home/yourname or C:\Squeak without a subdirectory per image, for example, you would be trying to use a /home/squeak or /home/prefs or C:\prefs directory (if it goes back into C:\Squeak that might actually be nice, but it is just a special case). In such cases it would indeed be better to use the current directory, but a fresh image will not know how you organize your image files.
I will consider it as an acceptable fallback if we cannot get anything going with the platform's directories.
Kind regards, Jakob
Am Mi., 29. Dez. 2021 um 15:49 Uhr schrieb Jaromir Matas mail@jaromir.net:
Hi Jakob,
I’d love to save my preferences once and forget about them!
Sorry if this sounds too naïve but how about a parent folder of the image folder? In my case I store my all image folders under a Squeak folder somewhere… The general lookup could try more locations, the parent directory being one of them.
Thanks, I wish you succeed with this ;)
Jaromir
From: Jakob Reschke Sent: Wednesday, December 29, 2021 14:41 To: The general-purpose Squeak developers list Subject: [squeak-dev] User config directories (was: Merge Request: autoEncloseBeforeSpace.cs)
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is
- to access a place where some preferences values could be stored
- without user input (i. e. they should not have to choose a file or
directory first)
- independent of the location of the current image file.
- The place must be writable.
- It must work eventually in a fresh image without extra plugins or
packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files:
- On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming)
- On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1]
- On the Mac I don't really know, but according to [2]
$HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.)
- SqueakJS in the web browser could arbitrarily define a simulated
directory in the local storage.
- As a last resort, FileDrectory default could be used, although in
general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
Hi Jakob,
Yes, I meant it as a fallback indeed. I use a simple setup:
D:\Squeak\Squeak_image_subdirectory_1\ D:\Squeak\Squeak_image_subdirectory_2\ etc. So keeping prefs in D:\Squeak would work perfectly for me when a freshly downloaded image folder arrives in D:\Squeak\Squeak_image_subdirectory_3\
Of course it might not even work if all images were in one directory or if they were in root dirctory :)
And how about to place a forwarding information in the parent directory where to find the prefs directory? (if nothing more elegant is available)?
Thanks,
~~~ ^[^ Jaromir
Sent from Squeak Inbox Talk
On 2021-12-30T12:37:45+01:00, jakres+squeak@gmail.com wrote:
Hi Jaromir,
Using the parent of the image directory may be an improvement, but not an overall solution. I have at least two different locations where I store subdirectories with images (one cloud-synchronized directory and one that is not synchronized). But my preferences are the same in both locations, of course.
Also it might be awkward or not even writable: if you keep your images in /home/yourname or C:\Squeak without a subdirectory per image, for example, you would be trying to use a /home/squeak or /home/prefs or C:\prefs directory (if it goes back into C:\Squeak that might actually be nice, but it is just a special case). In such cases it would indeed be better to use the current directory, but a fresh image will not know how you organize your image files.
I will consider it as an acceptable fallback if we cannot get anything going with the platform's directories.
Kind regards, Jakob
Am Mi., 29. Dez. 2021 um 15:49 Uhr schrieb Jaromir Matas <mail at jaromir.net>:
Hi Jakob,
I’d love to save my preferences once and forget about them!
Sorry if this sounds too naïve but how about a parent folder of the image folder? In my case I store my all image folders under a Squeak folder somewhere… The general lookup could try more locations, the parent directory being one of them.
Thanks, I wish you succeed with this ;)
Jaromir
From: Jakob Reschke Sent: Wednesday, December 29, 2021 14:41 To: The general-purpose Squeak developers list Subject: [squeak-dev] User config directories (was: Merge Request: autoEncloseBeforeSpace.cs)
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke <jakres+squeak at gmail.com>:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is
- to access a place where some preferences values could be stored
- without user input (i. e. they should not have to choose a file or
directory first)
- independent of the location of the current image file.
- The place must be writable.
- It must work eventually in a fresh image without extra plugins or
packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files:
- On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming)
- On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1]
- On the Mac I don't really know, but according to [2]
$HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.)
- SqueakJS in the web browser could arbitrarily define a simulated
directory in the local storage.
- As a last resort, FileDrectory default could be used, although in
general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
Yes, this is a problem on a wider scale than just the preferences. Consider the sources file; we really want to keep a single copy and so it should be in a place easily found.
The all-in-one packages have a somewhat convoluted directory structure that isn't the most convenient for daily usage, though at least the sources file is in the same directory as the image.
The platform specific packages have different layouts. We may want to put images in different directories to suit our projects.
Originally the rule was that the sources file would be either next to the image, or next to the VM. IIRC there was a primitive that reported the location as well and I faintly remember the Unix VM having quite the list of places it would look. Now we also have a problem when loading VMs from the autobuilder or after manually building, in that there is the whole sqcogspur64ARMv8linuxht/lib/squeak/5.0-202112201228-64bit/* type path to the VM. We *can't* have the sources file 'next to' the VM in any practical sense here; at least not without either having many copies, or using links. FS links are not something we've ever got to grips with...
And obviously preferences may be systemwide or user local, so we ought to handle those both.
I'm not completely sure what the answer is. On unix one could decide to go with the suggestions at https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html and use /usr/local but then again that appears to be intended for 'admin' users and we all know how hard unix works to prevent mere users from doing anything. Maybe /opt/squeak would be better? That is supposedly for "Add-on application software packages".
Should we use a primitive to locate the directories? We kinda-sorta have a template for that in the ScratchPlugin, and somewhat in the SecurityPlugin. Or we could do it all in the image easily enough, at some cost in platform spread in-image.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Fell out of the family tree.
Hi Tim,
Happy new year!
We need to find the correct directory for both the sources and for the preferences, but the situation is different for each of the two. The source file can be written once at installation time and it needs only be readable while Squeak is running, not writable. It is a resource like man pages or icons. A file with default preferences (in the way I proposed it) cannot be installed beforehand and it needs to be writable while Squeak is running.
For example, you could put the sources under /usr/local/share/squeak or /opt/squeak, but since they are not generally writable, that would not work for the preferences. Also the preferences are user-specific, whereas the source file is not.
Having system-wide Squeak preferences in addition to user-specific preferences would be more of a complete solution, but I think the benefit is marginal. So in my opinion we should not invest in this at present. Or does somebody use Squeak from different user accounts on the same machine regularly?
Kind regards, Jakob
Am Fr., 31. Dez. 2021 um 01:09 Uhr schrieb tim Rowledge tim@rowledge.org:
Yes, this is a problem on a wider scale than just the preferences. Consider the sources file; we really want to keep a single copy and so it should be in a place easily found.
The all-in-one packages have a somewhat convoluted directory structure that isn't the most convenient for daily usage, though at least the sources file is in the same directory as the image.
The platform specific packages have different layouts. We may want to put images in different directories to suit our projects.
Originally the rule was that the sources file would be either next to the image, or next to the VM. IIRC there was a primitive that reported the location as well and I faintly remember the Unix VM having quite the list of places it would look. Now we also have a problem when loading VMs from the autobuilder or after manually building, in that there is the whole sqcogspur64ARMv8linuxht/lib/squeak/5.0-202112201228-64bit/* type path to the VM. We *can't* have the sources file 'next to' the VM in any practical sense here; at least not without either having many copies, or using links. FS links are not something we've ever got to grips with...
And obviously preferences may be systemwide or user local, so we ought to handle those both.
I'm not completely sure what the answer is. On unix one could decide to go with the suggestions at https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html and use /usr/local but then again that appears to be intended for 'admin' users and we all know how hard unix works to prevent mere users from doing anything. Maybe /opt/squeak would be better? That is supposedly for "Add-on application software packages".
Should we use a primitive to locate the directories? We kinda-sorta have a template for that in the ScratchPlugin, and somewhat in the SecurityPlugin. Or we could do it all in the image easily enough, at some cost in platform spread in-image.
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Fell out of the family tree.
I use Squeak on several different platforms and would like the Preferences to be saved via Monticello. Make a separate project for preferences and we could just load our own latest version.
For example http://source.squeak.org/preferences
Best,
Karl
On Sun, Jan 2, 2022 at 9:07 PM Jakob Reschke jakres+squeak@gmail.com wrote:
Hi Tim,
Happy new year!
We need to find the correct directory for both the sources and for the preferences, but the situation is different for each of the two. The source file can be written once at installation time and it needs only be readable while Squeak is running, not writable. It is a resource like man pages or icons. A file with default preferences (in the way I proposed it) cannot be installed beforehand and it needs to be writable while Squeak is running.
For example, you could put the sources under /usr/local/share/squeak or /opt/squeak, but since they are not generally writable, that would not work for the preferences. Also the preferences are user-specific, whereas the source file is not.
Having system-wide Squeak preferences in addition to user-specific preferences would be more of a complete solution, but I think the benefit is marginal. So in my opinion we should not invest in this at present. Or does somebody use Squeak from different user accounts on the same machine regularly?
Kind regards, Jakob
Am Fr., 31. Dez. 2021 um 01:09 Uhr schrieb tim Rowledge <tim@rowledge.org
:
Yes, this is a problem on a wider scale than just the preferences.
Consider the sources file; we really want to keep a single copy and so it should be in a place easily found.
The all-in-one packages have a somewhat convoluted directory structure
that isn't the most convenient for daily usage, though at least the sources file is in the same directory as the image.
The platform specific packages have different layouts. We may want to
put images in different directories to suit our projects.
Originally the rule was that the sources file would be either next to
the image, or next to the VM. IIRC there was a primitive that reported the location as well and I faintly remember the Unix VM having quite the list of places it would look. Now we also have a problem when loading VMs from the autobuilder or after manually building, in that there is the whole sqcogspur64ARMv8linuxht/lib/squeak/5.0-202112201228-64bit/* type path to the VM. We *can't* have the sources file 'next to' the VM in any practical sense here; at least not without either having many copies, or using links. FS links are not something we've ever got to grips with...
And obviously preferences may be systemwide or user local, so we ought
to handle those both.
I'm not completely sure what the answer is. On unix one could decide to
go with the suggestions at https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html and use /usr/local but then again that appears to be intended for 'admin' users and we all know how hard unix works to prevent mere users from doing anything. Maybe /opt/squeak would be better? That is supposedly for "Add-on application software packages".
Should we use a primitive to locate the directories? We kinda-sorta have
a template for that in the ScratchPlugin, and somewhat in the SecurityPlugin. Or we could do it all in the image easily enough, at some cost in platform spread in-image.
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Fell out of the family tree.
We already have some mechanism for this, though I wouldn't claim it is particularly magnificent. See ExternalSettings class>>#preferenceDirectory etc. I use it for work/server preferences, with the file format described being OK but maybe better if we used JSON instead?
The location of the directory can certainly be a pain, but I've already ranted about the location of the sources file and this is a similar case. But let's not get involved in anything to do with the Windows registry; we all know that leads to weakening of the walls between us and the Dungeon Dimensions.
On 2021-12-29, at 5:40 AM, Jakob Reschke jakres+squeak@gmail.com wrote:
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is
- to access a place where some preferences values could be stored
- without user input (i. e. they should not have to choose a file or
directory first)
- independent of the location of the current image file.
- The place must be writable.
- It must work eventually in a fresh image without extra plugins or
packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files:
- On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming)
- On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1]
- On the Mac I don't really know, but according to [2]
$HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.)
- SqueakJS in the web browser could arbitrarily define a simulated
directory in the local storage.
- As a last resort, FileDrectory default could be used, although in
general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: DSO: Do Something or Other
Hi Tim,
I have looked into it and it stores the "prefs" directory in the FileDirectory default, or in SecurityManager default secureUserDirectory if Preferences startInUntrustedDirectory is enabled. In my image, both locations depend on the directory of the running image, so it would not satisfy my requirements as is.
Also the mechanism seems to load preferences on every image startup, which is not strictly necessary for those preferences we have been discussing about.
Nevertheless, of course it is good that code for the reading and writing of preferences is already there. Since there are also the buttons to export and import preferences manually, I expected that I would not have to write this from scratch.
Kind regards, Jakob
Am Mi., 29. Dez. 2021 um 19:25 Uhr schrieb tim Rowledge tim@rowledge.org:
We already have some mechanism for this, though I wouldn't claim it is particularly magnificent. See ExternalSettings class>>#preferenceDirectory etc. I use it for work/server preferences, with the file format described being OK but maybe better if we used JSON instead?
The location of the directory can certainly be a pain, but I've already ranted about the location of the sources file and this is a similar case. But let's not get involved in anything to do with the Windows registry; we all know that leads to weakening of the walls between us and the Dungeon Dimensions.
On 2021-12-29, at 5:40 AM, Jakob Reschke jakres+squeak@gmail.com wrote:
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is
- to access a place where some preferences values could be stored
- without user input (i. e. they should not have to choose a file or
directory first)
- independent of the location of the current image file.
- The place must be writable.
- It must work eventually in a fresh image without extra plugins or
packages loaded.
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files:
- On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming)
- On Linux this could be $XDG_CONFIG_HOME, with a fallback of $HOME/.config [1]
- On the Mac I don't really know, but according to [2]
$HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.)
- SqueakJS in the web browser could arbitrarily define a simulated
directory in the local storage.
- As a last resort, FileDrectory default could be used, although in
general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
tim
tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: DSO: Do Something or Other
On Wed, Dec 29, 2021 at 10:25:16AM -0800, tim Rowledge wrote:
The location of the directory can certainly be a pain, but I've already ranted about the location of the sources file and this is a similar case. But let's not get involved in anything to do with the Windows registry; we all know that leads to weakening of the walls between us and the Dungeon Dimensions.
If we want to put the sources files in a shared location that can be found by any of the images on a computer, what should that location be? And how should the image find it at startup time?
Clearly it will vary by platform type, and it is tempting to suggest adding a primitive or VM parameter to support this. After all, the VM already tells us the location of the image file and of the VM itself.
However, after looking at the problem I think it will be better to let the image be responsible for figuring this out without any new VM support. The VM has no real reason to know about our directory conventions, so if we want to add logic to support finding sources files I think it will be better to just write it in Smalltalk. This is certainly the case for Unix/Linux and I suspect that it will be so for Windows, OS X, and SqueakJS.
For Unix/Linux, the solution can be very simple, just add /usr/share/squeak/ and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows. I don't know about OS X, but maybe it would just follow Unix conventions.
In any case, I am going to put a possible implementation in the inbox to get the discussion started.
Dave
Hi Dave,
Happy new year!
Am Sa., 1. Jan. 2022 um 21:46 Uhr schrieb David T. Lewis lewis@mail.msen.com:
For Unix/Linux, the solution can be very simple, just add /usr/share/squeak/ and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows.
On Windows you would need additional help from the VM because there is no fixed path like /usr/share or /usr/local/share. Most Windows installations are on drive C:, but it is possible to spread Windows across different partitions. Possible candidates for a non-writable system-wide location are %ProgramFiles%\Common Files (usually C:\Program Files\Common Files) or, if Squeak were installed like other applications, its program directory under %ProgramFiles% (for example C:\Program Files\Squeak). If it should be writable by users (or at least the one who creates it), we could take %ProgramData% (usually C:\ProgramData).
https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
The most official way to get the folder paths at runtime is to use the Windows API, but going via the environment variables should work as well. So if the VM does not provide the paths, we would still need at least access to environment variables from a VM without separately installed plugins.
Kind regards, Jakob
Hi Jakob,
On Sun, Jan 02, 2022 at 08:39:29PM +0100, Jakob Reschke wrote:
Hi Dave,
Happy new year!
Am Sa., 1. Jan. 2022 um 21:46 Uhr schrieb David T. Lewis lewis@mail.msen.com:
For Unix/Linux, the solution can be very simple, just add /usr/share/squeak/ and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows.
On Windows you would need additional help from the VM because there is no fixed path like /usr/share or /usr/local/share. Most Windows installations are on drive C:, but it is possible to spread Windows across different partitions. Possible candidates for a non-writable system-wide location are %ProgramFiles%\Common Files (usually C:\Program Files\Common Files) or, if Squeak were installed like other applications, its program directory under %ProgramFiles% (for example C:\Program Files\Squeak). If it should be writable by users (or at least the one who creates it), we could take %ProgramData% (usually C:\ProgramData).
https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
Thanks, this link makes it much more clear. Indeed, this would be better be supported by the VM, which has direct access to the Windows API calls.
The most official way to get the folder paths at runtime is to use the Windows API, but going via the environment variables should work as well. So if the VM does not provide the paths, we would still need at least access to environment variables from a VM without separately installed plugins.
Given that the KNOWNFOLDERID locations are well defined in the API, I would think that the Windows API would be the better way to handle it. Perhaps the VM should provide an optional primitive for this, with the primitive providing a list of one or more locations in which the sources files might be found. And if the primitive is not implemented, then don't look there :-)
Dave
Hi Dave,
On Mon, Jan 3, 2022 at 8:42 AM David T. Lewis lewis@mail.msen.com wrote:
Hi Jakob,
On Sun, Jan 02, 2022 at 08:39:29PM +0100, Jakob Reschke wrote:
Hi Dave,
Happy new year!
Am Sa., 1. Jan. 2022 um 21:46 Uhr schrieb David T. Lewis <
lewis@mail.msen.com>:
For Unix/Linux, the solution can be very simple, just add
/usr/share/squeak/
and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows.
On Windows you would need additional help from the VM because there is no fixed path like /usr/share or /usr/local/share. Most Windows installations are on drive C:, but it is possible to spread Windows across different partitions. Possible candidates for a non-writable system-wide location are %ProgramFiles%\Common Files (usually C:\Program Files\Common Files) or, if Squeak were installed like other applications, its program directory under %ProgramFiles% (for example C:\Program Files\Squeak). If it should be writable by users (or at least the one who creates it), we could take %ProgramData% (usually C:\ProgramData).
https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
Thanks, this link makes it much more clear. Indeed, this would be better be supported by the VM, which has direct access to the Windows API calls.
The most official way to get the folder paths at runtime is to use the Windows API, but going via the environment variables should work as well. So if the VM does not provide the paths, we would still need at least access to environment variables from a VM without separately installed plugins.
Given that the KNOWNFOLDERID locations are well defined in the API, I would think that the Windows API would be the better way to handle it. Perhaps the VM should provide an optional primitive for this, with the primitive providing a list of one or more locations in which the sources files might be found. And if the primitive is not implemented, then don't look there :-)
We have a plugin in the Virtend VM that gives official values for several named directories. I'm happy to move this plugin and/or the primitive into VMMaker. The specification is
Primitive. Query for a common file location. Arguments: location: String describing the common file location. Return value: The path to the designated location. Known locations: 'home' - the user's home directory 'desktop' - the user's desktop directory
'temp' - the temp directory to use 'preferences' - the place to store (per user) app preferences 'applications' - the directory for installing applications 'fonts' - the directory to install fonts in the system
'documents' - the users documents folder 'music' - the users default location for music 'pictures' - the users default location for pictures 'videos' - the users default location for videos
_,,,^..^,,,_ best, Eliot
Hi
On 3. Jan 2022, at 18:13, Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Dave,
On Mon, Jan 3, 2022 at 8:42 AM David T. Lewis lewis@mail.msen.com wrote: Hi Jakob,
On Sun, Jan 02, 2022 at 08:39:29PM +0100, Jakob Reschke wrote:
Hi Dave,
Happy new year!
Am Sa., 1. Jan. 2022 um 21:46 Uhr schrieb David T. Lewis lewis@mail.msen.com:
For Unix/Linux, the solution can be very simple, just add /usr/share/squeak/ and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows.
On Windows you would need additional help from the VM because there is no fixed path like /usr/share or /usr/local/share. Most Windows installations are on drive C:, but it is possible to spread Windows across different partitions. Possible candidates for a non-writable system-wide location are %ProgramFiles%\Common Files (usually C:\Program Files\Common Files) or, if Squeak were installed like other applications, its program directory under %ProgramFiles% (for example C:\Program Files\Squeak). If it should be writable by users (or at least the one who creates it), we could take %ProgramData% (usually C:\ProgramData).
https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
Thanks, this link makes it much more clear. Indeed, this would be better be supported by the VM, which has direct access to the Windows API calls.
The most official way to get the folder paths at runtime is to use the Windows API, but going via the environment variables should work as well. So if the VM does not provide the paths, we would still need at least access to environment variables from a VM without separately installed plugins.
Given that the KNOWNFOLDERID locations are well defined in the API, I would think that the Windows API would be the better way to handle it. Perhaps the VM should provide an optional primitive for this, with the primitive providing a list of one or more locations in which the sources files might be found. And if the primitive is not implemented, then don't look there :-)
We have a plugin in the Virtend VM that gives official values for several named directories. I'm happy to move this plugin and/or the primitive into VMMaker. The specification is
Primitive. Query for a common file location. Arguments: location: String describing the common file location. Return value: The path to the designated location. Known locations: 'home' - the user's home directory 'desktop' - the user's desktop directory 'temp' - the temp directory to use 'preferences' - the place to store (per user) app preferences 'applications' - the directory for installing applications 'fonts' - the directory to install fonts in the system 'documents' - the users documents folder 'music' - the users default location for music 'pictures' - the users default location for pictures 'videos' - the users default location for videos
Neat! These are very user-oriented, which is fine. Maybe we can augment it down the path with some system locations :)
best regards -tobias
PS: Happy new year!
On 2022-01-03, at 9:57 AM, Tobias Pape Das.Linux@gmx.de wrote:
Primitive. Query for a common file location. Arguments: location: String describing the common file location. Return value: The path to the designated location. Known locations: 'home' - the user's home directory 'desktop' - the user's desktop directory 'temp' - the temp directory to use 'preferences' - the place to store (per user) app preferences 'applications' - the directory for installing applications 'fonts' - the directory to install fonts in the system 'documents' - the users documents folder 'music' - the users default location for music 'pictures' - the users default location for pictures 'videos' - the users default location for videos
Neat! These are very user-oriented, which is fine. Maybe we can augment it down the path with some system locations :)
The only one I don't see is the location for the sources file(s), which isn't surprising since I doubt VirtEnd uses them.
Suggestion - make the prim only return any platform specific directory or nil; the method could then supply whatever defaults seem sensible (ie pretty much what we assume now). Thus a platform without the prim would behave as now.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Strange OpCodes: CCP: Clear Core and Proceed
Hi Eliot,
This sounds awesome!
I would greatly welcome it if you and/or Virtend could contribute or license this suitably to be included in Squeak/the VM.
Kind regards, Jakob
Am Mo., 3. Jan. 2022 um 18:14 Uhr schrieb Eliot Miranda eliot.miranda@gmail.com:
Hi Dave,
On Mon, Jan 3, 2022 at 8:42 AM David T. Lewis lewis@mail.msen.com wrote:
Hi Jakob,
On Sun, Jan 02, 2022 at 08:39:29PM +0100, Jakob Reschke wrote:
Hi Dave,
Happy new year!
Am Sa., 1. Jan. 2022 um 21:46 Uhr schrieb David T. Lewis lewis@mail.msen.com:
For Unix/Linux, the solution can be very simple, just add /usr/share/squeak/ and /usr/local/share/squeak/ to the list of locations to be searched for sources files.
I suspect (but I'm not sure) that some similar convention will work for Windows.
On Windows you would need additional help from the VM because there is no fixed path like /usr/share or /usr/local/share. Most Windows installations are on drive C:, but it is possible to spread Windows across different partitions. Possible candidates for a non-writable system-wide location are %ProgramFiles%\Common Files (usually C:\Program Files\Common Files) or, if Squeak were installed like other applications, its program directory under %ProgramFiles% (for example C:\Program Files\Squeak). If it should be writable by users (or at least the one who creates it), we could take %ProgramData% (usually C:\ProgramData).
https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
Thanks, this link makes it much more clear. Indeed, this would be better be supported by the VM, which has direct access to the Windows API calls.
The most official way to get the folder paths at runtime is to use the Windows API, but going via the environment variables should work as well. So if the VM does not provide the paths, we would still need at least access to environment variables from a VM without separately installed plugins.
Given that the KNOWNFOLDERID locations are well defined in the API, I would think that the Windows API would be the better way to handle it. Perhaps the VM should provide an optional primitive for this, with the primitive providing a list of one or more locations in which the sources files might be found. And if the primitive is not implemented, then don't look there :-)
We have a plugin in the Virtend VM that gives official values for several named directories. I'm happy to move this plugin and/or the primitive into VMMaker. The specification is
Primitive. Query for a common file location. Arguments: location: String describing the common file location. Return value: The path to the designated location. Known locations: 'home' - the user's home directory 'desktop' - the user's desktop directory 'temp' - the temp directory to use 'preferences' - the place to store (per user) app preferences 'applications' - the directory for installing applications 'fonts' - the directory to install fonts in the system 'documents' - the users documents folder 'music' - the users default location for music 'pictures' - the users default location for pictures 'videos' - the users default location for videos
_,,,^..^,,,_ best, Eliot
Hi Jakob,
On Wed, Dec 29, 2021 at 5:41 AM Jakob Reschke jakres+squeak@gmail.com wrote:
Hi all,
Am Do., 23. Dez. 2021 um 13:39 Uhr schrieb Jakob Reschke jakres+squeak@gmail.com:
[...] we should write default preferences to ~/.config/squeak-default-preferences.dat or so when the wizard is finished for the first time [...]
I just "quickly" wanted to try this out the other day, but it seems there is no clean way to determine the home directory from a plain Trunk image without third party packages. Sigh!
There is a getenv primitive (but see below on a better solution). So you can implement this anywhere and use self getenv: 'HOME'
getenv: aByteStringOrByteArray <primitive: 'primitiveGetenv' module: '' error: ec> ec == #'bad argument' ifTrue: [aByteStringOrByteArray isString ifFalse: [^self getenv: aByteStringOrByteArray asString]]. self primitiveFail
The context: I would like to store some contested preferences externally in a well-known, stable location, so that when you start a new image, these preferences are already pre-set in the preference wizard with your choices from the last time you completed the wizard in a different image. For example, auto-enclose, enclose selection, colorful windows, attach tools to mouse cursor, ... That would allow us to change the default preferences for first-time users without bothering our veterans with behavior to which they are not accustomed, and which they first have to turn off in each new image.
SecurityManager>>#primUntrustedUserDirectory comes closest to the user's home directory, but on Unix you would have to go up three directories and on Windows just two. On its own, the SecurityManager default untrustedUserDirectory does not really adhere to the platform rules for storing preferences (at least not on Windows). Also it may be incorrect to use the SecurityManager protocol for this purpose, I have no experience with it.
Before I delve too much into getting the home directory, what I really want is
- to access a place where some preferences values could be stored
- without user input (i. e. they should not have to choose a file or
directory first)
- independent of the location of the current image file.
- The place must be writable.
- It must work eventually in a fresh image without extra plugins or
packages loaded.
We have a plugin in the Virtend VM that answers the well known folder locations. I'm happy to move this into VMMaker. Primitive. Query for a common file location. Arguments: location: String describing the common file location. Return value: The path to the designated location. Known locations: 'home' - the user's home directory 'desktop' - the user's desktop directory
'temp' - the temp directory to use 'preferences' - the place to store (per user) app preferences 'applications' - the directory for installing applications 'fonts' - the directory to install fonts in the system
'documents' - the users documents folder 'music' - the users default location for music 'pictures' - the users default location for pictures 'videos' - the users default location for videos
Ideally the place would adhere to the rules and conventions of the platform. So if it is a directory to store configuration files:
- On Windows this could be %APPDATA% (e. g. C:\Users\Jakob\AppData\Roaming)
- On Linux this could be $XDG_CONFIG_HOME, with a fallback of
$HOME/.config [1]
- On the Mac I don't really know, but according to [2]
$HOME/Library/Preferences might be it. (In all the cases above, a Squeak subdirectory should be created, of course.)
- SqueakJS in the web browser could arbitrarily define a simulated
directory in the local storage.
- As a last resort, FileDrectory default could be used, although in
general it does not fulfill the requirements (e. g. being indepent of the image location).
I suppose it would make sense to implement the lookup of the path in the VM (or a plugin that is included by default). Otherwise, the minimum requirement would be that getenv() functionality is available without installing OSProcess first. It looks like Pharo has done something like that: `Smalltalk os environment` answers a dictionary of environment variables and this is used in FileSystem to retrieve preferences and home directories.
Alternatively, we could outsource this to the VM completely by specifying a key-value store protocol of primitives for simple preferences. Then the VM could even implement it using platform-specific API (e. g. the Windows Registry, Mac NSUserDefaults [2]). But I have the feeling that this may not be the most popular choice in the community. ;-)
What are your thoughts about the matter?
[1] https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html [2] https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/U...
Kind regards, Jakob
Am Mo., 3. Jan. 2022 um 18:24 Uhr schrieb Eliot Miranda eliot.miranda@gmail.com:
There is a getenv primitive (but see below on a better solution). So you can implement this anywhere and use self getenv: 'HOME'
getenv: aByteStringOrByteArray <primitive: 'primitiveGetenv' module: '' error: ec> ec == #'bad argument' ifTrue: [aByteStringOrByteArray isString ifFalse: [^self getenv: aByteStringOrByteArray asString]]. self primitiveFail
Wow, great! Is there a particular reason why we do not have a method for this in the Squeak trunk?
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore.
So pressing a closer bracket removes the pair of brackets that is *enclosing* the selection. However, I still wonder whether we should also remove the pair of brackets *inside* the selection if there is no further pair of brackets.
So that
[123] (entire line selected)
when pressing
]
becomes
123 (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Hi Christoph,
+1 It sounds reasonable to me. Try this:
Write
[420]
Select 420 and press ] to remove the brackets
Press CMD + z (undo)
and you get back [420] but this time the whole thing selected so you can’t remove the brackets by pressing ] because they’re inside the selection…
I’m just trying to show Christoph’s proposal doesn’t feel any more inconsistent than this behavior :)
Unless the above behavior is useful for something else :)
Best,
--
Jaromír Matas
mail@jaromir.net
From: christoph.thiede@student.hpi.uni-potsdam.demailto:christoph.thiede@student.hpi.uni-potsdam.de Sent: Friday, May 27, 2022 23:10 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org Subject: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore.
So pressing a closer bracket removes the pair of brackets that is *enclosing* the selection. However, I still wonder whether we should also remove the pair of brackets *inside* the selection if there is no further pair of brackets.
So that
[123] (entire line selected)
when pressing
]
becomes
123 (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
--- Sent from Squeak Inbox Talkhttps://github.com/hpi-swa-lab/squeak-inbox-talk
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Press CMD + z (undo)
and you get back [420] but this time the whole thing selected
Wait ... this is a(nother) bug, isn't it? Should Cmd + Z restore the previous selection?
Best,
Christoph
________________________________ Von: Squeak-dev squeak-dev-bounces@lists.squeakfoundation.org im Auftrag von Jaromir Matas mail@jaromir.net Gesendet: Freitag, 27. Mai 2022 23:37:34 An: The general-purpose Squeak developers list Betreff: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Christoph,
+1 It sounds reasonable to me. Try this:
Write
[420]
Select 420 and press ] to remove the brackets
Press CMD + z (undo)
and you get back [420] but this time the whole thing selected so you can’t remove the brackets by pressing ] because they’re inside the selection…
I’m just trying to show Christoph’s proposal doesn’t feel any more inconsistent than this behavior :)
Unless the above behavior is useful for something else :)
Best,
--
Jaromír Matas
mail@jaromir.net
From: christoph.thiede@student.hpi.uni-potsdam.demailto:christoph.thiede@student.hpi.uni-potsdam.de Sent: Friday, May 27, 2022 23:10 To: squeak-dev@lists.squeakfoundation.orgmailto:squeak-dev@lists.squeakfoundation.org Subject: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore.
So pressing a closer bracket removes the pair of brackets that is *enclosing* the selection. However, I still wonder whether we should also remove the pair of brackets *inside* the selection if there is no further pair of brackets.
So that
[123] (entire line selected)
when pressing
]
becomes
123 (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
--- Sent from Squeak Inbox Talkhttps://github.com/hpi-swa-lab/squeak-inbox-talk
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Without answering Christoph's question, I'd like to ask an additional one about this topic: I think it's wasteful and complicated to use so many different keys for removing the bracket layer. I liked this idea of separate closer command at first but, after using it a bit, I don't. Now, not only does the user have to think about the different keys for "adding vs. removing", they also have to consider *which* closer bracket to press -- e.g., close bracket? close brace? close paren? -- even though the context makes that burden unnecessary for the user, lest they should press the wrong one and be disrupted even more. It really does force me to "pause" where, with toggle, it didn't.
It also means we now consume... 4(?!) hot keys for a function that used to only consume 1.
If there's no way to go back to toggle, we should at least consume only one hot-key for "removing a level" -- either ) or ] -- that will work on any of the three.
On Fri, May 27, 2022 at 4:10 PM christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
*> Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore. * So pressing a closer bracket removes the pair of brackets that is **enclosing** the selection. However, I still wonder whether we should also remove the pair of brackets **inside** the selection if there is no further pair of brackets.
So that
*[123]* (entire line selected)
when pressing
]
becomes
*123* (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta
information on the list:
This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at
student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of
having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having
traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard
and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
Hi Chris,
A single "closer" hot-key sounds very logical... Would it work for all enclosing symbols, even for | and " ? Not only pair-like ones like {}, <>, () and [] ? How about something like CMD + Backspace (or CTRL + Backspace in Windows). Picking just one of the closer brackets might be a bit confusing for closing " or | pairs... Well, actually, using a closer bracket to remove one level of brackets isn't really a hot-key use (how I understand it), it's just a different semantics of a regular key in a specific context, I think. So maybe just add a universal "closer" hotkey and keep the existing closer brackets functionality?
No strong opinion though :)
Thanks, jaromir
--
Jaromír Matas
mail@jaromir.net
From: Chris Mullermailto:asqueaker@gmail.com Sent: Wednesday, June 1, 2022 1:19 To: The general-purpose Squeak developers listmailto:squeak-dev@lists.squeakfoundation.org Subject: Re: [squeak-dev] Merge Request: autoEncloseBeforeSpace.cs
Without answering Christoph's question, I'd like to ask an additional one about this topic: I think it's wasteful and complicated to use so many different keys for removing the bracket layer. I liked this idea of separate closer command at first but, after using it a bit, I don't. Now, not only does the user have to think about the different keys for "adding vs. removing", they also have to consider *which* closer bracket to press -- e.g., close bracket? close brace? close paren? -- even though the context makes that burden unnecessary for the user, lest they should press the wrong one and be disrupted even more. It really does force me to "pause" where, with toggle, it didn't.
It also means we now consume... 4(?!) hot keys for a function that used to only consume 1.
If there's no way to go back to toggle, we should at least consume only one hot-key for "removing a level" -- either ) or ] -- that will work on any of the three.
On Fri, May 27, 2022 at 4:10 PM <christoph.thiede@student.hpi.uni-potsdam.demailto:christoph.thiede@student.hpi.uni-potsdam.de> wrote: Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore.
So pressing a closer bracket removes the pair of brackets that is *enclosing* the selection. However, I still wonder whether we should also remove the pair of brackets *inside* the selection if there is no further pair of brackets.
So that
[123] (entire line selected)
when pressing
]
becomes
123 (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
--- Sent from Squeak Inbox Talkhttps://github.com/hpi-swa-lab/squeak-inbox-talk
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.demailto:christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at student.hpi.uni-potsdam.dehttp://student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
A single "closer" hot-key sounds very logical... Would it work for all enclosing symbols, even for | and " ? How about something like CMD + Backspace (or CTRL + Backspace in Windows).
No. Just the three paired ones.
Picking just one of the closer brackets might be a bit confusing for closing " or | pairs...
Agree. It feels analogous to choosing lesser pain.
Well, actually, using a closer bracket to remove one level of brackets isn't really a hot-key use (how I understand it), it's just a different semantics of a regular key in a specific context,
Thanks for the reminder. I'm still getting accustomed to remembering that Cmd is no longer necessary, which I do still like.
I think. So maybe just add a universal "closer" hotkey and keep the existing closer brackets functionality?
No strong opinion though :)
:) I'll give it some more time, hopefully I'll be able to learn it better. But, if not, just a warning that I _might_ haggle to bring back toggle as a preference.
- Chris
Hi Chris,
On Jun 1, 2022, at 2:55 PM, Chris Muller ma.chris.m@gmail.com wrote:
:) I'll give it some more time, hopefully I'll be able to learn it better. But, if not, just a warning that I _might_ haggle to bring back toggle as a preference.
Cmd-Shift-9 (a.k.a. Cmd-( ) is muscle memory for me, and I am having trouble adjusting to the new paradigm. I thought I could turn on the 'legacy keyboard shortcuts' preference, but on macOS (at least) it's not bringing back Cmd-Shift-9 for me. I have to now figure out how to change how I code in Browsers and Workspaces. It's not happy-making.
So: I'd be in favor of some "improvements," including an optional return to "the way things used to be" here, if possible.
Thanks, Tim J
Hi Tim --
As I wrote in that other thread, I cannot reproduce that issue on macOS. If you enable "legacy keyboard shortcuts" you can use CMD+SHIFT+9 again.
Please open a new thread if you are still experiencing that issue.
Best, Marcel Am 02.06.2022 01:55:14 schrieb Tim Johnson digit@sonic.net: Hi Chris,
On Jun 1, 2022, at 2:55 PM, Chris Muller <ma.chris.m@gmail.com [mailto:ma.chris.m@gmail.com]> wrote:
:) I'll give it some more time, hopefully I'll be able to learn it better. But, if not, just a warning that I _might_ haggle to bring back toggle as a preference.
Cmd-Shift-9 (a.k.a. Cmd-( ) is muscle memory for me, and I am having trouble adjusting to the new paradigm. I thought I could turn on the 'legacy keyboard shortcuts' preference, but on macOS (at least) it's not bringing back Cmd-Shift-9 for me. I have to now figure out how to change how I code in Browsers and Workspaces. It's not happy-making.
So: I'd be in favor of some "improvements," including an optional return to "the way things used to be" here, if possible.
Thanks, Tim J
Hi Christoph --
No, we should not make the user model more complicated.
Wenn you select the entire "[123]" this means that the text selection has no brackets around it. So hitting ] will naturally replace that with "]"
Best, Marcel Am 27.05.2022 23:10:32 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi Jaromir, Marcel, all,
with Morphic-mt.1824 in current Trunk, we have the following behavior for closer brackets:
Via "enclose selection" preference, an opening bracket adds a level and a closer bracket removes a level. No toggling anymore.
So pressing a closer bracket removes the pair of brackets that is *enclosing* the selection. However, I still wonder whether we should also remove the pair of brackets *inside* the selection if there is no further pair of brackets.
So that
[123] (entire line selected)
when pressing
]
becomes
123 (entire line selected)
instead of (as in current Trunk)
] (nothing selected)
Or would this be more inconsistent than convenient? Wdyt?
Best, Christoph
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2022-02-07T23:33:53+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Just a quick note to myself, compensating for the lack of meta information on the list: This issue has been resolved via Morphic-mt.1809. Thanks. :-)
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-01T22:09:46+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
Hi all!
This changeset refines the existing autoEnclose mechanism. Instead of having inserted enclosing brackets always, you can now activate a new preference to only insert these characters if there is any space after the cursor. This matches VS Code's setting value "beforeWhitespace" for "editor.autoClosingBrackets".
To me, this mode feels much more convenient because when having traditional autoEnclose enabled, I have been getting angry again and again when I wanted to bracketize an existing expression in some code and suddenly was disrupted by an unneeded closing bracket.
The changeset does not manipulate any defaults. The PreferenceWizard and the ReleaseBuilder are updated, too. Please honor the postscript of the changeset when merging it.
Best, Christoph
Sent from Squeak Inbox Talk
squeak-dev@lists.squeakfoundation.org