[MonoDevelop] Two shortcut key bugs in Mono.TextEditor

Matt Guo matt at mattguo.com
Sun Mar 21 05:39:59 EDT 2010


[Bug 1]
Mono.TextEditor can't call "Redo" by "Ctrl + Shift + z".

[To fix it]
in SImpleEditMode.cs, Change this line (around Ln 251):

keyBindings.Add (GetKeyCode (Gdk.Key.z, Gdk.ModifierType.ControlMask |
Gdk.ModifierType.ShiftMask), MiscActions.Redo);
->
keyBindings.Add (GetKeyCode (Gdk.Key.Z, Gdk.ModifierType.ControlMask |
Gdk.ModifierType.ShiftMask), MiscActions.Redo);

i.e. make the "z" uppercase.

[Bug 2]
Mono.TextEditor can't call most shortcut key when CapsLock is on (iff
the shortcut key contains any alphabet).
E.g. when CapsLock is on, pressing "Ctrl + z" won't call "undo", since
in SimpleEditMode, the expected key code is GetKeyCode (Gdk.Key.z,
Gdk.ModifierType.ControlMask), while the input keyCode is
 GetKeyCode (Gdk.Key.Z, Gdk.ModifierType.ControlMask).

[To fix it]
So IMO, a more general solution to fix Bug 1 and 2 could be:
Make a KeyCombination class:
class KeyCombination {
  Gdk.Key Key { get; set; }
  Gdk.ModifierType Modifier  { get; set; }
  override Equals (... //Ignore the case of Key here.
}

and Make KeyCombination the key type of the KeyBindings dictionary in
SimpleEditMode.

-- 
B.R.
GUO Rui (Matt)


More information about the Monodevelop-list mailing list