From eaf9013acbc29940d803b9199cde3b3a78c6d761 Mon Sep 17 00:00:00 2001 From: myk Date: Wed, 13 Feb 2013 08:20:31 +0000 Subject: [PATCH] add in suggested filter for nonprintable characters --- src/main/java/forge/gui/deckeditor/CDeckEditorUI.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java b/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java index 66f155dd313..2c556ba90c0 100644 --- a/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java +++ b/src/main/java/forge/gui/deckeditor/CDeckEditorUI.java @@ -29,7 +29,6 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; -import java.util.Locale; import javax.swing.JTable; import javax.swing.Popup; @@ -367,7 +366,7 @@ public enum CDeckEditorUI implements CardContainer { return; case KeyEvent.VK_ENTER: - case 13: // there doesn't seem to be a KeyEvent constant for this + case 13: // no KeyEvent constant for this, but this comes up on OSX for shift-enter if (!str.toString().isEmpty()) { // no need to add (or subtract) 1 -- the table selection will already // have been advanced by the (shift+) enter key @@ -389,12 +388,11 @@ public enum CDeckEditorUI implements CardContainer { // fall through default: - if (okModifiers != (e.getModifiers() | okModifiers)) { - // shift down is ok. anything else is likely to be a hotkey and should not be added to the string + // shift and/or alt-graph down is ok. anything else is a hotkey (e.g. ctrl-f) + if (okModifiers != (e.getModifiers() | okModifiers) + || !CharUtils.isAsciiPrintable(e.getKeyChar())) { // escape sneaks in here on Windows return; } - // Suggested change: - // if (!CharUtils.isAsciiPrintable(e.getKeyChar())) return; str.append(e.getKeyChar()); }