Skip to content

Commit 0fc9340

Browse files
committed
HexView code cleanup 3
1 parent f40dcab commit 0fc9340

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Terminal.Gui/Views/HexView.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ protected void RaisePositionChanged ()
502502
/// </summary>
503503
protected virtual void OnPositionChanged (HexViewEventArgs e) { }
504504

505+
/// <summary>Event to be invoked when the position and cursor position changes.</summary>
506+
public event EventHandler<HexViewEventArgs>? PositionChanged;
507+
505508
/// <inheritdoc/>
506509
public override bool OnProcessKeyDown (Key keyEvent)
507510
{
@@ -521,15 +524,15 @@ public override bool OnProcessKeyDown (Key keyEvent)
521524
int value;
522525
var k = (char)keyEvent.KeyCode;
523526

524-
if (k >= 'A' && k <= 'F')
527+
if (k is >= 'A' and <= 'F')
525528
{
526529
value = k - 'A' + 10;
527530
}
528-
else if (k >= 'a' && k <= 'f')
531+
else if (k is >= 'a' and <= 'f')
529532
{
530533
value = k - 'a' + 10;
531534
}
532-
else if (k >= '0' && k <= '9')
535+
else if (k is >= '0' and <= '9')
533536
{
534537
value = k - '0';
535538
}
@@ -569,9 +572,6 @@ public override bool OnProcessKeyDown (Key keyEvent)
569572
return false;
570573
}
571574

572-
/// <summary>Event to be invoked when the position and cursor position changes.</summary>
573-
public event EventHandler<HexViewEventArgs>? PositionChanged;
574-
575575
///<inheritdoc/>
576576
public override Point? PositionCursor ()
577577
{
@@ -844,7 +844,7 @@ private bool Navigate (NavigationDirection direction)
844844
/// <inheritdoc/>
845845
bool IDesignable.EnableForDesign ()
846846
{
847-
Source = new MemoryStream (Encoding.UTF8.GetBytes ("HexEditor Unicode that shouldn't 𝔹Aℝ𝔽!"));
847+
Source = new MemoryStream (Encoding.UTF8.GetBytes ("HexView data with wide codepoints: 𝔹Aℝ𝔽!"));
848848

849849
return true;
850850
}

0 commit comments

Comments
 (0)