diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 76d005427..523a54de4 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -10715,19 +10715,21 @@ namespace Nikse.SubtitleEdit.Forms if (e.Modifiers == (Keys.Control | Keys.Shift) && e.KeyCode == Keys.ShiftKey) return; - // do not check for shortcuts if text is being entered... + var fc = FindFocusedControl(this); - if (fc != null && (fc is TextBox || fc is ComboBox)) + if (fc != null && e.Modifiers != Keys.Control && e.Modifiers != (Keys.Control | Keys.Shift) && e.Modifiers != (Keys.Control | Keys.Shift | Keys.Alt)) { - if (e.Modifiers != Keys.Control && e.Modifiers != (Keys.Control | Keys.Shift) && e.Modifiers != (Keys.Control | Keys.Shift | Keys.Alt)) - { - if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z) - return; - if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9) - return; - } + // do not check for shortcuts if text is being entered and a textbox is focused + if ((fc.Name == textBoxListViewText.Name || fc.Name == textBoxListViewTextAlternate.Name || fc.Name == textBoxSearchWord.Name) && e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z) + return; + + // do not check for shortcuts if a number is being entered and a time box is focused + if (fc.Parent != null && (fc.Parent.Name == timeUpDownStartTime.Name || fc.Parent.Name == numericUpDownDuration.Name) && + (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9 || e.KeyValue >= 48 && e.KeyValue <= 57)) + return; } + bool inListView = tabControlSubtitle.SelectedIndex == TabControlListView; if (e.KeyCode == Keys.Escape && !_cancelWordSpellCheck)