From ab98c1b871baff665fd55b251af75e9dd12a944e Mon Sep 17 00:00:00 2001 From: ericek111 Date: Sat, 24 Oct 2026 12:12:35 +0000 Subject: [PATCH] Leave the cluster's time out of the bandmap hover comment A cluster line ends with the time of the spot, which the age on the first line already says. Co-Authored-By: Claude Sonnet 5.5 --- src/Nonemm.Spotting/SpotDescription.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Nonemm.Spotting/SpotDescription.cs b/src/Nonemm.Spotting/SpotDescription.cs index 6b91edd..32dcce3 100644 --- a/src/Nonemm.Spotting/SpotDescription.cs +++ b/src/Nonemm.Spotting/SpotDescription.cs @@ -1,11 +1,12 @@ using System.Globalization; +using System.Text.RegularExpressions; namespace Nonemm.Spotting; /// What the bandmap shows when the pointer rests on a spot: the frequency, /// who spotted it and how long ago, and the comment if it says more than the /// sideband. -public static class SpotDescription +public static partial class SpotDescription { public static string Of(Spot spot, DateTime? nowUtc = null) { @@ -19,6 +20,9 @@ public static class SpotDescription return comment.Length > 0 ? $"{first}\n{comment}" : first; } + [GeneratedRegex(@"\s*\b\d{4}Z$", RegexOptions.IgnoreCase)] + private static partial Regex TrailingTime(); + private static string Age(TimeSpan span) { int minutes = Math.Max(0, (int)span.TotalMinutes); @@ -34,7 +38,9 @@ public static class SpotDescription private static string Comment(string text) { string clean = new([.. text.Where(c => !char.IsControl(c))]); - clean = clean.Trim(); + // the cluster ends its line with the time of the spot, which the age + // already says + clean = TrailingTime().Replace(clean, "").Trim(); return clean.ToUpperInvariant() is "LSB" or "USB" or "SSB" ? "" : clean; } }