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:
2026-09-10 11:30:07 +00:00
co-authored by Claude Opus 5
parent 24542b8355
commit d5788da240
4 changed files with 35 additions and 13 deletions
+1 -1
View File
@@ -71,7 +71,7 @@
</MenuItem> </MenuItem>
<MenuItem Header="_Edit"> <MenuItem Header="_Edit">
<MenuItem Header="Wipe Out Entry Fields" Click="OnWipe" InputGesture="Ctrl+W" /> <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 /> <Separator />
<MenuItem Header="Edit Last Contact" Click="OnEditLastContact" InputGesture="Ctrl+Y" /> <MenuItem Header="Edit Last Contact" Click="OnEditLastContact" InputGesture="Ctrl+Y" />
<MenuItem Header="Add a Note to Last/Current Contact" Click="OnAddNote" InputGesture="Ctrl+N" /> <MenuItem Header="Add a Note to Last/Current Contact" Click="OnAddNote" InputGesture="Ctrl+N" />
+5 -10
View File
@@ -390,7 +390,7 @@ public sealed partial class EntryWindow : Window
break; break;
case Key.W when e.KeyModifiers.HasFlag(KeyModifiers.Alt): case Key.W when e.KeyModifiers.HasFlag(KeyModifiers.Alt):
e.Handled = true; e.Handled = true;
OnRestoreWiped(this, new RoutedEventArgs()); OnWipeOrRestore(this, new RoutedEventArgs());
break; break;
case Key.L when e.KeyModifiers.HasFlag(KeyModifiers.Control): case Key.L when e.KeyModifiers.HasFlag(KeyModifiers.Control):
e.Handled = true; e.Handled = true;
@@ -686,20 +686,15 @@ public sealed partial class EntryWindow : Window
Refresh(); Refresh();
} }
/// N1MM's Alt+W: the boxes the last wipe cleared are filled in again. With /// N1MM's Alt+W: it wipes the boxes, and pressed again on empty boxes it
/// something typed in them there is nowhere to put it back, so the status /// puts back what it wiped.
/// line says so rather than throwing the typing away. private void OnWipeOrRestore(object? sender, RoutedEventArgs e)
private void OnRestoreWiped(object? sender, RoutedEventArgs e)
{ {
if (Logging is null) if (Logging is null)
{ {
return; return;
} }
if (!Logging.RestoreWiped()) Logging.WipeOrRestore();
{
Status(Logging.Entry.IsEmpty ? "no wiped contact to put back" : "wipe the boxes first");
return;
}
ResetEsm(); ResetEsm();
SyncBoxes(); SyncBoxes();
boxes[0].Focus(); boxes[0].Focus();
+12 -1
View File
@@ -448,7 +448,18 @@ public sealed class OperatingPosition
ClearEntry(); 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 /// 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 /// again — N1MM restores into an empty entry only, so nothing typed since
/// the wipe is lost. /// the wipe is lost.
@@ -649,7 +649,23 @@ public class OperatingPositionTests
public void EmptyBoxesGiveNoProblem() => public void EmptyBoxesGiveNoProblem() =>
Assert.Null(Session().EntryProblem()); 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] [Fact]
public void WhatAWipeClearedComesBack() public void WhatAWipeClearedComesBack()
{ {