[Cuis-dev] Editor cmd-"
Mark
dev at virtualmdj.com
Tue Nov 23 15:16:12 PST 2021
Hi,
So, here is a really gross fix to make some of the “shifted” commands work.
(Did I mention “really gross”?!? :-) )
(And … I just noticed that my coding “style” is much more C-ish than Smalltalk-is. 😂)
But, it’s just part of my foray into learning how the system works and tweaking things without completely blowing up my “smalltalk world.” 😉
My changes are marked in red. (Assuming color makes it to the list … )
TextEditor>>enclose: aKeyboardEvent
"Insert or remove bracket characters around the current selection."
"This is a user command, and generates undo"
| left right startIndex stopIndex oldSelection which aKey|
aKey _ aKeyboardEvent keyCharacter.
“Account for [shifted] characters that we know about (there may be others …)"
aKeyboardEvent shiftPressed
ifTrue: [
which _ '9,[''' indexOf: aKey.
0 < which
ifTrue: [
aKey _ ('(<{"') at: which
].
].
" Transcript
show: ('enclose: key = [{1}]; shift pressed = [{2}]' format: { aKey. (aKeyboardEvent shiftPressed) });
newLine.
”
startIndex _ self startIndex.
stopIndex _ self stopIndex.
oldSelection _ self selection.
which _ '([<{"''`' indexOf: aKey ifAbsent: [ ^true ].
"which _ '([<{""''`' indexOf: aKeyboardEvent keyCharacter ifAbsent: [ ^true ]."
left _ '([<{"''`' at: which.
right _ ')]>}"''`' at: which.
… rest of method follows …
Note: cmd-( and cmd-< still do not work because it seems like cmd-9 and cmd-, are captured before this code gets a chance to test them.
Obviously, this still does not address the more fundamental issue that “shifted” keys are not correctly placed in the aKeyboardEvent variable when a keystroke is first hit, which is where it should happen.
Where do user events ultimately come from? Is the CogVM? Or somewhere within Cuis Smalltalk itself?
Thanks,
— Mark
> On Nov 23, 2021, at 7:07 AM, Mark de Jong via Cuis-dev <cuis-dev at lists.cuis.st> wrote:
>
> Hi Juan,
>
> Ah. Thanks. That helps.
>
> I played with “Sensor test” — is there a “secret handshake” keystroke combination that will stop it? Or do I have completely quit Cuis and relaunch to get out of it? 🤔😉
>
> Thanks,
>
> — Mark
>
> P.S. Juan: your message, below, was truncated when it arrived in my email box. I ended up going to the web page (https://lists.cuis.st/mailman/archives/cuis-dev/2021-November/004427.html <https://lists.cuis.st/mailman/archives/cuis-dev/2021-November/004427.html>) to read your note, since it did not show up properly in Mail. No clue why that happened. Other messages arrive just fine. This is just an FYI for you.
>
> Sent from my iPad
>
>> On Nov 23, 2021, at 5:42 AM, Juan Vuletich <juan at jvuletich.org> wrote:
>>
>> -- Cuis-dev mailing list Cuis-dev at lists.cuis.st https://lists.cuis.st/mailman/listinfo/cuis-dev
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211123/a911e732/attachment.htm>
More information about the Cuis-dev
mailing list