From db0f03da6ab92f3df2c8ca02b700ed1ffde66b38 Mon Sep 17 00:00:00 2001 From: Zachary Burnham Date: Fri, 17 Jul 2026 16:51:34 -0400 Subject: [PATCH 1/2] Fix LT-22578: Create new inflectional affix - window Z order issues https://jira.sil.org/browse/LT-22578. ShowDialog calls needed to properly pass an `owner` parameter for the windows to behave as expected. --- Src/Common/Controls/DetailControls/ChooserCommand.cs | 4 +--- Src/LexText/Morphology/InflAffixTemplateControl.cs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Src/Common/Controls/DetailControls/ChooserCommand.cs b/Src/Common/Controls/DetailControls/ChooserCommand.cs index 388b37b707..16f0a3bf57 100644 --- a/Src/Common/Controls/DetailControls/ChooserCommand.cs +++ b/Src/Common/Controls/DetailControls/ChooserCommand.cs @@ -5,14 +5,12 @@ using System; using System.Windows.Forms; using System.Linq; -using SIL.LCModel.Core.Text; using SIL.FieldWorks.Common.Framework.DetailControls.Resources; using SIL.LCModel; using SIL.LCModel.DomainServices; using SIL.LCModel.Infrastructure; using SIL.FieldWorks.LexText.Controls; using SIL.FieldWorks.Common.Controls; -using SIL.FieldWorks.Common.FwUtils; using XCore; namespace SIL.FieldWorks.Common.Framework.DetailControls @@ -47,7 +45,7 @@ public override ObjectLabel Execute() dlg.SetDlgInfo(m_cache, morphType, MsaType.kInfl, m_slot, m_mediator, m_propertyTable, m_fPrefix ? InsertEntryDlg.MorphTypeFilterType.Prefix : InsertEntryDlg.MorphTypeFilterType.Suffix); dlg.DisableAffixTypeMainPosAndSlot(); - if (dlg.ShowDialog() == DialogResult.OK) + if (dlg.ShowDialog(m_propertyTable.GetValue
("window")) == DialogResult.OK) { bool fCreated; ILexEntry entry; diff --git a/Src/LexText/Morphology/InflAffixTemplateControl.cs b/Src/LexText/Morphology/InflAffixTemplateControl.cs index 2d3a90bb0b..d6bdce81a8 100644 --- a/Src/LexText/Morphology/InflAffixTemplateControl.cs +++ b/Src/LexText/Morphology/InflAffixTemplateControl.cs @@ -412,7 +412,7 @@ public bool OnInflTemplateAddInflAffixMsa(object cmd) using (var chooser = MakeChooserWithExtantMsas(m_slot, cmd as XCore.Command)) { - chooser.ShowDialog(); + chooser.ShowDialog(this); if (chooser.DialogResult == DialogResult.OK) { if (chooser.ChosenObjects != null && chooser.ChosenObjects.Count() > 0) From 017c87fce4d7b0821dd4b0f7be7a29d1093073ea Mon Sep 17 00:00:00 2001 From: Zachary Burnham Date: Tue, 21 Jul 2026 15:49:32 -0400 Subject: [PATCH 2/2] Fix LT-22609: Crash creating New Project with trailing space [LT0-22609](https://jira.sil.org/browse/LT-22609). Trimming project name before file creation to fix the issue. Added FwNewLangProjectModel_ProjectName_TrimsSurroundingWhitespace tests to ensure project name leading or trailing spaces are trimmed. --- .../FwNewLangProjectModelTests.cs | 21 +++++++++++++++++++ Src/FwCoreDlgs/FwNewLangProjectModel.cs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Src/FwCoreDlgs/FwCoreDlgsTests/FwNewLangProjectModelTests.cs b/Src/FwCoreDlgs/FwCoreDlgsTests/FwNewLangProjectModelTests.cs index 190eacf271..961be65d8e 100644 --- a/Src/FwCoreDlgs/FwCoreDlgsTests/FwNewLangProjectModelTests.cs +++ b/Src/FwCoreDlgs/FwCoreDlgsTests/FwNewLangProjectModelTests.cs @@ -106,6 +106,8 @@ public void FwNewLangProjectModel_VerifyCreateNewLangProject() [TestCase("*", false)] [TestCase("franç", false)] // upper ASCII is forbidden [TestCase("\u0344", false)] // non-ASCII is forbidden + [TestCase("MyProject ", true)] // trailing space is trimmed, still valid (LT-22578) + [TestCase(" ", false)] // whitespace-only trims to empty -> invalid (LT-22578) public void FwNewLangProjectModel_ProjectNameIsValid(string projName, bool expectedResult) { var testModel = new FwNewLangProjectModel @@ -116,6 +118,25 @@ public void FwNewLangProjectModel_ProjectNameIsValid(string projName, bool expec Assert.That(testModel.IsProjectNameValid, Is.EqualTo(expectedResult)); } + /// + /// The name is trimmed of surrounding whitespace when stored, so the validated name matches + /// the name used to create the project directory. Windows strips trailing spaces/dots from + /// folder names, so an untrimmed name crashes on creation (LT-22578). + /// + [TestCase("MyProject ", "MyProject", TestName = "TrailingSpace")] + [TestCase(" MyProject", "MyProject", TestName = "LeadingSpace")] + [TestCase(" MyProject ", "MyProject", TestName = "SurroundingSpace")] + [TestCase("My Project", "My Project", TestName = "InteriorSpacePreserved")] + public void FwNewLangProjectModel_ProjectName_TrimsSurroundingWhitespace(string input, string expected) + { + var testModel = new FwNewLangProjectModel + { + LoadProjectNameSetup = () => { }, + ProjectName = input + }; + Assert.That(testModel.ProjectName, Is.EqualTo(expected)); + } + /// [Test] public void FwNewLangProjectModel_ProjectNameIsUnique() diff --git a/Src/FwCoreDlgs/FwNewLangProjectModel.cs b/Src/FwCoreDlgs/FwNewLangProjectModel.cs index c7a06241b6..624f3e53c5 100644 --- a/Src/FwCoreDlgs/FwNewLangProjectModel.cs +++ b/Src/FwCoreDlgs/FwNewLangProjectModel.cs @@ -208,7 +208,7 @@ public string ProjectName get { return _projectName; } set { - _projectName = value; + _projectName = value?.Trim(); _steps[(int)CurrentStep].IsComplete = IsProjectNameValid; LoadProjectNameSetup(); }