<div dir="ltr">Yes, I've cut'n'pasted his method out of his email, and it works, but does anyone (Marcel?) know why the cursor disappears after typing ()?<div><br></div><div>I haven't had a chance to figure that out yet, I want to fix both..</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 28, 2015 at 9:11 AM, karl ramberg <span dir="ltr"><<a href="mailto:karlramberg@gmail.com" target="_blank">karlramberg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><table cellpadding="0" style="font-size:16px"><tbody><tr><td style="width:558px"><table cellpadding="0" style="width:558px"><tbody><tr><td><h3><span name="Stéphane Rollandin" style="font-size:16px;font-weight:normal">Stéphane Rollandins fix should be in the release image.</span></h3><div><span name="Stéphane Rollandin" style="font-size:16px;font-weight:normal">That bug is really annoying</span></div><span class="HOEnZb"><font color="#888888"><div><span name="Stéphane Rollandin" style="font-size:16px;font-weight:normal"><br></span></div><div><span name="Stéphane Rollandin" style="font-size:16px;font-weight:normal">Karl</span></div></font></span></td></tr></tbody></table></td></tr></tbody></table></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 3:20 PM, Stéphane Rollandin <span dir="ltr"><<a href="mailto:lecteur@zogotounga.net" target="_blank">lecteur@zogotounga.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It seems that "Auto Enclose" is not honored correctly. It is disabled in my<br>
image but still seems to be enabled. :-(<br>
<br>
Try typing "()" then move the cursor between the parentheses and type the<br>
closing one again. You will not end up with to closing ones...<br>
</blockquote>
<br></span>
Yes, I noticed that also, and it bothered me enough that I fixed it by modifying TextEditor>> #dispatchOnKeyboardEvent: as follow:<br>
<br>
----------------------------------------------<br>
<br>
dispatchOnKeyboardEvent: aKeyboardEvent<span><br>
"Carry out the action associated with this character, if any. Type-ahead is passed so some routines can flush or use it."<br></span><span>
| honorCommandKeys openers closers result typedChar |<br></span><span>
((typedChar := aKeyboardEvent keyCharacter) == Character cr and: [ morph acceptOnCR ]) ifTrue:<br></span>
[ self closeTypeIn.<span><br>
^ true ].<br>
self clearParens.<br></span><span>
aKeyboardEvent keyValue = 13 ifTrue:<br></span><span>
[ aKeyboardEvent controlKeyPressed ifTrue: [ ^ self normalCharacter: aKeyboardEvent ].<br></span><span>
aKeyboardEvent shiftPressed ifTrue: [ ^ self lf: aKeyboardEvent ].<br></span><span>
aKeyboardEvent commandKeyPressed ifTrue: [ ^ self crlf: aKeyboardEvent ].<br></span><span>
^ self crWithIndent: aKeyboardEvent ].<br></span><span>
((honorCommandKeys := Preferences cmdKeysInText) and: [ typedChar = Character enter ]) ifTrue: [ ^ self dispatchOnEnterWith: aKeyboardEvent ].<br></span><span>
"Special keys overwrite crtl+key combinations - at least on Windows. To resolve this<br>
conflict, assume that keys other than cursor keys aren't used together with Crtl."<br></span><span>
((self class specialShiftCmdKeys includes: aKeyboardEvent keyValue) and: [ aKeyboardEvent keyValue < 27 ]) ifTrue: [ ^ aKeyboardEvent controlKeyPressed<br></span><span>
ifTrue:<br>
[ self<br>
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
with: aKeyboardEvent ]<br></span><span>
ifFalse:<br>
[ self<br>
perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)<br>
with: aKeyboardEvent ] ].<br>
"backspace, and escape keys (ascii 8 and 27) are command keys"<br></span><span>
((honorCommandKeys and: [ aKeyboardEvent commandKeyPressed ]) or: [ self class specialShiftCmdKeys includes: aKeyboardEvent keyValue ]) ifTrue: [ ^ aKeyboardEvent shiftPressed<br></span><span>
ifTrue:<br>
[ self<br>
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
with: aKeyboardEvent ]<br></span><span>
ifFalse:<br>
[ self<br>
perform: (self class cmdActions at: aKeyboardEvent keyValue + 1)<br>
with: aKeyboardEvent ] ].<br>
"the control key can be used to invoke shift-cmd shortcuts"<br></span><span>
(honorCommandKeys and: [ aKeyboardEvent controlKeyPressed ]) ifTrue: [ ^ self<br></span><span>
perform: (self class shiftCmdActions at: aKeyboardEvent keyValue + 1)<br>
with: aKeyboardEvent ].<br>
openers := '([{'.<br>
closers := ')]}'.<br></span>
(closers includes: typedChar)<br>
ifTrue:<br>
[ self blinkPrevParen: typedChar.<br>
(self class autoEnclose and: [self nextNonwhitespaceCharacter = typedChar])<br>
ifTrue:<span><br>
[ self moveCursor: [ : position | position + 1 ] forward: true select: false.<br></span>
^ false ]<span><br>
ifFalse: [ result := self normalCharacter: aKeyboardEvent ] ]<br></span><span>
ifFalse: [ result := self normalCharacter: aKeyboardEvent ].<br></span><span>
(self class autoEnclose and: [ openers includes: typedChar ]) ifTrue:<br></span>
[ self<span><br>
addString: (closers at: (openers indexOf: typedChar)) asString ;<br></span>
insertTypeAhead ;<span><br>
<br>
moveCursor:<br>
[ : position | position - 1 ]<br></span>
forward: false<br>
select: false ].<br>
^ result<br>
<br>
<br>
----------------------------------------------<br>
<br>
It looks like a correct fix to me.<br>
<br>
Best,<br>
<br>
Stef<br>
<br>
<br>
<br>
</blockquote></div><br></div>
</div></div><br><br>
<br></blockquote></div><br></div>