-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preps for and partially Fixes #2491 - Refactors Toplevel
and Application
Navigation
#3634
Preps for and partially Fixes #2491 - Refactors Toplevel
and Application
Navigation
#3634
Conversation
Made Application #nullable enable
Still need to move navigation code out of Toplevel
…avigation static class).
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that a Shortcut
which now the StatusBar
is using, must only have only a Key
for each subview.
Yep. This is why I stopped and forked so I can take the time to make it right in the other PR. This does not effect use cases without nested TabGroups. |
Not sure what you mean. Regardless can you please open a separate issue? |
I wrote a unit tests with a status bar above that reproduces this. |
Great catch! Thank you! Here's a better, more focused unit test based on the one you provided. [Fact]
public void Changing_Key_Removes_Previous ()
{
var newActionCount = 0;
Shortcut shortcut = new Shortcut (Key.N.WithCtrl, "New", () => newActionCount++);
Application.Current = new Toplevel ();
Application.Current.Add (shortcut);
Assert.Equal (0, newActionCount);
Assert.True (Application.OnKeyDown (Key.N.WithCtrl));
Assert.False (Application.OnKeyDown (Key.W.WithCtrl));
Assert.Equal (1, newActionCount);
shortcut.Key = Key.W.WithCtrl;
Assert.False (Application.OnKeyDown (Key.N.WithCtrl));
Assert.True (Application.OnKeyDown (Key.W.WithCtrl));
Assert.Equal (2, newActionCount);
Application.Current.Dispose ();
} |
…:tig/Terminal.Gui into v2_2491-Refactor-TopLevel-Application-And-Focus
…:tig/Terminal.Gui into v2_2491-Refactor-TopLevel-Application-And-Focus
An even better version of the test: [Fact]
public void Key_Changing_Removes_Previous ()
{
Shortcut shortcut = new Shortcut ();
shortcut.Key = Key.A;
Assert.Contains (Key.A, shortcut.KeyBindings.Bindings.Keys);
shortcut.Key = Key.B;
Assert.DoesNotContain (Key.A, shortcut.KeyBindings.Bindings.Keys);
Assert.Contains (Key.B, shortcut.KeyBindings.Bindings.Keys);
} |
@tig after the creation of the IsTopLevel = _frmMenuDetails.CkbIsTopLevel?.State == CheckState.UnChecked,
HasSubMenu = _frmMenuDetails.CkbSubMenu?.State == CheckState.UnChecked, As you can see if any of the properties are |
I obviously made some mistakes. Not sure why you are commenting here instead of opening a new Issue though. |
Because their fix make more sense to be done in this branch as it has already fixes for shortcuts. But I'm still investigating why shortcuts menus aren't working on Window. |
Code cleanup
This is another PR paving the way for fixing
Toplevel
- IntroduceRunnable
andOverlapped
instead #2491It is a fork of the branch in
Focus
works #3627at the point where I had done a ton of refactoring, organization, code-clean up, and introduction of primitives required for #2491.
In order to prepare for addressing #2491 I moved a lot of code around here. In addition, I enabled nullability in big places, and re-organized
View
as well asApplication
to make more understandable and maintainable. As a result, this PR is BIG.I want to get this merged because finishing #3627 is going to take a ton of work and I've been coding too much and need to take a break. At the same time, I don't want all the work I did to sit latent, especially since it moves a bunch of code around and will cause merge hell if not integrated quickly.
At the point where this PR's branch starts all unit tests pass and the new code paths are only active in these situations:
View.TabStop
is set to something other thanTabBehavior.TabStop
View.Arrangment
is set toViewArrangement.Overlapped
Fixes
Application
andToplevel
code without removing existingToplevel
orOverlapped
functionality.Application
,ConsoleDriver
, andToplevel
#nullable enable
ViewArrangement.Overlapped
and modifies navigation code to support overlapped views that have this flag set.TabBehavior
enum and changesView.TabStop
to be of this type.View.Navigation
without breaking existing functionality.Tab
andTab.WithShift
F6
andF6.WithShift
(matches Windows, should work on all platforms)Toplevel
- IntroduceRunnable
andOverlapped
instead #2491Proposed Changes/Todos
ConsoleDriver
use #nullable enableToplevel
and intoApplication
(viaApplicationNavigation
static class)OverlappedTop
navigation out ofToplevel
and intoApplicationOverlapped
static classViewExperiments
be a good scenario for exercising all of the above and other stuff for Get rid ofToplevel
- IntroduceRunnable
andOverlapped
instead #2491.For #3627 and beyond...
ViewArrangement.Overlapped
will work. UseTabIndexes
and all theView.NextView
focus stuff for navigation (instead of the code inOverlappedMoveNext
). Use theSubview
ordering (for just the subviews with ViewArrangement.Overlapped` set) to manage the z-order.IRunnable
and replaceToplevel
with thatPull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)