Support for Xterm ctrl/alt/shift function keys
[fanfix.git] / src / jexer / TKeypress.java
index 5d1eabc9889adc057fdbda821e91de5b52c09d5e..5e551d8c18f4397a33bb0dd10ebe1544c06ff728 100644 (file)
@@ -296,6 +296,23 @@ public final class TKeypress {
                 && (shift == that.shift));
     }
 
+    /**
+     * Comparison check, omitting the ctrl/alt/shift flags.
+     *
+     * @param rhs another TKeypress instance
+     * @return true if all fields (except for ctrl/alt/shift) are equal
+     */
+    public boolean equalsWithoutModifiers(final Object rhs) {
+        if (!(rhs instanceof TKeypress)) {
+            return false;
+        }
+
+        TKeypress that = (TKeypress) rhs;
+        return ((isFunctionKey == that.isFunctionKey)
+                && (keyCode == that.keyCode)
+                && (ch == that.ch));
+    }
+
     /**
      * Hashcode uses all fields in equals().
      *