]> O.S.I.I.S - jp/crow.git/commitdiff
use keyevt modifiers where possible
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 30 Oct 2021 22:30:56 +0000 (00:30 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 30 Oct 2021 22:30:56 +0000 (00:30 +0200)
Crow/src/Widgets/Label.cs
Crow/src/Widgets/TextBox.cs

index 9379e5d24cf273424ab8af93e25107d2a69a5286..7bd16b92afe63958dffd903a8b65857f3221ec25 100644 (file)
@@ -598,8 +598,8 @@ namespace Crow
                        }
                        return 0;
                }
-               protected void checkShift () {
-                       if (IFace.Shift) {
+               protected void checkShift (Modifier modifier) {
+                       if (modifier.HasFlag (Modifier.Shift)) {
                                if (!selectionStart.HasValue)
                                        selectionStart = CurrentLoc;
                        } else
@@ -746,46 +746,46 @@ namespace Crow
                                break;
                        case Key.Home:
                                targetColumn = -1;
-                               checkShift ();
-                               if (IFace.Ctrl)
+                               checkShift (e.Modifiers);
+                               if (e.Modifiers.HasFlag (Modifier.Control))
                                        CurrentLoc = new CharLocation (0, 0);
                                else
                                        CurrentLoc = new CharLocation (CurrentLoc.Value.Line, 0);
                                RegisterForRedraw ();
                                break;
                        case Key.End:
-                               checkShift ();
-                               int l = IFace.Ctrl ? lines.Count - 1 : CurrentLoc.Value.Line;
+                               checkShift (e.Modifiers);
+                               int l = e.Modifiers.HasFlag (Modifier.Control) ? lines.Count - 1 : CurrentLoc.Value.Line;
                                CurrentLoc = new CharLocation (l, lines[l].Length);
                                RegisterForRedraw ();
                                break;
                        case Key.Insert:
-                               if (IFace.Ctrl && !SelectionIsEmpty)
+                               if (e.Modifiers.HasFlag (Modifier.Control) && !SelectionIsEmpty)
                                        IFace.Clipboard = SelectedText;
                                break;
                        case Key.Left:
-                               checkShift ();
-                               if (IFace.Ctrl)
+                               checkShift (e.Modifiers);
+                               if (e.Modifiers.HasFlag (Modifier.Control))
                                        GotoWordStart ();
                                else
                                        MoveLeft ();
                                RegisterForRedraw ();
                                break;
                        case Key.Right:
-                               checkShift ();
-                               if (IFace.Ctrl)
+                               checkShift (e.Modifiers);
+                               if (e.Modifiers.HasFlag (Modifier.Control))
                                        GotoWordEnd ();
                                else
                                        MoveRight ();
                                RegisterForRedraw ();
                                break;
                        case Key.Up:
-                               checkShift ();
+                               checkShift (e.Modifiers);
                                LineMove (-1);
                                RegisterForRedraw ();
                                break;
                        case Key.Down:
-                               checkShift ();
+                               checkShift (e.Modifiers);
                                LineMove (1);
                                RegisterForRedraw ();
                                break;
index 12d6ce1e349a9c87854cc6fbfe21b18c5ef47e16..900075ff8ebbb9a6e6999e3ec211db3ccd206e72 100644 (file)
@@ -306,12 +306,12 @@ namespace Crow
                                update (new TextChange (selection.Start, selection.Length, "\t"));
                                break;
                        case Key.PageUp:
-                               checkShift ();
+                               checkShift (e.Modifiers);
                                LineMove (-visibleLines);
                                RegisterForRedraw ();
                                break;
                        case Key.PageDown:
-                               checkShift ();
+                               checkShift (e.Modifiers);
                                LineMove (visibleLines);
                                RegisterForRedraw ();
                                break;