Wipe on Alt+W as well as put the boxes back
Alt+W only put the boxes back, so wiping needed Ctrl+W or the button. It now goes both ways, the way N1MM's Wipe button does: with something in the boxes it clears them, and pressed again on empty boxes it puts back what it cleared. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
@@ -71,7 +71,7 @@
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Edit">
|
||||
<MenuItem Header="Wipe Out Entry Fields" Click="OnWipe" InputGesture="Ctrl+W" />
|
||||
<MenuItem Header="Restore Wiped Entry Fields" Click="OnRestoreWiped" InputGesture="Alt+W" />
|
||||
<MenuItem Header="Wipe Out or Restore Entry Fields" Click="OnWipeOrRestore" InputGesture="Alt+W" />
|
||||
<Separator />
|
||||
<MenuItem Header="Edit Last Contact" Click="OnEditLastContact" InputGesture="Ctrl+Y" />
|
||||
<MenuItem Header="Add a Note to Last/Current Contact" Click="OnAddNote" InputGesture="Ctrl+N" />
|
||||
|
||||
@@ -390,7 +390,7 @@ public sealed partial class EntryWindow : Window
|
||||
break;
|
||||
case Key.W when e.KeyModifiers.HasFlag(KeyModifiers.Alt):
|
||||
e.Handled = true;
|
||||
OnRestoreWiped(this, new RoutedEventArgs());
|
||||
OnWipeOrRestore(this, new RoutedEventArgs());
|
||||
break;
|
||||
case Key.L when e.KeyModifiers.HasFlag(KeyModifiers.Control):
|
||||
e.Handled = true;
|
||||
@@ -686,20 +686,15 @@ public sealed partial class EntryWindow : Window
|
||||
Refresh();
|
||||
}
|
||||
|
||||
/// N1MM's Alt+W: the boxes the last wipe cleared are filled in again. With
|
||||
/// something typed in them there is nowhere to put it back, so the status
|
||||
/// line says so rather than throwing the typing away.
|
||||
private void OnRestoreWiped(object? sender, RoutedEventArgs e)
|
||||
/// N1MM's Alt+W: it wipes the boxes, and pressed again on empty boxes it
|
||||
/// puts back what it wiped.
|
||||
private void OnWipeOrRestore(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (Logging is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Logging.RestoreWiped())
|
||||
{
|
||||
Status(Logging.Entry.IsEmpty ? "no wiped contact to put back" : "wipe the boxes first");
|
||||
return;
|
||||
}
|
||||
Logging.WipeOrRestore();
|
||||
ResetEsm();
|
||||
SyncBoxes();
|
||||
boxes[0].Focus();
|
||||
|
||||
@@ -448,7 +448,18 @@ public sealed class OperatingPosition
|
||||
ClearEntry();
|
||||
}
|
||||
|
||||
/// N1MM's Alt+W: puts back what the last wipe cleared. False when no wipe
|
||||
/// N1MM's Alt+W and its Wipe button: one key both ways. With something in
|
||||
/// the boxes it clears them; with the boxes empty it puts back what the
|
||||
/// last wipe cleared.
|
||||
public void WipeOrRestore()
|
||||
{
|
||||
if (!RestoreWiped())
|
||||
{
|
||||
Wipe();
|
||||
}
|
||||
}
|
||||
|
||||
/// Puts back what the last wipe cleared. False when no wipe
|
||||
/// has anything to put back, or when the boxes have something in them
|
||||
/// again — N1MM restores into an empty entry only, so nothing typed since
|
||||
/// the wipe is lost.
|
||||
|
||||
@@ -649,7 +649,23 @@ public class OperatingPositionTests
|
||||
public void EmptyBoxesGiveNoProblem() =>
|
||||
Assert.Null(Session().EntryProblem());
|
||||
|
||||
/// N1MM's Alt+W: a wipe keeps what was in the boxes and Alt+W puts it back.
|
||||
/// N1MM's Alt+W goes both ways: it wipes the boxes, and pressed again on
|
||||
/// empty boxes it puts back what it wiped.
|
||||
[Fact]
|
||||
public void AltWWipesAndThenPutsTheBoxesBack()
|
||||
{
|
||||
OperatingPosition session = Session();
|
||||
Type(session, "JA1XYZ", "25");
|
||||
|
||||
session.WipeOrRestore();
|
||||
Assert.Equal("", session.Entry.Call);
|
||||
|
||||
session.WipeOrRestore();
|
||||
Assert.Equal("JA1XYZ", session.Entry.Call);
|
||||
Assert.Equal("25", session.Entry.ValueOf(ExchangeSlot.Zone));
|
||||
}
|
||||
|
||||
/// A wipe keeps what was in the boxes and Alt+W puts it back.
|
||||
[Fact]
|
||||
public void WhatAWipeClearedComesBack()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user