<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@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;}
/* Style Definitions */
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;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<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.<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.<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.<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"">Same applies 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">"Home moves caret to first non-whitespace character".</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"">Depending on what you want, the custom function could consult the preference setting, if any, and compute the new caret position entirely from information available via public
APIs in the control. A smarter control might even provide these function variants as part of its default behavior, for example MOVE_LINE_START/MOVE_FIRST_NON_WHITESPACE_CHAR or something like that.<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’s probably my fault that it is not immediately apparent from the proposal that these use cases are supported by design.<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"">Thanks<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<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""><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""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of Michael Strauß <michaelstrau2@gmail.com><br>
<b>Date: </b>Wednesday, November 8, 2023 at 11:24<br>
<b>To: </b>openjfx-dev@openjdk.org <openjfx-dev@openjdk.org><br>
<b>Subject: </b>Re: [External] : Re: Key binding customization proposal<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Hi Andy!<br>
<br>
> There is a number of use cases for runtime modifications:<br>
><br>
> - there might be a requirement to switch between vim/emacs/etc. key mapping<br>
> - there might be a requirement to customize the mapping per user configuration (see the Eclipse “Keys” UI that I’ve shown before)<br>
> - there are many apps (AquaFold Data Studio, for one I remember) which allows for customization of key bindings<br>
<br>
Maybe we should pull on this string a little bit more. It's still not<br>
clear to me what the requirements actually are. What is meant by<br>
"switch between vim/emacs/etc. key mappings"? Maybe you can give a<br>
specific example.<br>
<br>
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?<br>
<br>
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?<br>
<br>
3. I have two examples that are not possible in JavaFX right now (at<br>
last not out of the box):<br>
<br>
- In IntelliJ, there's an option that toggles the way I can scroll<br>
through text on a word-by-word basis (look for: "Use CamelHump<br>
words"). If toggled, I can ctrl-arrow left or right, and the caret<br>
will be placed either at the beginning of the next or previous word<br>
boundary, or alternatively at the beginning of the next or previous<br>
case change within a word (the "CamelHump").<br>
<br>
- Also in IntelliJ, there's an option for "Home moves caret to first<br>
non-whitespace character". The alterative is that Home moves the caret<br>
to the beginning of the line.<br>
<br>
The proposed API doesn't enable me to implement those features, does<br>
it? This leads me to think that what we really need is a way to<br>
customize the "behavior" (whatever this ends up being) of a control<br>
more so than its default key mappings.<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>