From 16b2a05ac1272f455fdbe4f2c41fabccc3a94a88 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Tue, 19 May 2026 17:40:18 -0400 Subject: [PATCH 1/3] 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")] From d7464a35b849f47420b22ae4c696987e014df416 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 20 May 2026 09:30:54 -0400 Subject: [PATCH 2/3] Create new property to return null for empty NumberingStyle Instead of changing behavior of NumberingStyle get method, create NonEmptyNumberingStyle property whose get returns null if empty. Change-Id: Ica58deff94eedcda8549fb9ae971151ea16b79e8 --- .../DictionaryConfigurationController.cs | 6 ++-- Src/xWorks/DictionaryNodeOptions.cs | 33 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Src/xWorks/DictionaryConfigurationController.cs b/Src/xWorks/DictionaryConfigurationController.cs index 6639bc1373..c173fea2cd 100644 --- a/Src/xWorks/DictionaryConfigurationController.cs +++ b/Src/xWorks/DictionaryConfigurationController.cs @@ -520,18 +520,18 @@ public static void SetConfigureHomographParameters(DictionaryConfigurationModel var senseNode = mainEntryNode.Children.Where(prop => prop.Label == senseType).FirstOrDefault(); if (senseNode == null) return; var senseOptions = (DictionaryNodeSenseOptions)senseNode.DictionaryNodeOptions; - cacheHc.ksSenseNumberStyle = senseOptions.NumberingStyle; + cacheHc.ksSenseNumberStyle = senseOptions.NonEmptyNumberingStyle; //SubSense Node var subSenseNode = senseNode.Children.Where(prop => prop.Label == "Subsenses").FirstOrDefault(); if (subSenseNode == null) return; var subSenseOptions = (DictionaryNodeSenseOptions)subSenseNode.DictionaryNodeOptions; - cacheHc.ksSubSenseNumberStyle = subSenseOptions.NumberingStyle; + cacheHc.ksSubSenseNumberStyle = subSenseOptions.NonEmptyNumberingStyle; cacheHc.ksParentSenseNumberStyle = subSenseOptions.ParentSenseNumberingStyle; //SubSubSense Node var subSubSenseNode = subSenseNode.ReferencedOrDirectChildren.Where(prop => prop.Label == "Subsenses").FirstOrDefault(); if (subSubSenseNode == null) return; var subSubSenseOptions = (DictionaryNodeSenseOptions)subSubSenseNode.DictionaryNodeOptions; - cacheHc.ksSubSubSenseNumberStyle = subSubSenseOptions.NumberingStyle; + cacheHc.ksSubSubSenseNumberStyle = subSubSenseOptions.NonEmptyNumberingStyle; cacheHc.ksParentSubSenseNumberStyle = subSubSenseOptions.ParentSenseNumberingStyle; } diff --git a/Src/xWorks/DictionaryNodeOptions.cs b/Src/xWorks/DictionaryNodeOptions.cs index 58a6322030..d47983c2a1 100644 --- a/Src/xWorks/DictionaryNodeOptions.cs +++ b/Src/xWorks/DictionaryNodeOptions.cs @@ -56,21 +56,28 @@ public class DictionaryNodeSenseOptions : DictionaryNodeOptions // Example values: ""->none; %O->1.2.3; %d->1, 2, 3 [XmlAttribute(AttributeName = "numberingStyle")] - private string _numberingStyle; + private string m_NumberingStyle; - public string NumberingStyle + /// + /// Numbering style for senses. If null or empty, no style is used. + /// + /// NumberingStyle is null if no numbering style has ever been selected. + /// NumberingStyle is an empty string if a numbering style is selected but then removed. + /// + public string NumberingStyle { get; set; } + + /// + /// Returns the numbering style, or null if no numbering style should be used. + /// + /// may contain either null or an empty string to indicate + /// that numbering is disabled. An empty string used for reversals' NumberingStyle also + /// forces sense numbers to be disabled. This property normalizes both values to null + /// to retain the expected behavior for senses. + /// + public string NonEmptyNumberingStyle { - 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; } + get => string.IsNullOrEmpty(m_NumberingStyle) ? null : m_NumberingStyle; + set => m_NumberingStyle = value; } // Example values: ""->none; %j->Joined; %.->Separated by dot From 1c25b82048414ce7f50a8df5a3b261af88eb0e05 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Wed, 20 May 2026 10:04:20 -0400 Subject: [PATCH 3/3] Fix NumberingStyle get/set Change-Id: I5eac83e66fc4b9f8d684ed7e0fb1693a1e770bc0 --- Src/xWorks/DictionaryNodeOptions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Src/xWorks/DictionaryNodeOptions.cs b/Src/xWorks/DictionaryNodeOptions.cs index d47983c2a1..d53cfc0057 100644 --- a/Src/xWorks/DictionaryNodeOptions.cs +++ b/Src/xWorks/DictionaryNodeOptions.cs @@ -64,7 +64,11 @@ public class DictionaryNodeSenseOptions : DictionaryNodeOptions /// NumberingStyle is null if no numbering style has ever been selected. /// NumberingStyle is an empty string if a numbering style is selected but then removed. /// - public string NumberingStyle { get; set; } + public string NumberingStyle + { + get => m_NumberingStyle; + set => m_NumberingStyle = value; + } /// /// Returns the numbering style, or null if no numbering style should be used.