From: Jean-Philippe Bruyère Date: Sat, 30 Oct 2021 22:30:56 +0000 (+0200) Subject: use keyevt modifiers where possible X-Git-Tag: v0.9.8-beta~5 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=a4eb3208f3ce30f4269f71374876cbeabbd87273;p=jp%2Fcrow.git use keyevt modifiers where possible --- diff --git a/Crow/src/Widgets/Label.cs b/Crow/src/Widgets/Label.cs index 9379e5d2..7bd16b92 100644 --- a/Crow/src/Widgets/Label.cs +++ b/Crow/src/Widgets/Label.cs @@ -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; diff --git a/Crow/src/Widgets/TextBox.cs b/Crow/src/Widgets/TextBox.cs index 12d6ce1e..900075ff 100644 --- a/Crow/src/Widgets/TextBox.cs +++ b/Crow/src/Widgets/TextBox.cs @@ -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;