[Cuis-dev] Editor cmd-"

Juan Vuletich juan at jvuletich.org
Tue Nov 23 05:15:59 PST 2021


Hi Mark,

We have some limitations in the way the VM reports keyboard events to 
Smalltalk. And each platform does it in a slightly different way:
- On Linux, it works OK
- On MacOS, I just pushes an update that improves the situation, but 
possibly only for keyboards with US layout
- On Windows, there's no way to tell ctrl-[ from ctrl-{ . They are 
reported the same!

Take a look at #4975. Also play a bit with `Sensor test`.

The current state is not correct. But I don't know how to improve it 
(BTW, in Squeak it is actually worse, because in Cuis, in the method in 
#4975, I fix it the best I can).

Thanks,

On 11/22/2021 5:11 PM, Mark via Cuis-dev wrote:
> Hi,
>
> According to the Smalltalk Editor Help:
>
>     Cmd-" Enclose within double quotes, or remove enclosing double quotes
>
>
> However, it surrounds my text with an apostrophe (“single-quote”) 
> character instead of a quote (“double-quote”) character.
>
> Specifically, if I have the following in the Workspace (or any other 
> editor):
>
> Hello, world
>
> And I highlight it and press <cmd-“>, the result is:
>
> ‘Hello, world'
>
> But, I would have expected it to result with:
>
> "Hello, world"
>
> I used this as an opportunity to explore the system, and (after quite 
> a while! 😉), I added a Transcript statement, as follows:
>
>     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 |
>     *Transcript show: ('kbd: [{1}]' format: {aKeyboardEvent
>     keyCharacter }); newLine.*
>     startIndex _ self startIndex.
>     stopIndex _ self stopIndex.
>     oldSelection _ self selection.
>     which _ '([<{"''`' indexOf: aKeyboardEvent keyCharacter ifAbsent:
>     [ ^true ].
>     left _ '([<{"''`' at: which.
>     right _ ')]>}"''`' at: which.
>     ((startIndex > 1 and: [stopIndex <= model textSize])
>     and: [ (model actualContents at: startIndex-1) = left and: [(model
>     actualContents at: stopIndex) = right]])
>     ifTrue: [
>     "already enclosed; strip off brackets"
>     self selectFrom: startIndex-1 to: stopIndex.
>     self replaceSelectionWith: oldSelection]
>     ifFalse: [
>     "not enclosed; enclose by matching brackets"
>     self replaceSelectionWith:
>     (Text string: (String with: left) attributes: emphasisHere),
>     oldSelection,
>     (Text string: (String with: right) attributes: emphasisHere).
>     self selectFrom: startIndex+1 to: stopIndex].
>     ^ true
>
>
> And discovered that this method never receives a <cmd-“> keyCharacter. 
> By the time this code is executed, it seems like the <shift> key is 
> ignored.
>
> Further experimentation revealed that none of the “shift”-ed key 
> commands work — at least, not on my setup. 🙄😉🙂
>
> Any thoughts? Should this work?
>
> TIA,
>
> — Mark
>
>


-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20211123/4bbc6ca7/attachment.htm>


More information about the Cuis-dev mailing list