From 16b2a05ac1272f455fdbe4f2c41fabccc3a94a88 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 19 May 2026 17:40:18 -0400 Subject: [PATCH] LT-22373c: Fix NumberingStyle get in DictionaryNodeOptions Previously updated the NumberingStyle get method in SenseOptionsView, so that it returns null when no numbering style is selected. This avoids an issue where sense numbering style gets treated as empty when reversal number style is an empty string. But this only applies to the dictionary configuration dialog preview. Updating the NumberingStyle get method in DictionaryNodeOptions to fix the issue for the dictionary and reversal displays. Change-Id: Id8442bba1e72049272e67d5fc5424f8ef42fe3c7 --- .../DictionaryDetailsView/SenseOptionsView.cs | 8 ++++++-- Src/xWorks/DictionaryNodeOptions.cs | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Src/xWorks/DictionaryDetailsView/SenseOptionsView.cs b/Src/xWorks/DictionaryDetailsView/SenseOptionsView.cs index 3a9300c717..0b5803838a 100644 --- a/Src/xWorks/DictionaryDetailsView/SenseOptionsView.cs +++ b/Src/xWorks/DictionaryDetailsView/SenseOptionsView.cs @@ -66,8 +66,12 @@ public string NumberingStyle { get { - // Return null if string is empty, because returning an empty string for reversal numbers - // also forces sense numbers not to be displayed. Null doesn't cause the same problem. + // Handles NumberingStyle for the dictionary/reversal configuration dialog preview display. + // Both empty string and null mean there is no numbering style to use. + // Numbering style will be null if no numbering style has ever been selected. + // Numbering style will be an empty string if a numbering style was selected at some point and then turned back off. + // Returning an empty string for reversal numbering style forces sense numbers to be turned off too, but null doesn't cause this problem. + // Return null if numbering style is empty. var formatString = ((NumberingStyleComboItem)dropDownNumberingStyle.SelectedItem).FormatString; return string.IsNullOrEmpty(formatString) ? null : formatString; } diff --git a/Src/xWorks/DictionaryNodeOptions.cs b/Src/xWorks/DictionaryNodeOptions.cs index 209d8768a6..58a6322030 100644 --- a/Src/xWorks/DictionaryNodeOptions.cs +++ b/Src/xWorks/DictionaryNodeOptions.cs @@ -56,7 +56,22 @@ public class DictionaryNodeSenseOptions : DictionaryNodeOptions // Example values: ""->none; %O->1.2.3; %d->1, 2, 3 [XmlAttribute(AttributeName = "numberingStyle")] - public string NumberingStyle { get; set; } + private string _numberingStyle; + + public string NumberingStyle + { + get + { + // Handles NumberingStyle for the dictionary and reversal displays. + // Both empty string and null mean there is no numbering style to use. + // Numbering style will be null if no numbering style has ever been selected. + // Numbering style will be an empty string if a numbering style was selected at some point and then turned back off. + // Returning an empty string for reversal numbering style forces sense numbers to be turned off too, but null doesn't cause this problem. + // Return null if numbering style is empty. + return string.IsNullOrEmpty(_numberingStyle)? null : _numberingStyle; + } + set { _numberingStyle = value; } + } // Example values: ""->none; %j->Joined; %.->Separated by dot [XmlAttribute(AttributeName = "parentSenseNumberingStyle")]