From fe01516d0099ceca26f850bb6f96f3ebcceecdd9 Mon Sep 17 00:00:00 2001 From: John T Maxwell III Date: Thu, 26 Sep 2024 14:05:20 -0700 Subject: [PATCH] Fix LT-21888: boundary marker name can be deleted when editing rules (#165) --- Src/LexText/LexTextControls/PatternView.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Src/LexText/LexTextControls/PatternView.cs b/Src/LexText/LexTextControls/PatternView.cs index 4416d89b91..27bbb76eca 100644 --- a/Src/LexText/LexTextControls/PatternView.cs +++ b/Src/LexText/LexTextControls/PatternView.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -134,11 +134,16 @@ protected override void OnKeyDown(KeyEventArgs e) /// protected override void OnKeyPress(KeyPressEventArgs e) { - if (e.KeyChar == (char) Keys.Back) + e.Handled = true; + if (e.KeyChar == (char)Keys.Back || e.KeyChar == (char)Keys.Delete) { if (RemoveItemsRequested != null) RemoveItemsRequested(this, new RemoveItemsRequestedEventArgs(false)); - e.Handled = true; + } + else + { + // Ignore all other characters (fixes LT-21888). + return; } base.OnKeyPress(e); }