Skip to content
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

Partially Fixes #2432 - Dim.Auto automatically sizes views based on Text - Replaces View.AutoSize #3416

Merged
merged 217 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
f46acdf
Updated overview docs
tig Dec 17, 2023
a459582
Updated toc
tig Dec 17, 2023
e692a31
Updated docs more
tig Dec 18, 2023
d1cd580
Updated yml via dependabot
tig Dec 18, 2023
1f42e4c
Initial work in progress
tig Dec 18, 2023
a29b7b9
Fixed some autosize things
tig Dec 18, 2023
2e069fb
Merge branch 'v2_develop' into v2_fixes_2432_Dim_AutoSize
tig Dec 18, 2023
57670c4
Revamped Pos / Dim API docs
tig Dec 18, 2023
65895f2
Removed margin
tig Dec 18, 2023
2eb4ad1
horiz->width
tig Dec 18, 2023
bbb84f8
Updated MessageBoxes and Dialogs Scenarios to use AutoSize
tig Dec 18, 2023
b89c262
AutoSize->Auxo
tig Dec 18, 2023
42f93cd
Adds validation
tig Dec 18, 2023
8274451
prep for Dialog to use Dim.Auto - Simplify unit tests to not depend o…
tig Dec 18, 2023
9ba5edb
prep for Dialog to use Dim.Auto - Simplify unit tests
tig Dec 18, 2023
83c5931
prep for Dialog to use Dim.Auto - Simplify unit tests
tig Dec 18, 2023
af17636
prep for Dialog to use Dim.Auto - Make Dialog tests not depend on Mes…
tig Dec 18, 2023
84bbd5f
Started on DimAuto unit tests
tig Dec 18, 2023
fa597cc
started impl on min/max.
tig Dec 18, 2023
e249a84
started impl on min/max.
tig Dec 18, 2023
46d8465
Added DimAutoStyle
tig Dec 19, 2023
d3f470f
Added arg checking for not implemented features
tig Dec 19, 2023
770dae3
Temporarily made DimAutoStyle.Subviews default
tig Dec 19, 2023
64d3568
Removed unneeded override of Anchor
tig Dec 19, 2023
2f4381c
Fixed GethashCode warning
tig Dec 19, 2023
a367e4d
Implemented DimAuto(min)
tig Dec 19, 2023
9b743b2
Fixed unit tests
tig Dec 19, 2023
b22c1e3
renamed scenario
tig Dec 19, 2023
679ec90
WIP
tig Dec 19, 2023
f35e783
Merged v2_develop
tig Dec 19, 2023
eba7325
Moved ViewLayout.cs into Layout folder
tig Dec 20, 2023
eabcd36
Clean up cocde formatting
tig Dec 20, 2023
b35c7e9
Renamed and moved SetFrameToFitText
tig Dec 20, 2023
3b96182
Fixed API docs for SetRelativeLayout
tig Dec 20, 2023
ef00373
Factored out SetRelativeLayout tests
tig Dec 20, 2023
eb037b5
Better documented existing SetRelativeLayout behavior + unit tess
tig Dec 21, 2023
bb04a62
Debugging Pos.Center + x in SetRelativeLayout - WIP
tig Dec 22, 2023
f48ff99
Progress on low level unit tess
tig Dec 23, 2023
cbf7bae
Merge branch 'v2_develop' into v2_fixes_2432_Dim_AutoSize
tig Dec 26, 2023
e80bd4f
Merge v2_develop
tig Dec 26, 2023
4330c12
merged v2_develop
tig Jan 5, 2024
97a75af
Code cleanup.
tig Jan 5, 2024
c2bda7a
Updated nuget refs
tig Jan 5, 2024
b539e7c
Tweaks
tig Jan 5, 2024
42eb0c3
Removes CheckAbsoulte and updates unit tests to match
tig Jan 5, 2024
2527237
Fixed code that was dependent on ToString behavior vs. direct test fo…
tig Jan 5, 2024
a7449df
Dim/Pos != null WIP
tig Jan 6, 2024
bdb5fb2
Moved AutoSize specific tests out of Pos/Dim tests
tig Jan 6, 2024
1c9cfc4
Broke out AutoSize = false tests to new file
tig Jan 6, 2024
bf07453
Commented test TODOs
tig Jan 7, 2024
d6f634b
New test
tig Jan 7, 2024
748cdfd
Removed unused API and cleaned up code
tig Jan 7, 2024
b439ebb
Removed unused API and cleaned up code
tig Jan 7, 2024
77186b2
Cleaned up code
tig Jan 7, 2024
a2d3d27
Cleaned up code
tig Jan 7, 2024
e0e9413
reorg'd Toplevel tests
tig Jan 7, 2024
5ab8d4d
Fixed Create and related unit tests
tig Jan 7, 2024
98024dc
Added test from #3136
tig Jan 7, 2024
fe4b60a
Removed TopLevel.Create
tig Jan 7, 2024
442f8e5
Fixed SetCurrentOverlappedAsTop
tig Jan 7, 2024
d807190
Updated pull request template
tig Jan 7, 2024
7558b54
Merge branch 'v2_toplevel_fill' into v2_fixes_2432_Dim_AutoSize
tig Jan 7, 2024
19f9501
merged
tig Jan 7, 2024
e1a826e
Updated pull request template
tig Jan 7, 2024
c426f04
Revert "Updated pull request template"
tig Jan 7, 2024
2086d49
reverting
tig Jan 7, 2024
d5fe8b4
re-reverting
tig Jan 7, 2024
0e49b2a
Fixed every thing but autosize scenarios??
tig Jan 8, 2024
0c80fbc
Fixed hexview
tig Jan 8, 2024
aae9372
Fixed contextmenu
tig Jan 8, 2024
454d727
Fixed more minor issues in tests
tig Jan 8, 2024
0be24ff
Fixed more minor issues in tests
tig Jan 8, 2024
a374389
Merge branch 'v2_develop' into v2_toplevel_fill
tig Jan 8, 2024
da0281c
Debugging Dialog test failure
tig Jan 8, 2024
47118c7
Fixed bad Dialog test. Was cleary invalid
tig Jan 8, 2024
7618438
Fixed OnResizeNeeded bug
tig Jan 8, 2024
4caeff8
Fixed OnResizeNeeded bug
tig Jan 8, 2024
0330c1d
Fixed UICatalog to not eat exceptions
tig Jan 8, 2024
169f34d
Fixed TextView
tig Jan 8, 2024
baf66ef
Removed Frame overrides
tig Jan 8, 2024
bb08662
Made Frame non-virtual
tig Jan 8, 2024
ec613ee
Fixed radioGroup
tig Jan 8, 2024
c4dc3fe
Fixed TabView
tig Jan 8, 2024
dcdaf10
Hcked ScrolLBarView unit tests to pass
tig Jan 8, 2024
2d4948a
All AutoSize tests pass!
tig Jan 8, 2024
a9098d5
All tests pass!!!!!!!
tig Jan 8, 2024
5e93af4
Updated API docs. Cleaned up code.
tig Jan 8, 2024
9d23aea
Merge branch 'v2_develop' into v2_fixes_3127_CheckAbsoulte
tig Jan 8, 2024
c819b6e
Fixed ColorPicker
tig Jan 8, 2024
d4ee0b3
Added 'Bounds =' unit tests
tig Jan 8, 2024
304a6c9
Refactored TextFormatter.Size setting logic
tig Jan 8, 2024
a740ef0
Cleaned up OnResizeNeeded (api docs and usages)
tig Jan 8, 2024
a6092ae
Merges in #3019 changes. Makes OnResizeNeeded non-virtual. If we find…
tig Jan 8, 2024
bb66759
Fixed FileDialog bounds warning
tig Jan 8, 2024
660a467
merged
tig Jan 8, 2024
bf7dbca
merged
tig Jan 8, 2024
9a3d1b6
merged - broken
tig Jan 8, 2024
fab7f17
Fixed CheckDimAuto
tig Jan 8, 2024
caa8f78
Fixed CheckDimAuto2
tig Jan 8, 2024
e480baf
Merged v2_develop
tig Jan 16, 2024
1b1b442
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Jan 16, 2024
bfecb36
Merged v2_develop
tig Jan 16, 2024
7ecf844
POC of DimAuotStyle.Text
tig Jan 18, 2024
218a3c0
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Jan 19, 2024
45a1083
Experiments in DimAutoStyle.Text
tig Jan 22, 2024
a2af2fd
Experiments in DimAutoStyle.Text - both
tig Jan 22, 2024
da5ef3d
Experiments in DimAutoStyle.Text - fixed dumb bug
tig Jan 22, 2024
958e777
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Jan 23, 2024
e985b5b
Merge branch 'v2_develop' of github.com:gui-cs/Terminal.Gui into v2_d…
tig Jan 24, 2024
c2ccf3f
Merge branch 'v2_develop' into v2_fixes_2432_Dim_AutoSize
tig Jan 24, 2024
2c040ff
Code cleanup on just touched files
tig Feb 12, 2024
109bf47
Manual checkout from v2_develop
tig Feb 12, 2024
1acadf4
Merged v2_develop
tig Feb 12, 2024
333fcef
Code cleanup
tig Feb 12, 2024
8076b05
API doc format
tig Feb 13, 2024
dc34833
Merge branch 'v2_develop' into v2_fixes_2432_Dim_AutoSize
tig Feb 13, 2024
cf9b8ed
Improved DimPos tests
tig Feb 14, 2024
293df54
Merge branch 'v2_fixes_2432_Dim_AutoSize' of tig:tig/Terminal.Gui int…
tig Feb 14, 2024
1bb90ab
Merged v2_develop
tig Mar 29, 2024
39b8cf5
Added Reset() calls to CM tests
tig Mar 29, 2024
843b758
Added Reset() call to AutoInitShutdown.After
tig Mar 29, 2024
8da54ad
Rebased onto bounds-contentarea and merged -broke
tig Apr 15, 2024
cb9bafa
Fixed stuff broke by merge
tig Apr 15, 2024
ef4c52c
Merged.
tig Apr 17, 2024
3a8d1d5
Tweak
tig Apr 17, 2024
aa8bcde
Added TODOs
tig Apr 17, 2024
6f3799d
Added TODOs
tig Apr 17, 2024
c011ea0
Partial progress in removing AutoSize
tig Apr 18, 2024
a89aa04
More progress in removing AutoSize
tig Apr 18, 2024
a48146a
Tons of unit test updates
tig Apr 18, 2024
f3b5ed7
Fixing tests...
tig Apr 18, 2024
00ac1bb
Renamed API to simplify and make more clear. Fixed Text formatting ve…
tig Apr 18, 2024
20402dd
diagnosing broken vertical text
tig Apr 18, 2024
6c117e0
More unit tests
tig Apr 18, 2024
785215d
Added TextFormatter unit tests that show Right has bug
tig Apr 18, 2024
83bc6aa
Added more TextFormatter tests
tig Apr 18, 2024
69cb271
Fixed TextFormatterTests
tig Apr 18, 2024
7b5df83
Fixed all TextFormatterTests
tig Apr 18, 2024
a4d3bc7
Fixed more tests
tig Apr 19, 2024
0aef9d1
Removed notion of View.Autosize from Pos and Dim classes
tig Apr 19, 2024
382419a
Removed notion of View.Autosize from Pos and Dim classes
tig Apr 19, 2024
91e3e75
Sorta fixed vertical. Broke wide runes
tig Apr 21, 2024
c65596b
Sorta fixed vertical. Broke wide runes
tig Apr 21, 2024
f134d1a
Started to add more primitve unit tests for vertical text
tig Apr 21, 2024
2fdbce4
Fixed all unit tests. Doesn't mean things aren't broken tho.
tig Apr 21, 2024
b6b29fe
Checked out Justifier from v2_1785-PosJustify
tig Apr 22, 2024
6209ace
Reorganized PosDim unit tests.
tig Apr 23, 2024
09565a0
Tons of changes - mostly experiments, but some goodness.
tig Apr 25, 2024
acc924b
Unit test update
tig Apr 27, 2024
71c0d37
Merged and attempted to apply @bdisp's fixes
tig Apr 27, 2024
3e87d5e
TextFormatter Unit tests pass again
tig Apr 27, 2024
214ffb1
TextFormater.AutoSize fixes
tig Apr 27, 2024
cea6e54
Ready for review.
tig Apr 28, 2024
9f8f261
Merge branch 'v2_develop' into v2_2432-DimAuto
tig Apr 28, 2024
b547d6c
Updated API docs
tig Apr 28, 2024
b0a73ca
Merged
tig Apr 28, 2024
5ef4b4c
Added obsolete attr to slider
tig Apr 28, 2024
253fcf1
Replace with GetColumnsRequiredForVerticalText.
BDisp Apr 29, 2024
d3b47ad
Improving scenario.
BDisp Apr 29, 2024
d66a28e
Add more unit tests.
BDisp Apr 29, 2024
6dff7d8
Fix vertical bottom label.
BDisp Apr 29, 2024
a75d5b7
WIP to get rid of Slider.AutoSize
tig Apr 29, 2024
f51ec9c
Addded comments to remind myself of issues
tig Apr 29, 2024
ae67d95
Addded comments to remind myself of issues
tig Apr 29, 2024
b7293e0
Performing text reverse during formatting instead during drawing.
BDisp Apr 29, 2024
25be329
Merge branch 'v2_2432-DimAuto' into tig_v2_2432-DimAuto
BDisp Apr 30, 2024
b64e2d1
Remove AutoSize and improve a bit.
BDisp Apr 30, 2024
9f1f2c7
Remove View AutoSize and add TextFormatter.AutoSize.
BDisp Apr 30, 2024
f18c166
- Made Dim.DimAutoStyle flags.
tig Apr 30, 2024
30a540a
Dim.DimAutoStyle.Subviews -> Content
tig Apr 30, 2024
c36439b
Fixed test name typo
tig Apr 30, 2024
6e95188
Updated Draw_Text_Alignment
tig Apr 30, 2024
1d86d65
Resolving merge conflicts.
BDisp Apr 30, 2024
96af356
Fix unit test.
BDisp Apr 30, 2024
d118964
Add vertical unit tests to the Draw_Text_Alignment method.
BDisp Apr 30, 2024
5031faa
Change TODO to FIXED.
BDisp Apr 30, 2024
2fafc69
- Edited layout.md
tig Apr 30, 2024
beec30a
- Edited dimauto.md
tig Apr 30, 2024
acaa326
Merge branch 'v2_develop' into v2_2432-DimAuto
tig Apr 30, 2024
a6d786d
Changed default text in TF scenario
tig May 1, 2024
4d49ae8
Merge pull request #32 from BDisp/tig_v2_2432-DimAuto
tig May 1, 2024
067e666
Fixes title size not being updating on view size change.
BDisp May 1, 2024
517f703
Merge pull request #33 from BDisp/tig_v2_2432-DimAuto
tig May 1, 2024
695dc16
Fix unit test error.
BDisp May 2, 2024
37bad48
Adding more horizontal and vertical text unit tests variants.
BDisp May 2, 2024
af42151
Removing duplicate InlineData.
BDisp May 2, 2024
75669a4
Rewritten this unit test.
BDisp May 3, 2024
5d4de1b
Merge pull request #34 from BDisp/tig_v2_2432-DimAuto
tig May 3, 2024
c79d2a9
Working on Dim.Absoulte
tig May 3, 2024
ccaf1cf
Merged bdisp test improvemnts
tig May 3, 2024
2e62263
Removed AutoSize from Slider
tig May 3, 2024
89e1db3
Removed AutoSize from MessageBox
tig May 3, 2024
18430df
Removed AutoSize from Scenarios
tig May 3, 2024
44f75c5
Removed AutoSize scenario; DimAuto scenario will replace
tig May 3, 2024
be8f7fa
Progress on removing AutoSize.
tig May 3, 2024
7dedfb8
Fixed AllViewsTester
tig May 3, 2024
d6b25d3
Fixed AllViewsTester
tig May 3, 2024
1b74cdb
Removed un-needed AutoSize tests
tig May 3, 2024
bd57b1d
Removed un-needed AutoSize tests
tig May 3, 2024
65b36a9
Updated almosta all tests to not use AutoSize
tig May 3, 2024
acd3088
Fixed unit tests
tig May 3, 2024
031ffee
No unit test use AutoSize!
tig May 3, 2024
e6b6f77
AutoSize is GONE!
tig May 3, 2024
3e10258
AutoSize in comments i gone too.
tig May 3, 2024
c7bc7f8
Adding all possible text directions variants and improving scenario.
BDisp May 4, 2024
2029513
Cleanup
tig May 5, 2024
8da8a35
Merge pull request #35 from BDisp/tig_v2_2432-DimAuto
tig May 5, 2024
33e870d
Code Cleanup
tig May 6, 2024
db65bf9
Code Cleanup
tig May 6, 2024
3406d97
working on cursor issue
tig May 6, 2024
efe6f1e
Fixed PositionCursor
tig May 6, 2024
2a00435
Fixed PositionCursor IsInitialized
tig May 6, 2024
a124919
PositionCursor unit tests and flashing cursor fixes
tig May 7, 2024
6759ce7
Fixed curses key bug
tig May 7, 2024
a62cdc5
rebased v2_develop
tig May 7, 2024
49cb124
Fixed netdriver key handling bug
tig May 7, 2024
d305445
Merge branch 'v2_develop' into v2_2432-DimAuto
tig May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<DefineConstants>$(DefineConstants);DIMAUTO</DefineConstants>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion ReactiveExample/LoginView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private Label LoginProgressLabel (View previous)

var loginProgressLabel = new Label
{
AutoSize = false, X = Pos.Left (previous), Y = Pos.Top (previous) + 1, Width = 40, Height = 1, Text = idle
X = Pos.Left (previous), Y = Pos.Top (previous) + 1, Width = 40, Height = 1, Text = idle
};

ViewModel
Expand Down
47 changes: 16 additions & 31 deletions Terminal.Gui/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,6 @@ public static RunState Begin (Toplevel toplevel)
return rs;
}

private static CursorVisibility _cachedCursorVisibility;

/// <summary>
/// Calls <see cref="View.PositionCursor"/> on the most focused view in the view starting with <paramref name="view"/>.
/// </summary>
Expand All @@ -571,29 +569,21 @@ public static RunState Begin (Toplevel toplevel)
/// <returns><see langword="true"/> if a view positioned the cursor and the position is visible.</returns>
internal static bool PositionCursor (View view)
{
if (view is null)
{
return false;
}

// Find the most focused view and position the cursor there.
View mostFocused = view.MostFocused;
View mostFocused = view?.MostFocused;

if (mostFocused is null)
{
return false;
}

CursorVisibility cachedCursorVisibility;

// If the view is not visible or enabled, don't position the cursor
if (!mostFocused.Visible || !mostFocused.Enabled)
{
Driver.GetCursorVisibility (out cachedCursorVisibility);

if (cachedCursorVisibility != CursorVisibility.Invisible)
Driver.GetCursorVisibility (out CursorVisibility current);
if (current != CursorVisibility.Invisible)
{
_cachedCursorVisibility = cachedCursorVisibility;
Driver.SetCursorVisibility (CursorVisibility.Invisible);
}

Expand All @@ -611,40 +601,35 @@ internal static bool PositionCursor (View view)
Point? prevCursor = new (Driver.Row, Driver.Col);
Point? cursor = mostFocused.PositionCursor ();

// If the cursor is not in a visible location in the SuperView, hide it
Driver.GetCursorVisibility (out CursorVisibility currentCursorVisibility);

if (cursor is { })
{
// Convert cursor to screen coords
cursor = mostFocused.ViewportToScreen (mostFocused.Viewport with { Location = cursor.Value }).Location;

// If the cursor is not in a visible location in the SuperView, hide it
if (!superViewViewport.Contains (cursor.Value))
{
Driver.GetCursorVisibility (out cachedCursorVisibility);

if (cachedCursorVisibility != CursorVisibility.Invisible)
if (currentCursorVisibility != CursorVisibility.Invisible)
{
_cachedCursorVisibility = cachedCursorVisibility;
Driver.SetCursorVisibility (CursorVisibility.Invisible);
}

Driver.SetCursorVisibility (CursorVisibility.Invisible);

return false;
}

Driver.GetCursorVisibility (out cachedCursorVisibility);

if (cachedCursorVisibility == CursorVisibility.Invisible)
// Show it
if (currentCursorVisibility == CursorVisibility.Invisible)
{
Driver.SetCursorVisibility (_cachedCursorVisibility);
Driver.SetCursorVisibility (mostFocused.CursorVisibility);
}

return prevCursor != cursor;
return true;
}

Driver.GetCursorVisibility (out cachedCursorVisibility);

if (cachedCursorVisibility != CursorVisibility.Invisible)
if (currentCursorVisibility != CursorVisibility.Invisible)
{
_cachedCursorVisibility = cachedCursorVisibility;
Driver.SetCursorVisibility (CursorVisibility.Invisible);
}

Expand Down Expand Up @@ -1413,14 +1398,14 @@ public static bool OnSizeChanging (SizeChangedEventArgs args)
{
SizeChanging?.Invoke (null, args);

if (args.Cancel)
if (args.Cancel || args.Size is null)
{
return false;
}

foreach (Toplevel t in _topLevels)
{
t.SetRelativeLayout (args.Size);
t.SetRelativeLayout (args.Size.Value);
t.LayoutSubviews ();
t.PositionToplevels ();
t.OnSizeChanging (new (args.Size));
Expand Down
10 changes: 10 additions & 0 deletions Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,13 @@ public override void UpdateCursor ()
if (!RunningUnitTests && Col >= 0 && Col < Cols && Row >= 0 && Row < Rows)
{
Curses.move (Row, Col);
Curses.raw ();
Curses.noecho ();
Curses.refresh ();
}
}


public override void UpdateScreen ()
{
for (var row = 0; row < Rows; row++)
Expand Down Expand Up @@ -606,6 +610,12 @@ internal void ProcessInput ()
k = KeyCode.Enter;
}

// Strip the KeyCode.Space flag off if it's set
if (k != KeyCode.Space && k.HasFlag (KeyCode.Space))
{
k &= ~KeyCode.Space;
}

OnKeyDown (new Key (k));
OnKeyUp (new Key (k));
}
Expand Down
9 changes: 3 additions & 6 deletions Terminal.Gui/ConsoleDrivers/NetDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ private void ProcessInput (InputResult inputEvent)
break;
case EventType.Mouse:
MouseEvent me = ToDriverMouse (inputEvent.MouseEvent);
Debug.WriteLine ($"NetDriver: ({me.X},{me.Y}) - {me.Flags}");
//Debug.WriteLine ($"NetDriver: ({me.X},{me.Y}) - {me.Flags}");
OnMouseEvent (me);

break;
Expand Down Expand Up @@ -1591,10 +1591,7 @@ private KeyCode MapKey (ConsoleKeyInfo keyInfo)
return KeyCode.Tab;
}

if (keyInfo.Key == ConsoleKey.Tab)
{
return MapToKeyCodeModifiers (keyInfo.Modifiers, (KeyCode)((uint)keyInfo.Key));
}
return MapToKeyCodeModifiers (keyInfo.Modifiers, (KeyCode)((uint)keyInfo.Key));
}

// Handle control keys (e.g. CursorUp)
Expand Down Expand Up @@ -1648,7 +1645,7 @@ private KeyCode MapKey (ConsoleKeyInfo keyInfo)
}


return MapToKeyCodeModifiers (keyInfo.Modifiers, (KeyCode)((uint)keyInfo.Key));
return MapToKeyCodeModifiers (keyInfo.Modifiers, (KeyCode)((uint)keyInfo.KeyChar));
}

#endregion Keyboard Handling
Expand Down
32 changes: 21 additions & 11 deletions Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Runtime.InteropServices;
using System.Text;
using static Terminal.Gui.ConsoleDrivers.ConsoleKeyMapping;
using static Terminal.Gui.SpinnerStyle;

namespace Terminal.Gui;

Expand Down Expand Up @@ -156,10 +157,7 @@ public void ReadFromConsoleOutput (Size size, Coord coords, ref SmallRect window
}
}

if (!_initialCursorVisibility.HasValue && GetCursorVisibility (out CursorVisibility visibility))
{
_initialCursorVisibility = visibility;
}
SetInitialCursorVisibility();

if (!SetConsoleActiveScreenBuffer (_screenBuffer))
{
Expand Down Expand Up @@ -216,11 +214,11 @@ public bool GetCursorVisibility (out CursorVisibility visibility)
}
else if (info.dwSize > 50)
{
visibility = CursorVisibility.Box;
visibility = CursorVisibility.Default;
}
else
{
visibility = CursorVisibility.Underline;
visibility = CursorVisibility.Default;
}

return true;
Expand Down Expand Up @@ -815,6 +813,11 @@ object lpReserved
[StructLayout (LayoutKind.Sequential)]
public struct ConsoleCursorInfo
{
/// <summary>
/// The percentage of the character cell that is filled by the cursor.This value is between 1 and 100.
/// The cursor appearance varies, ranging from completely filling the cell to showing up as a horizontal
/// line at the bottom of the cell.
/// </summary>
public uint dwSize;
public bool bVisible;
}
Expand Down Expand Up @@ -1436,6 +1439,8 @@ internal override MainLoop Init ()
#if HACK_CHECK_WINCHANGED
_mainLoopDriver.WinChanged = ChangeWin;
#endif

WinConsole?.SetInitialCursorVisibility ();
return new MainLoop (_mainLoopDriver);
}

Expand Down Expand Up @@ -1517,23 +1522,28 @@ internal void ProcessInput (WindowsConsole.InputRecord inputEvent)
#if HACK_CHECK_WINCHANGED
private void ChangeWin (object s, SizeChangedEventArgs e)
{
int w = e.Size.Width;
if (e.Size is null)
{
return;
}

int w = e.Size.Value.Width;

if (w == Cols - 3 && e.Size.Height < Rows)
if (w == Cols - 3 && e.Size.Value.Height < Rows)
{
w += 3;
}

Left = 0;
Top = 0;
Cols = e.Size.Width;
Rows = e.Size.Height;
Cols = e.Size.Value.Width;
Rows = e.Size.Value.Height;

if (!RunningUnitTests)
{
Size newSize = WinConsole.SetConsoleWindow (
(short)Math.Max (w, 16),
(short)Math.Max (e.Size.Height, 0));
(short)Math.Max (e.Size.Value.Height, 0));

Cols = newSize.Width;
Rows = newSize.Height;
Expand Down
1 change: 0 additions & 1 deletion Terminal.Gui/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
-->
<Authors>Miguel de Icaza, Charlie Kindel (@tig), @BDisp</Authors>
</PropertyGroup>

</Project>
Loading
Loading