[squeak-dev] how to enable "" feature from OCompletion in a PluggableTextMorphPlus

Chris Muller ma.chris.m at gmail.com
Tue Feb 8 21:31:25 UTC 2011

Well, Squeak is a system that can be changed, so that could be easily
added.  Besides that, there is also the Alt+' and Shift+Alt+' which
works in straight-away in Squeak right now; no packages to load or
preferences to set or anything.

For me, the problem with SmartChars of OCompletion is that it has
sufferred a regression from the way it was implemented in ECompletion.
 Back in 2006, I worked with Ruben Bakker on the original ECompletion
to change the SmartChars function so that it would _keep the selection
highlighted_ when using them.  Here's my original explanation copied
from the note.  I wrote:

> Monday, April 3, 2006 3:02 PM
> ...
> I enjoy type-replacing text all the time.  This is where I select a
> piece of text, then just start typing to replace it (without first
> having to press delete or backspace).  It is also common for the
> replacement text to begin with a left parenthesis.  With e-Completion,
> its nice that it inserts parenthesis on each end, but the text is then
> deselected, causing the type-replace to not replace.  If eCompletion
> were to allow the original text to remain selected, then the
> transparency of the original type-replace function could remain
> intact..

This is precisely the correct behavior and Ruben agreed and he fixed
it.  By keeping the selection highlighted, it "objectifies" the
highlighted text into an _expression_.  The current behavior, by
deselecting the highlighted text and placing the cursor to the end,
presumably so the user can "keep on typing more text", it causes
developer to stay thinking in terms of "editing text", rather than
building up the notion of "editing expressions".

Pragmatically, besides what I mentioned above it allows me to _choose_
whether I want to continue editing at the beginning or end by pressing
the left or right arrow.  Further, it allows me to surround by
multiple-levels of parenthesis (or other enclosing characters) which
is quite common.

I do hope Levente will consider restoring this fix to OCompletion.

 - Chris

On Tue, Feb 8, 2011 at 12:34 PM, Ricardo Moran <richi.moran at gmail.com> wrote:
> But the auto enclose preference only works with parenthesis, brackets and
> square brackets. So IMHO the best way would be turning on smart characters.
> :)
> Cheers
> Richo
> On Tue, Feb 8, 2011 at 3:18 PM, Chris Muller <asqueaker at gmail.com> wrote:
>> Two ways:
>>  - Turn on Smart Characters preference.  This way does not require
>> pressing control or Alt.
>> OR
>>  - Turn on the "Auto Enclose" preference in the Morphic category.
>> This feature is built-in to Squeak, OCompletion is not necessary.
>> OR
>>  - Note the old, classic, "enclose" hot-keys.  Select text you want
>> to enclose in '', "", (), [] or {} and press one of:  Alt+',
>> Alt+Shift+', Alt+[, Alt+Shift+[, respectively.
>> HTH,
>>  Chris
>> On Mon, Feb 7, 2011 at 3:23 PM, Ken G. Brown <kbrown at mac.com> wrote:
>> > Can anyone tell me how to enable the double quote "" when you type
>> > feature from OCompletion in a PluggableTextMorphPlus?
>> > OCompletion is loaded.
>> >
>> > My PluggableTextMorphPlus currently shows Shout code styling.
>> >
>> > Squeak 4.2 10966, Mac.
>> > Thx for any insight.
>> >
>> > Ken
>> >
>> >

More information about the Squeak-dev mailing list