From f4fc0ef3c5e88c5caeeb48bb0ee5428101452902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E5=82=91?= Date: Thu, 12 Jan 2023 14:22:40 +0800 Subject: [PATCH] Fix the command is cleared after repeated --- Source/GrasscutterTools/Forms/FormMain.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Source/GrasscutterTools/Forms/FormMain.cs b/Source/GrasscutterTools/Forms/FormMain.cs index 3201c2c..8a5b11e 100644 --- a/Source/GrasscutterTools/Forms/FormMain.cs +++ b/Source/GrasscutterTools/Forms/FormMain.cs @@ -208,12 +208,11 @@ namespace GrasscutterTools.Forms { Logger.I(TAG, $"SetCommand(\"{command}\")"); var oldCommand = CmbCommand.Text; - CmbCommand.Text = (ModifierKeys == Keys.Shift) ? - (string.IsNullOrEmpty(oldCommand) ? command : $"{oldCommand} | {command}") - : command; + if (ModifierKeys == Keys.Shift && !string.IsNullOrEmpty(oldCommand)) + command = $"{oldCommand} | {command}"; + AddCommandToList(command); if (ChkAutoCopy.Checked) CopyCommand(); - AddCommandToList(command); if (ModifierKeys == Keys.Control) { @@ -233,12 +232,12 @@ namespace GrasscutterTools.Forms { if (string.IsNullOrEmpty(command)) command = CmbCommand.Text; - if (!string.IsNullOrEmpty(command)) - { - if (CmbCommand.Items.Count > 19) - CmbCommand.Items.RemoveAt(0); - CmbCommand.Items.Add(command); - } + if (string.IsNullOrEmpty(command)) + return; + if (CmbCommand.Items.Count > 19) + CmbCommand.Items.RemoveAt(0); + CmbCommand.Items.Add(command); + CmbCommand.SelectedIndex = CmbCommand.Items.Count - 1; } ///