aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-10-31 00:30:56 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-10-31 00:30:56 +0200
commita4eb3208f3ce30f4269f71374876cbeabbd87273 (patch)
tree78200a38b82ed018f933abfe0972358efa58dfde
parent2dc30c4d59e51101a692b9533fef7aa7ccc13afd (diff)
use keyevt modifiers where possible
-rw-r--r--Crow/src/Widgets/Label.cs26
-rw-r--r--Crow/src/Widgets/TextBox.cs4
2 files changed, 15 insertions, 15 deletions
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;