OutConsoleGridView no longer works - ENTER does not work
See original GitHub issueRecent changes to keyboard handling has broken ocgv
.
It implements StatusBar
like this:
private void AddStatusBar()
{
var statusBar = new StatusBar(
_applicationData.OutputMode != OutputModeOption.None
? new StatusItem[]
{
// Use Key.Unknown for SPACE with no delegate because ListView already
// handles SPACE
new StatusItem(Key.Unknown, "~SPACE~ Mark Item", null),
new StatusItem(Key.Enter, "~ENTER~ Accept", () =>
{
if (Application.Top.MostFocused == _listView)
{
// If nothing was explicitly marked, we return the item that was selected
// when ENTER is pressed in Single mode. If something was previously selected
// (using SPACE) then honor that as the single item to return
if (_applicationData.OutputMode == OutputModeOption.Single &&
_itemSource.GridViewRowList.Find(i => i.IsMarked) == null)
{
_listView.MarkUnmarkRow();
}
Accept();
}
else if (Application.Top.MostFocused == _filterField)
{
_listView.SetFocus();
}
}),
new StatusItem(Key.Esc, "~ESC~ Close", () => Close())
}
: new StatusItem[]
{
new StatusItem(Key.Esc, "~ESC~ Close", () => Close())
}
);
Application.Top.Add(statusBar);
}
With recent changes to Terminal.Gui
something in how ProcessKey
works broke this. The ENTER
handler never gets called.
In my opinion, if an app uses StatusBar
and defines a hotkey for the StatusBar
, that should override all other controls; they should never get that key. This is how it used to work.
I did a test by modifying the ComputedLayout
scenario:
var statusBar = new StatusBar (new StatusItem [] {
new StatusItem(Key.CtrlMask | Key.Q, "~^Q~ Quit", () => Quit()),
new StatusItem(Key.Enter, "~ENTER~ Message", () => MessageBox.Query ("Message", $"Hi")),
});
By doing this, I would expect StatusBar
to always win and ENTER
would go to StatusBar
first. But, that’s not what happens.
This is a breaking behavior change that I believe is a ship-stopper for V1.0.
@BDisp - please help me figure out what changed and a fix. Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
ENTER does not work · Issue #1256 · gui-cs/Terminal.Gui
Recent changes to keyboard handling has broken ocgv. ... OutConsoleGridView no longer works - ENTER does not work #1256.
Read more >A new kind of GridView right in your console
ConsoleGuiTools show up in the same console you're prompt is in, support for environments that don't supply a GUI but have a terminal...
Read more >Terminal.Gui 1.6.3
Terminal drivers for Curses, Windows Console, and the .NET Console mean apps will work well on both color and monochrome terminals. Keyboard and ......
Read more >How to Fix Enter Key Not Working [4 Quick Solutions]
Enter key stops working for no reason? It can be caused by an outdated driver or keyboard settings. Try these fixes to make...
Read more >The main enter key stopped working but the numpad one ...
I've tried connecting the keyboard without the dongle. I'm running out of ideas anyone knows how to fix this? keyboard · kubuntu ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed.
My fix above is a fix (and should probably be incorporated regardless because it is more correct).
I’m curious to see what your proposed fix is!