Skip to content

Commit ccfb6a1

Browse files
johnml1135claude
andcommitted
Show 'filter hides N words' in the status bar for a filtered word list, and show *** for a missing gloss or analysis instead of ? or a dash.
Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
1 parent 97deb48 commit ccfb6a1

16 files changed

Lines changed: 106 additions & 15 deletions

‎src/SIL.Motif.App/MotifAppStrings.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ public static class MotifAppStrings
242242
public static string OpenWarningsAccessibleName => Text("MotifApp.OpenWarningsAccessibleName");
243243

244244
public static string StatusChangesPattern => Text("MotifApp.StatusChangesPattern");
245+
public static string StatusFilterHidesPattern => Text("MotifApp.StatusFilterHidesPattern");
245246

246247
public static string StatusWarningsPattern => Text("MotifApp.StatusWarningsPattern");
247248

‎src/SIL.Motif.App/MotifAppStrings.resx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@
172172
<value>{0, plural, one {# change not applied yet} other {# changes not applied yet}}</value>
173173
<comment>Plural pattern: the status bar changes sentence; # is the count.</comment>
174174
</data>
175+
<data name="MotifApp.StatusFilterHidesPattern" xml:space="preserve">
176+
<value>{0, plural, one {filter hides # word} other {filter hides # words}}</value>
177+
<comment>Plural pattern: status bar note on the Texts page saying how many words the active word-list filter hides; # is the count.</comment>
178+
</data>
175179
<data name="MotifApp.StatusWarningsPattern" xml:space="preserve">
176180
<value>{0, plural, one {# warning} other {# warnings}}</value>
177181
<comment>Plural pattern: the status bar warnings sentence; # is the count.</comment>

‎src/SIL.Motif.App/ViewModels/AssessWordsViewModel.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ public ParserReadingViewModel(int number, ParserReading reading, string? grade)
416416
StoredAnalysisId = reading.StoredAnalysisId;
417417
StoredAnalysisOpinion = reading.StoredAnalysisOpinion;
418418
Text = string.Join(" + ", Morphs.Select(morph => morph.Form)) + " = " +
419-
string.Join(" + ", Morphs.Select(morph => morph.Gloss.Length == 0 ? "?" : morph.Gloss));
419+
string.Join(" + ", Morphs.Select(morph => morph.Gloss.Length == 0 ? MissingValue.Marker : morph.Gloss));
420420
Grade = grade;
421421
IsApproved = grade == ReadingGrade.Approved;
422422
IsDisapproved = grade == ReadingGrade.Disapproved;
@@ -469,7 +469,7 @@ public ParserReadingViewModel(int number, ParserReading reading, string? grade)
469469
public sealed class ParserReadingMorphViewModel
470470
{
471471
private const string UnknownForm = "unknown morpheme";
472-
private readonly string _glossPlaceholder = "?";
472+
private readonly string _glossPlaceholder = MissingValue.Marker;
473473
private readonly string? _entry;
474474
private readonly string _toolName;
475475

@@ -501,13 +501,13 @@ private ParserReadingMorphViewModel(ParserReadingMorph morph, string form, strin
501501

502502
/// <summary>
503503
/// A morpheme from a parser trace, which may not know a morpheme's form or gloss: an unnamed one reads
504-
/// "unknown morpheme" and a missing gloss a dash, never a bare question mark.
504+
/// "unknown morpheme" and a missing gloss three stars, never a bare question mark.
505505
/// </summary>
506506
public static ParserReadingMorphViewModel ForTrace(ParserReadingMorph morph)
507507
{
508508
ArgumentNullException.ThrowIfNull(morph);
509509
var form = string.IsNullOrWhiteSpace(morph.Form) || morph.Form.Trim() == "?" ? UnknownForm : morph.Form;
510-
return new ParserReadingMorphViewModel(morph, form, "—");
510+
return new ParserReadingMorphViewModel(morph, form, MissingValue.Marker);
511511
}
512512

513513
public string Form { get; }

‎src/SIL.Motif.App/ViewModels/AssessmentRowFacts.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ private string ReadingText(int index)
5555
{
5656
if (Source.Readings is { } readings)
5757
return index < readings.Count ? string.Join(" + ", readings[index].Morphs.Select(morph => morph.Form))
58-
+ " = " + string.Join(" + ", readings[index].Morphs.Select(morph => morph.Gloss.Length == 0 ? "?" : morph.Gloss))
58+
+ " = " + string.Join(" + ", readings[index].Morphs.Select(morph => morph.Gloss.Length == 0 ? MissingValue.Marker : morph.Gloss))
5959
: "Unresolved";
6060
var morphs = Source.Morphology!.Analyses[index].Morphs;
6161
return string.Join(" + ", morphs.Select(morph => morph.GuessedString ?? "?")) + " = " +
62-
string.Join(" + ", morphs.Select(_ => "?"));
62+
string.Join(" + ", morphs.Select(_ => MissingValue.Marker));
6363
}
6464
}
6565

‎src/SIL.Motif.App/ViewModels/DifferenceViewModel.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ public WordInteractionState PresentationState
347347
private static string Describe(AssessmentRowFacts row)
348348
{
349349
var readings = row.Source.Readings?.Select(reading => string.Join(" + ", reading.Morphs.Select(morph => morph.Form))
350-
+ " = " + string.Join(" + ", reading.Morphs.Select(morph => morph.Gloss.Length == 0 ? "?" : morph.Gloss)))
350+
+ " = " + string.Join(" + ", reading.Morphs.Select(morph => morph.Gloss.Length == 0 ? MissingValue.Marker : morph.Gloss)))
351351
?? row.Source.Morphology?.Analyses.Select(analysis =>
352352
string.Join(" + ", analysis.Morphs.Select(morph => morph.GuessedString ?? "?")) + " = " +
353-
string.Join(" + ", analysis.Morphs.Select(_ => "?"))) ?? [];
353+
string.Join(" + ", analysis.Morphs.Select(_ => MissingValue.Marker))) ?? [];
354354
var text = string.Join(" | ", readings);
355355
return text.Length == 0 ? row.Result : $"{row.Result}: {text}";
356356
}

‎src/SIL.Motif.App/ViewModels/KeyboardOpinionShortcuts.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace SIL.Motif.App.ViewModels;
77
internal sealed record KeyboardStoredAnalysis(string Id, string Opinion, IReadOnlyList<ParserReadingMorph> Morphs)
88
{
99
public string DisplayReading => string.Join(" ", Morphs.Select(morph =>
10-
$"{morph.Form} = {(string.IsNullOrWhiteSpace(morph.Gloss) ? "?" : morph.Gloss)}"));
10+
$"{morph.Form} = {(string.IsNullOrWhiteSpace(morph.Gloss) ? MissingValue.Marker : morph.Gloss)}"));
1111
}
1212

1313
internal sealed record PendingStoredOpinionChange(
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace SIL.Motif.App.ViewModels;
2+
3+
/// <summary>
4+
/// The FieldWorks marker for a gloss or analysis that is missing. Empty values elsewhere stay empty: no placeholder
5+
/// characters stand in for them.
6+
/// </summary>
7+
public static class MissingValue
8+
{
9+
/// <summary>Shown in place of a missing gloss or analysis.</summary>
10+
public const string Marker = "***";
11+
}

‎src/SIL.Motif.App/ViewModels/ResultsTokenViewModel.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,9 @@ private void SyncPresentationState(Func<WordInteractionState, WordInteractionSta
867867
}
868868

869869
// Forms already carry their own hyphens ("a-", "-a"), so they join as written; glosses join with one.
870-
private static string ReadingText(ParserReading? reading) => reading is null ? "?"
870+
private static string ReadingText(ParserReading? reading) => reading is null ? MissingValue.Marker
871871
: JoinForms(reading.Morphs.Select(morph => morph.Form)) + " ‘" +
872-
string.Join("-", reading.Morphs.Select(morph => morph.Gloss.Length == 0 ? "?" : morph.Gloss)) + "’";
872+
string.Join("-", reading.Morphs.Select(morph => morph.Gloss.Length == 0 ? MissingValue.Marker : morph.Gloss)) + "’";
873873

874874
private static string JoinForms(IEnumerable<string> forms)
875875
{

‎src/SIL.Motif.App/ViewModels/TextWordsViewModel.Selection.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ private void ApplySummaryFilter()
5858
if (!string.IsNullOrWhiteSpace(SearchText))
5959
matches = matches.Where(word => word.Key.Form.Contains(SearchText.Trim(), StringComparison.CurrentCultureIgnoreCase));
6060
var ordered = matches.OrderByDescending(word => word.OccurrenceCount).ToArray();
61+
_hiddenByFilter = (_selectionReads.Summary?.Words.Count ?? 0) - ordered.Length;
62+
OnPropertyChanged(nameof(FilterHidesText));
6163
var generation = _rowsGeneration;
6264
Rows = new LazyProjectionList<SelectionWordSummary, TextWordRowViewModel>(ordered,
6365
GetSummaryRow, row => row.Summary!, () => generation == _rowsGeneration && _acceptLoads);

‎src/SIL.Motif.App/ViewModels/TextWordsViewModel.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ public Action<IReadOnlyList<string>>? HandOff
252252
: "No words to test yet"
253253
: $"{WordCount:N0} word{(WordCount == 1 ? string.Empty : "s")} · {OccurrenceCount:N0} place{(OccurrenceCount == 1 ? string.Empty : "s")}";
254254

255+
/// <summary>Status-bar text naming how many words the active filter hides; empty when none are hidden.</summary>
256+
public string FilterHidesText => _hiddenByFilter == 0 ? string.Empty
257+
: PluralText.Format(MotifAppStrings.StatusFilterHidesPattern, _hiddenByFilter);
258+
259+
private int _hiddenByFilter;
260+
255261
public int AllCount => _selectionReads.Summary?.WordRowCount ?? 0;
256262
public int ApprovedFilterCount => CountStanding(ProjectStanding.Approved);
257263
public int CandidateFilterCount => CountStanding(ProjectStanding.Candidate);
@@ -362,6 +368,7 @@ private void RaiseCounts()
362368
{
363369
OnPropertyChanged(nameof(WordCount));
364370
OnPropertyChanged(nameof(SummaryText));
371+
OnPropertyChanged(nameof(FilterHidesText));
365372
OnPropertyChanged(nameof(AllCount));
366373
OnPropertyChanged(nameof(ApprovedFilterCount));
367374
OnPropertyChanged(nameof(CandidateFilterCount));
@@ -861,7 +868,7 @@ public ProjectAnalysisViewModel(ProjectAnalysis analysis)
861868
{
862869
ArgumentNullException.ThrowIfNull(analysis);
863870
Morphs = analysis.Morphs.Select(morph => new ParserReadingMorphViewModel(morph)).ToArray();
864-
Gloss = string.Join(" ", Morphs.Select(morph => morph.Gloss.Length == 0 ? "?" : morph.Gloss));
871+
Gloss = string.Join(" ", Morphs.Select(morph => morph.Gloss.Length == 0 ? MissingValue.Marker : morph.Gloss));
865872
}
866873

867874
public IReadOnlyList<ParserReadingMorphViewModel> Morphs { get; }

0 commit comments

Comments
 (0)