[MonoDevelop] Two shortcut key bugs in Mono.TextEditor

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Mar 23 12:32:58 EDT 2010


On Sun, Mar 21, 2010 at 5:39 AM, Matt Guo <matt at mattguo.com> wrote:
> [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.

What input scheme do you have? I wonder if your problem is related to that.

Anyway, I think this could be fixed in GetKeyCode.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list