From 5dee29cb68a90cc2780f64e445deaeba38846512 Mon Sep 17 00:00:00 2001 From: Adrian Alonso Date: Sun, 3 Nov 2019 15:15:22 -0300 Subject: [PATCH] Fixed key events traversal for modal dialogs (#288) The key must be propagated initially to the first chain element before evaluating if we should stop because of the handled or the Modal condition. Otherwise the modal dialog won't get any process key notification. This fixes https://github.com/migueldeicaza/gui.cs/commit/c072e29a684068af50e1b9e284213b3839dad804 --- Terminal.Gui/Core.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Terminal.Gui/Core.cs b/Terminal.Gui/Core.cs index 31f7c0c84..ebbbbc3a3 100644 --- a/Terminal.Gui/Core.cs +++ b/Terminal.Gui/Core.cs @@ -1812,25 +1812,25 @@ namespace Terminal.Gui { { var chain = toplevels.ToList(); foreach (var topLevel in chain) { - if (topLevel.Modal) - break; if (topLevel.ProcessHotKey (ke)) return; + if (topLevel.Modal) + break; } foreach (var topLevel in chain) { - if (topLevel.Modal) - break; if (topLevel.ProcessKey (ke)) return; + if (topLevel.Modal) + break; } foreach (var topLevel in chain) { - if (topLevel.Modal) - break; // Process the key normally if (topLevel.ProcessColdKey (ke)) return; + if (topLevel.Modal) + break; } }