<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 08/11/2023 21:18, Andy Goryachev
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7D515C83537405C777AE5A8A@DM5PR1001MB2172.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
        {font-family:"Iosevka Fixed SS16";
        panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Iosevka Fixed SS16";
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">Dear Michael:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">Thank you for specific questions!<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.5in"><span
            style="font-size:11.0pt">> "switch between vim/emacs/etc.
            key mappings"? Maybe you can give a specific example.</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">Vim/emacs might be a bad example, as they use
            key sequences.  Key sequences are not a part of this
            proposal (but it is possible to implement with the help of
            the proposed API).<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">One example is a user preference for Go-To-Line
            function typical in text editors.  In jEdit on Mac it’s
          </span><span style="font-size:11.0pt;font-family:"Cambria
            Math",serif">⌘</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">E, while in Eclipse it’s
          </span><span style="font-size:11.0pt;font-family:"Cambria
            Math",serif">⌘</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">G.  The user might strongly prefer to have one
            or the other, so an application requirement might include
            redefining one or more keys.  Since it’s a user preference,
            it has to be done at runtime.</span></p>
      </div>
    </blockquote>
    <p>That's not a function offered by text controls at all.  That's a
      short cut for a menu function that will pop-up a dialog asking for
      a line number (Ctrl + L in Eclipse).</p>
    <p>Standard behavior is everything that's standard about a control's
      behavior that people come to expect when using their platform of
      choice.  Any text field will offer defaults like:</p>
    <p>left: move cursor one character to the left<br>
      control+left: move cursor one word to the left<br>
      home: move cursor to start of line<br>
      ctrl+home: move cursor to start of text<br>
      ctrl+x/c/v: cut/copy/paste</p>
    <p>etcetera.<br>
    </p>
    <p>What you are proposing here is about providing high level
      short-cuts which IMHO is squarely in the domain of the application
      developer, or some 3rd party.  FX should only care about offering
      ways to change the implicit standard key bindings that you use
      without even thinking about.<br>
    </p>
    <p>Basically, if it isn't a function offered directly by the
      control, and handled directly by the control, then it's the
      application that should be handling it.  And they can handle this
      already by assigning such a short cut to a menu, or by installing
      global/local event handlers.</p>
    <p>What they CAN'T do right now is:</p>
    <p>- Disabling one of those implicit key bindings because you want
      to use it for something else (ie, application managed)<br>
      - Remapping an implicit key binding to a different key</p>
    <p>Both of these are a rare occurence, as this would immediately
      cause usability issue as you'd be deviating from standard control
      behavior, but it may perhaps be useful in some very rare cases. 
      This is why I think it's fine to have to do a bit more work to
      achieve this (ie. subclass a Behavior).<br>
    </p>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7D515C83537405C777AE5A8A@DM5PR1001MB2172.namprd10.prod.outlook.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.5in"><span
            style="font-size:11.0pt">1. The way I understand it, the
            only thing a public InputMap API would<br>
            enable developers to do would be to change key mappings of
            existing<br>
            control functionality. For example, I could re-map the left
            arrow to<br>
            invoke the "moveRight" function, or I could re-map ctrl+A to
            "copy"<br>
            text, instead of "select all" text. But why would I want to
            do that?<br>
            These are default mappings for a reason. Is there any
            example in which<br>
            such a re-mapping would potentially be useful?</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">The public API should *<b>enable</b>* the
            possibility, even if the core set of controls do not require
            it.  I It is not the case of whether you want to remap
            ctrl-A to COPY, but a case when an application developer has
            a requirement to remap something (command-E to command-G). 
            You even hint at such a requirement when talking about
            navigating camel case words.</span></p>
      </div>
    </blockquote>
    <p>How are you going to configure all the intricacies here?  When
      should a key trigger, on PRESSED, RELEASED, on both?  What about
      when I hold it down for more than 0.7 seconds?  That's not
      something I made up, but in use in actual code:<br>
    </p>
    <p>      long heldTime = System.currentTimeMillis() -
      keyPressedStartTime;<br>
      <br>
            if (keyPressedCode == event.getCode() && heldTime
      >= 700) {<br>
              handleLongPressKeyEvent(event);<br>
            }</p>
    <p>...there are so many cases, and there is no way this can all be
      captured with a simple "A to B" input map.</p>
    <p>It also still ignores the fact that some of these standard keys
      react differently already.  Take SPACE for Button for example; it
      doesn't fire on PRESSED, it fires on RELEASED.  If I want it to
      fire immediately (so I can do key repeat on Buttons, for some game
      or something), I already need to write a custom function, but
      without the benefit of being able to access ButtonBehavior's
      internal state, like the "keydown" flag (which to be clear is not
      the same as Control.isArmed()).</p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7D515C83537405C777AE5A8A@DM5PR1001MB2172.namprd10.prod.outlook.com">
      <div class="WordSection1">
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.5in"><span
            style="font-size:11.0pt">2. We seem to be talking about text
            a lot. Is there any specific<br>
            example beyond TextInputControl that would benefit from this
            feature?<br>
            Maybe this should be an extension for TIC, and not for the
            control<br>
            architecture as a whole?</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">Some controls do not need an input map, some
            do.  Some controls may not benefit from key mapping, but
            others do.  I focused on TIC because that’s the area I am
            currently focused on, but perhaps Tree/Table view could be
            another case where custom key mapping might be useful.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.5in"><span
            style="font-size:11.0pt">3. I have two examples that are not
            possible in JavaFX right now (at<br>
            last not out of the box):<br>
            ...<br>
            The proposed API doesn't enable me to implement those
            features, does<br>
            it?</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">It does, it was specifically designed with these
            requirements in mind.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">For example, for<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal" style="margin-left:.5in"><span
            style="font-size:11.0pt">Scroll through text on a
            word-by-word basis (look for: "Use CamelHump words"</span><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Iosevka Fixed
            SS16"">You’d define a custom function tags for
            NEXT_CAMEL_HUMP_STOP/PREVIOS_CAMEL_HUMP_STOP and implement
            the functions (get caret position or selection range from
            the control, computing the next/previos stop by looking at
            the text, and setting the caret to the new position), and
            remapping the RIGHT/LEFT keys to the new function.  If
            everything you need is provided to you by the control’s
            public API, you don’t even have to touch the default skin or
            its behavior.</span></p>
      </div>
    </blockquote>
    <p>I'm wondering if you tried doing this already: modify a Skin
      (directly in FX repository), removing one of its more complicated
      bindings, and reimplement it. I suspect that there is quite some
      internal state that is unavailable on Control that you'd need to
      know in order to make it feel again like it is part of the control
      (why else are Behaviors stateful) and so it works exactly the same
      as it did before.  <br>
    </p>
    <p> I suspect that without access to all the internals, such a
      custom function will feel like a hotkey, that disregards anything
      else that's going on in the control, and just does its thing
      whether that's a good idea right now or not; it won't feel as an
      integrated part of the control.</p>
    <p><span style="font-size:11.0pt">--John</span></p>
    <span style="font-size:12.0pt;color:black"><o:p></o:p></span>
    <blockquote type="cite"
cite="mid:DM5PR1001MB2172E7D515C83537405C777AE5A8A@DM5PR1001MB2172.namprd10.prod.outlook.com">
      <div class="WordSection1">
        <div id="mail-editor-reference-message-container">
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0in 0in 0in">
            </div>
            <div>
              <p class="MsoNormal"></p>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>