Put the wiped entry boxes back on Alt+W
N1MM wipes on Ctrl+W and puts the boxes back on Alt+W, which this had no key for. A wipe now keeps the call, the exchange, the name, the comment and the sent time, and Alt+W fills them in again. Wiping empty boxes keeps what the wipe before it held, and the boxes are only filled in again when they are empty, so nothing typed since the wipe is thrown away. A call moved onto the call stack is not kept: it has not gone anywhere and putting it back would make a second copy of it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
@@ -149,7 +149,7 @@ public sealed class OperatingPosition
|
||||
return false;
|
||||
}
|
||||
Stack.Add(Entry.Call.Trim(), worth.IsNewMultiplier);
|
||||
Wipe();
|
||||
ClearEntry();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public sealed class OperatingPosition
|
||||
return false;
|
||||
}
|
||||
string call = Stack.Next();
|
||||
Wipe();
|
||||
ClearEntry();
|
||||
Entry.Call = call;
|
||||
Entry.FocusOn(0);
|
||||
Session.NotifyChanged();
|
||||
@@ -194,7 +194,7 @@ public sealed class OperatingPosition
|
||||
bool isMultiplier = worth.IsNewMultiplier;
|
||||
string next = Stack.Next();
|
||||
Stack.Add(call, isMultiplier);
|
||||
Wipe();
|
||||
ClearEntry();
|
||||
Entry.Call = next;
|
||||
Entry.FocusOn(0);
|
||||
Session.NotifyChanged();
|
||||
@@ -341,7 +341,8 @@ public sealed class OperatingPosition
|
||||
/// log, Ctrl+A forward, Enter writes the changes back and Esc leaves.
|
||||
public Qso? Editing { get; private set; }
|
||||
|
||||
private (string Call, string[] Values, string Name, string Comment)? held;
|
||||
private TypedEntry? held;
|
||||
private TypedEntry? wiped;
|
||||
|
||||
/// Steps one contact back or forward and loads it into the boxes. False
|
||||
/// when the log has nothing that way; stepping forward past the newest
|
||||
@@ -364,7 +365,7 @@ public sealed class OperatingPosition
|
||||
LeaveQuickEdit();
|
||||
return true;
|
||||
}
|
||||
held ??= (Entry.Call, [.. Enumerable.Range(1, Entry.FieldCount - 1).Select(f => Entry[f])], OtherName, Comment);
|
||||
held ??= Typed();
|
||||
Editing = qsos[wanted];
|
||||
LoadFrom(Editing);
|
||||
Session.NotifyChanged();
|
||||
@@ -381,13 +382,7 @@ public sealed class OperatingPosition
|
||||
Editing = null;
|
||||
if (held is { } typed)
|
||||
{
|
||||
Entry.Call = typed.Call;
|
||||
for (int field = 1; field < Entry.FieldCount; field++)
|
||||
{
|
||||
Entry[field] = typed.Values[field - 1];
|
||||
}
|
||||
OtherName = typed.Name;
|
||||
Comment = typed.Comment;
|
||||
PutBack(typed);
|
||||
held = null;
|
||||
}
|
||||
Session.NotifyChanged();
|
||||
@@ -441,7 +436,37 @@ public sealed class OperatingPosition
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// Clears the boxes, keeping what was in them for `RestoreWiped`. An entry
|
||||
/// with nothing typed in it is not worth keeping, so a second wipe does not
|
||||
/// throw the first one away.
|
||||
public void Wipe()
|
||||
{
|
||||
if (!Entry.IsEmpty)
|
||||
{
|
||||
wiped = Typed();
|
||||
}
|
||||
ClearEntry();
|
||||
}
|
||||
|
||||
/// N1MM's Alt+W: 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.
|
||||
public bool RestoreWiped()
|
||||
{
|
||||
if (wiped is not { } typed || !Entry.IsEmpty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PutBack(typed);
|
||||
Entry.FocusOn(0);
|
||||
Session.NotifyChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Wipes without keeping anything: the call has gone somewhere else, such
|
||||
/// as onto the call stack, so there is nothing to put back.
|
||||
private void ClearEntry()
|
||||
{
|
||||
Editing = null;
|
||||
held = null;
|
||||
@@ -453,6 +478,26 @@ public sealed class OperatingPosition
|
||||
Session.NotifyChanged();
|
||||
}
|
||||
|
||||
private TypedEntry Typed() => new(
|
||||
Entry.Call,
|
||||
[.. Enumerable.Range(1, Entry.FieldCount - 1).Select(f => Entry[f])],
|
||||
OtherName,
|
||||
Comment,
|
||||
SentTime);
|
||||
|
||||
private void PutBack(TypedEntry typed)
|
||||
{
|
||||
Entry.Call = typed.Call;
|
||||
// the contest can have changed since, and with it the boxes there are
|
||||
for (int field = 1; field < Entry.FieldCount && field <= typed.Values.Count; field++)
|
||||
{
|
||||
Entry[field] = typed.Values[field - 1];
|
||||
}
|
||||
OtherName = typed.Name;
|
||||
Comment = typed.Comment;
|
||||
SentTime = typed.SentTime;
|
||||
}
|
||||
|
||||
/// The name and comment boxes fill the log columns of the same names. A
|
||||
/// contest that exchanges a name has already filled that column, and what
|
||||
/// was exchanged wins.
|
||||
|
||||
Reference in New Issue
Block a user