RFR: 8241192: [macosx] Wrong letter typed after ´ symbol when using Finnish layout
Nikita Provotorov
duke at openjdk.java.net
Thu Feb 10 12:48:04 UTC 2022
On Fri, 28 Jan 2022 09:38:35 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
> If we press " ´ " (on U.S. keyboard layout it is the [+] button just before the [delete] button), and then press "s" , 2 "´" characters are entered in a text field instead of "´s" with "Finish" keyboard layout.
> This is because, although " ´ " is construed as "complex" char and inserted properly the next "s" character is treated as non-complex character as it's utf8Length is 1 and utf16Length is 2, so we need to explicitly make it a "complex" char sequence if the code point is 0x73 ie "s" in Finnish layout for it to be inserted properly.
Hey, folks! With my environment the patch fixes only the `´` + `s` combination, but does nothing with all other broken keys, i.e. all except `e`, `u`, `i`, `o`, `a`.
Can you please verify you are reproducing this behavior too?
My environment:
* macOS 11.6.1;
* Xcode 13.2.1;
* Boot JDK 17.0.1 (for building);
* Finnish layout for testing.
Reproducer:
package com.company;
import javax.swing.*;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.text.AttributedCharacterIterator;
public class KeyboardWindow {
final JFrame frame;
final JTextArea textArea;
KeyboardWindow() {
frame = new JFrame();
frame.setSize(300, 200);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle("Keyboard Window");
textArea = new JTextArea();
textArea.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
//System.out.println("keyTyped 0x" + Integer.toHexString(e.getKeyChar()) + ": " + e + "\n");
}
@Override
public void keyPressed(KeyEvent e) {
//System.out.println("keyPressed: " + e + "\n");
}
@Override
public void keyReleased(KeyEvent e) {
//System.out.println("keyReleased: " + e + "\n");
}
});
textArea.addInputMethodListener(new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
//System.out.println("inputMethodTextChanged: " + event + "\n");
}
@Override
public void caretPositionChanged(InputMethodEvent event) {
//System.out.println("caretPositionChanged: " + event + "\n");
}
});
frame.add(textArea);
frame.pack();
frame.setSize(300, 300);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(KeyboardWindow::new);
}
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/7262
More information about the client-libs-dev
mailing list