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 c072e29a68
This commit is contained in:
Adrian Alonso
2019-11-03 15:15:22 -03:00
committed by BDisp
parent 8f0d703651
commit 5dee29cb68

View File

@@ -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;
}
}