<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">I don’t think a TextFormatter would work. The formatter would just see a caret arrive and then a space character. It would look just like the user typed those characters separately.<div><br></div><div>The unexpected sequence is:</div><div>- a PRESSED event arrives for the SPACE key</div><div>- a TYPED event arrives for the dead key character</div><div>- a TYPED event arrives for the space character</div><div>- a RELEASED event arrives for the SPACE key</div><div><br></div><div>You would have to register some filters that track state to detect this sequence and discard the second TYPED event.</div><div><br></div><div>I can’t think of another way of doing this. You can’t track the dead key state reliably or know for sure that a TYPED event occurred while a dead key sequence was ending.</div><div><br></div><div>I’ve submitted a PR (it’s a very small change to the code).</div><div><br></div><div>Martin<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Sep 27, 2024, at 6:18 AM, Thiago Milczarek Sayão <thiago.sayao@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr">Johan,<div><br></div><div>I guess you could use a TextFormatter<> to remove the extra space when there's a dead key character before. It would work as</div><div><br></div><div>textField.setTextFormatter(new PasswordTextFilter())</div><div><br></div><div>public class PasswordTextFilter implements UnaryOperator<TextFormatter.Change> {</div><div><br></div><div>    @Override<br>    public TextFormatter.Change apply(final TextFormatter.Change aT) {</div><div>       //logic to ignore the space if there's a dead key before<br>    }<br></div><div>}<br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sex., 27 de set. de 2024 às 09:42, Johan Corveleyn <<a href="mailto:jcorvel@gmail.com">jcorvel@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, Sep 26, 2024 at 10:37 AM Johan Corveleyn <<a href="mailto:jcorvel@gmail.com" target="_blank">jcorvel@gmail.com</a>> wrote:<br>
><br>
> Thanks, and thank you Martin for filing the issue <a href="https://bugs.openjdk.org/browse/JDK-8340982" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8340982</a>. I'll try to create an account on <a href="http://openjdk.org/" rel="noreferrer" target="_blank">openjdk.org</a> to be able to watch the issue :-).<br>
<br>
Seems it's not that easy to get an account on <a href="http://bugs.openjdk.org/" rel="noreferrer" target="_blank">bugs.openjdk.org</a>, so<br>
never mind that ... I'll check in on the issue from time to time (and<br>
of course I keep an eye on this mailinglist anyway). I'm not expecting<br>
this to be fixed immediately of course, I suppose everyone here has<br>
lots of things on their plate, and lots of other priorities; and I<br>
have little to offer as contribution myself at the moment.<br>
<br>
In the meantime: does anybody have an idea for an elegant workaround<br>
for this (to have a TextField and PasswordField where ^+<space> just<br>
yields '^' on Windows + US International keyboard)? Injecting a Swing<br>
component for this is an option, but I'd like to know if there are<br>
others.<br>
<br>
Thanks,<br>
-- <br>
Johan<br>
</blockquote></div>
</div></blockquote></div><br></div></body></html>