Skip to content

Commit

Permalink
adjustment to handle dot / period for chrome native #1192
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Jun 30, 2020
1 parent 1c4b48b commit 08aa9bd
Showing 1 changed file with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,29 @@ private void sendKey(char c, int modifiers, String type, Integer keyCode) {
DevToolsMessage dtm = method("Input.dispatchKeyEvent")
.param("modifiers", modifiers)
.param("type", type);
switch (keyCode) {
case 13:
dtm.param("text", "\r"); // important ! \n does NOT work for chrome
dtm.param("windowsVirtualKeyCode", keyCode);
break;
case 9:
if ("char".equals(type)) {
return; // special case
}
dtm.param("text", "");
dtm.param("windowsVirtualKeyCode", keyCode);
break;
default:
dtm.param("text", c + "");
dtm.param("windowsVirtualKeyCode", keyCode);
if (keyCode == null) {
dtm.param("text", c + "");
} else {
switch (keyCode) {
case 13:
dtm.param("text", "\r"); // important ! \n does NOT work for chrome
break;
case 9: // TAB
if ("char".equals(type)) {
return; // special case
}
dtm.param("text", "");
break;
case 46: // DOT
if ("rawKeyDown".equals(type)) {
dtm.param("type", "keyDown"); // special case
}
dtm.param("text", ".");
break;
default:
dtm.param("text", c + "");
}
dtm.param("windowsVirtualKeyCode", keyCode);
}
dtm.send();
}
Expand Down

0 comments on commit 08aa9bd

Please sign in to comment.