<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi Mark,<br>
    <br>
    We have some limitations in the way the VM reports keyboard events
    to Smalltalk. And each platform does it in a slightly different way:<br>
    - On Linux, it works OK<br>
    - On MacOS, I just pushes an update that improves the situation, but
    possibly only for keyboards with US layout<br>
    - On Windows, there's no way to tell ctrl-[ from ctrl-{ . They are
    reported the same!<br>
    <br>
    Take a look at #4975. Also play a bit with `Sensor test`.<br>
    <br>
    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).<br>
    <br>
    Thanks,<br>
    <br>
    On 11/22/2021 5:11 PM, Mark via Cuis-dev wrote:
    <blockquote
      cite="mid:3B978577-3197-4C88-9FAD-451627E31860@virtualmdj.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hi,
      <div class=""><br class="">
      </div>
      <div class="">According to the Smalltalk Editor Help:</div>
      <div class=""><br class="">
      </div>
      <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none;
        padding: 0px;" class="">
        <div class=""><font class="" face="Menlo">Cmd-"   <span
              class="Apple-tab-span" style="white-space: pre;"> </span>Enclose
            within double quotes, or remove enclosing double quotes</font></div>
      </blockquote>
      <div class=""><br class="">
      </div>
      <div class="">However, it surrounds my text with an apostrophe
        (“single-quote”) character instead of a quote (“double-quote”)
        character.</div>
      <div class=""><br class="">
      </div>
      <div class="">Specifically, if I have the following in the
        Workspace (or any other editor):</div>
      <div class=""><br class="">
      </div>
      <div class=""><span class="Apple-tab-span" style="white-space:
          pre;"> </span><font class="" face="Menlo">Hello, world</font></div>
      <div class=""><br class="">
      </div>
      <div class="">And I highlight it and press <<font class=""
          face="Menlo">cmd-“</font>>, the result is:</div>
      <div class=""><br class="">
      </div>
      <div class=""><span class="Apple-tab-span" style="white-space:
          pre;"> </span><font class="" face="Menlo">‘Hello, world'</font></div>
      <div class=""><br class="">
      </div>
      <div class="">But, I would have expected it to result with:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class=""><span class="Apple-tab-span" style="white-space:
            pre;"> </span>"<font class="" face="Menlo">Hello, world"</font></div>
      </div>
      <div class=""><font class="" face="Menlo"><br class="">
        </font></div>
      <div class="">I used this as an opportunity to explore the system,
        and (after quite a while! 😉), I added a Transcript statement,
        as follows:</div>
      <div class=""><br class="">
      </div>
      <blockquote style="margin: 0pt 0pt 0pt 40px; border: medium none;
        padding: 0px;" class="">
        <div class=""><font class="" face="Menlo">Texteditor>>>enclose:
            aKeyboardEvent</font></div>
        <font class="" face="Menlo"><span class="Apple-tab-span"
            style="white-space: pre;"> </span>"Insert or remove bracket
          characters around the current selection."<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>"This
          is a user command, and generates undo"<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>|
          left right startIndex stopIndex oldSelection which |<br
            class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span><b
            style="font-size: 14px;" class="">Transcript show: ('kbd:
            [{1}]' format: {aKeyboardEvent keyCharacter }); newLine.</b><br
            class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>startIndex
          _ self startIndex.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>stopIndex
          _ self stopIndex.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>oldSelection
          _ self selection.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>which
          _ '([<{"''`' indexOf: aKeyboardEvent keyCharacter ifAbsent:
          [ ^true ].<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>left
          _ '([<{"''`' at: which.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>right
          _ ')]>}"''`' at: which.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>((startIndex
          > 1 and: [stopIndex <= model textSize])<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>and:
          [ (model actualContents at: startIndex-1) = left and: [(model
          actualContents at: stopIndex) = right]])<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>ifTrue:
          [<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>"already
          enclosed; strip off brackets"<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>self
          selectFrom: startIndex-1 to: stopIndex.<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>self
          replaceSelectionWith: oldSelection]<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>ifFalse:
          [<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>"not
          enclosed; enclose by matching brackets"<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>self
          replaceSelectionWith:<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>(Text
          string: (String with: left) attributes: emphasisHere),<br
            class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>oldSelection,<br
            class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>(Text
          string: (String with: right) attributes: emphasisHere).<br
            class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>self
          selectFrom: startIndex+1 to: stopIndex].<br class="">
          <span class="Apple-tab-span" style="white-space: pre;"> </span>^
          true</font></blockquote>
      <br class="">
      <div class="">And discovered that this method never receives a
        <<font class="" face="Menlo">cmd-“</font>> keyCharacter.
        By the time this code is executed, it seems like the
        <shift> key is ignored.</div>
      <div class=""><br class="">
      </div>
      <div class="">Further experimentation revealed that none of the
        “shift”-ed key commands work — at least, not on my setup. 🙄😉🙂</div>
      <div class=""><br class="">
      </div>
      <div class="">Any thoughts? Should this work?</div>
      <div class=""><br class="">
      </div>
      <div class="">TIA,</div>
      <div class=""><br class="">
      </div>
      <div class=""><span class="Apple-tab-span" style="white-space:
          pre;"> </span>— Mark</div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Juan Vuletich
<a class="moz-txt-link-abbreviated" href="http://www.cuis-smalltalk.org">www.cuis-smalltalk.org</a>
<a class="moz-txt-link-freetext" href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a>
<a class="moz-txt-link-freetext" href="https://github.com/jvuletich">https://github.com/jvuletich</a>
<a class="moz-txt-link-freetext" href="https://www.linkedin.com/in/juan-vuletich-75611b3">https://www.linkedin.com/in/juan-vuletich-75611b3</a>
@JuanVuletich</pre>
  </body>
</html>