Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2d1ab6f
Fixes #4196. Application.Begin doesn't refresh the screen at start
BDisp Jul 21, 2025
a470275
Fixes #4198. Application.Invoke isn't wakeup the driver if idle
BDisp Jul 21, 2025
ef639c1
Reformatting to run CI again
BDisp Jul 21, 2025
d2acdf6
Revert "Reformatting to run CI again"
BDisp Jul 21, 2025
e48466f
Trying fix an issue where sometimes subview variable is null running …
BDisp Jul 21, 2025
0a52c49
Merge branch 'v2_4198_application-invoke-wakeup-fix' into v2_4200_wid…
BDisp Jul 21, 2025
fea1d4f
Replace ExtendedCharInfo.Char with char array
BDisp Jul 21, 2025
7097c0b
Replace IsWindowsTerminal with IsVirtualTerminal
BDisp Jul 22, 2025
8ef7116
Add a lastSize parameter to process resize automatically
BDisp Jul 22, 2025
1a2fb66
Handling surrogate pairs in input
BDisp Jul 22, 2025
9c25a7c
Implement SetConsoleTextAttribute
BDisp Jul 22, 2025
69e1986
Prevent select true color is not supported
BDisp Jul 22, 2025
600eba4
Fix null exception
BDisp Jul 22, 2025
0cc4c60
Revert GetWindowSize and add SetWindowSize
BDisp Jul 22, 2025
265c30e
Resolving merge conflicts
BDisp Jul 22, 2025
e061af0
Fix unit tests
BDisp Jul 22, 2025
15d4ac0
Revert all v2 changes except the one related with the ExtendedCharInfo
BDisp Jul 23, 2025
2f7b3c9
Revert newlines and FakeOutput
BDisp Jul 23, 2025
45d1710
Merge branch 'v2_develop' into v2_4200_wider-surrogatepair-force16col…
BDisp Jul 29, 2025
5be8d60
Prevents null reference
BDisp Jul 30, 2025
50cfa71
Add gnome-terminal to launch settings
BDisp Jul 30, 2025
88bf87b
Fixes issue on restore window size after maximize causing width shrin…
BDisp Jul 30, 2025
1ce2788
Add ; exec bash to stay in terminal
BDisp Jul 31, 2025
e5edad7
Fixes issue on restore window size after maximize causing width shrin…
BDisp Jul 31, 2025
8ead150
Tidying up input and output console modes
BDisp Jul 31, 2025
742ba26
Fixes uninitialized screen buffer.
BDisp Jul 31, 2025
3ad0859
Revert "Fixes issue on restore window size after maximize causing wid…
BDisp Aug 4, 2025
18d85e2
Merge branch 'v2_develop' into v2_4200_wider-surrogatepair-force16col…
BDisp Aug 4, 2025
3f5bdd2
Reset console after sending escape sequences
BDisp Aug 4, 2025
785a1ed
Remove unnecessary code only for buggy VSDebugConsole
BDisp Aug 4, 2025
30ff632
Fix more annoying exceptions
BDisp Aug 4, 2025
b0df97e
Ensure flush the input buffer before reset the console
BDisp Aug 4, 2025
104b8cf
Remove unnecessary ENABLE_VIRTUAL_TERMINAL_INPUT
BDisp Aug 20, 2025
9fbbf59
Remove unnecessary error handles
BDisp Aug 20, 2025
5f5e561
Resolving merge conflicts
BDisp Aug 31, 2025
3d640ee
Merge branch 'v2_develop' into v2_4200_wider-surrogatepair-force16col…
tig Sep 1, 2025
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
2 changes: 1 addition & 1 deletion Terminal.Gui/Drivers/V2/ConsoleDriverFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ IWindowSizeMonitor windowSizeMonitor
}
else if (InputProcessor is NetInputProcessor)
{
SupportsTrueColor = Application.Driver.SupportsTrueColor;
SupportsTrueColor = Application.Driver?.SupportsTrueColor == true;
}

InputProcessor.KeyDown += (s, e) => KeyDown?.Invoke (s, e);
Expand Down
10 changes: 8 additions & 2 deletions Terminal.Gui/Drivers/V2/IConsoleOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ public interface IConsoleOutput : IDisposable
/// Returns the current size of the console window in rows/columns (i.e.
/// of characters not pixels).
/// </summary>
/// <param name="lastSize"></param>
/// <returns></returns>
public Size GetWindowSize (Size? lastSize = null);
public Size GetWindowSize ();

/// <summary>
/// Sets the current size of the console window in rows/columns
/// </summary>
/// <param name="newSize"></param>
/// /// <returns></returns>
public Size SetWindowSize (Size newSize);

/// <summary>
/// Updates the console cursor (the blinking underscore) to be hidden,
Expand Down
8 changes: 7 additions & 1 deletion Terminal.Gui/Drivers/V2/NetOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void Write (IOutputBuffer buffer)
}

/// <inheritdoc/>
public Size GetWindowSize (Size? lastSize = null)
public Size GetWindowSize ()
{
if (ConsoleDriver.RunningUnitTests)
{
Expand All @@ -213,6 +213,12 @@ public Size GetWindowSize (Size? lastSize = null)
return new (Console.WindowWidth, Console.WindowHeight);
}

/// <inheritdoc />
public Size SetWindowSize (Size newSize)
{
return newSize;
}

private void WriteToConsole (StringBuilder output, ref int lastCol, int row, ref int outputWidth)
{
SetCursorPositionImpl (lastCol, row);
Expand Down
15 changes: 11 additions & 4 deletions Terminal.Gui/Drivers/V2/WindowSizeMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ public bool Poll ()
return false;
}

Size size = _consoleOut.GetWindowSize (_lastSize);
Size size = _consoleOut.GetWindowSize ();

if (size != _lastSize)
{
Logging.Logger.LogInformation ($"Console size changes from '{_lastSize}' to {size}");
_outputBuffer.SetWindowSize (size.Width, size.Height);
_lastSize = size;
SizeChanging?.Invoke (this, new (size));
Size newSize = size;

if (_consoleOut.GetType().Name == "WindowsOutput")
{
newSize = _consoleOut.SetWindowSize (size);
}

_outputBuffer.SetWindowSize (newSize.Width, newSize.Height);
_lastSize = newSize;
SizeChanging?.Invoke (this, new (newSize));

return true;
}
Expand Down
20 changes: 11 additions & 9 deletions Terminal.Gui/Drivers/V2/WindowsOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public bool WriteToConsole (Size size, WindowsConsole.ExtendedCharInfo [] charIn
return result;
}

public Size GetWindowSize (Size? lastSize = null)
public Size GetWindowSize ()
{
var csbi = new WindowsConsole.CONSOLE_SCREEN_BUFFER_INFOEX ();
csbi.cbSize = (uint)Marshal.SizeOf (csbi);
Expand All @@ -481,17 +481,19 @@ public Size GetWindowSize (Size? lastSize = null)
csbi.srWindow.Right - csbi.srWindow.Left + 1,
csbi.srWindow.Bottom - csbi.srWindow.Top + 1);

if (lastSize is { } && sz != lastSize)
{
Size newSize = SetConsoleWindow ((short)sz.Width, (short)sz.Height);
return sz;
}

if (sz != newSize)
{
return newSize;
}
public Size SetWindowSize (Size newSize)
{
Size resSize = SetConsoleWindow ((short)newSize.Width, (short)newSize.Height);

if (resSize != newSize)
{
return resSize;
}

return sz;
return newSize;
}

private Size SetConsoleWindow (short cols, short rows)
Expand Down
5 changes: 4 additions & 1 deletion Tests/TerminalGuiFluentTesting/FakeOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

internal class FakeOutput : IConsoleOutput
{
public IOutputBuffer LastBuffer { get; set; }

Check warning on line 7 in Tests/TerminalGuiFluentTesting/FakeOutput.cs

View workflow job for this annotation

GitHub Actions / build_release

Non-nullable property 'LastBuffer' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
public Size Size { get; set; }

/// <inheritdoc/>
Expand All @@ -17,7 +17,10 @@
public void Write (IOutputBuffer buffer) { LastBuffer = buffer; }

/// <inheritdoc/>
public Size GetWindowSize (Size? lastSize = null) { return Size; }
public Size GetWindowSize () { return Size; }

/// <inheritdoc />
public Size SetWindowSize (Size newSize) { return newSize; }

/// <inheritdoc/>
public void SetCursorVisibility (CursorVisibility visibility) { }
Expand Down
4 changes: 2 additions & 2 deletions Tests/UnitTests/ConsoleDrivers/V2/WindowSizeMonitorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void TestWindowSizeMonitor_RaisesEventWhenChanges ()

});

consoleOutput.Setup (m => m.GetWindowSize (null))
consoleOutput.Setup (m => m.GetWindowSize ())
.Returns (queue.Dequeue);

var outputBuffer = Mock.Of<IOutputBuffer> ();
Expand Down Expand Up @@ -52,7 +52,7 @@ public void TestWindowSizeMonitor_DoesNotRaiseEventWhen_NoChanges ()
new Size (30, 20),
});

consoleOutput.Setup (m => m.GetWindowSize (null))
consoleOutput.Setup (m => m.GetWindowSize ())
.Returns (queue.Dequeue);

var outputBuffer = Mock.Of<IOutputBuffer> ();
Expand Down
Loading