Skip to content

Commit ad8ebc9

Browse files
BDisptig
andauthored
Fixes #4200. ExtendedCharInfo needs be enhanced to properly deal with all codepoints (#4202)
* Fixes #4196. Application.Begin doesn't refresh the screen at start * Fixes #4198. Application.Invoke isn't wakeup the driver if idle * Reformatting to run CI again * Revert "Reformatting to run CI again" This reverts commit ef639c1. * Trying fix an issue where sometimes subview variable is null running unit tests * Replace ExtendedCharInfo.Char with char array * Replace IsWindowsTerminal with IsVirtualTerminal * Add a lastSize parameter to process resize automatically * Handling surrogate pairs in input * Implement SetConsoleTextAttribute * Prevent select true color is not supported * Fix null exception * Revert GetWindowSize and add SetWindowSize * Fix unit tests * Revert all v2 changes except the one related with the ExtendedCharInfo * Revert newlines and FakeOutput * Prevents null reference * Add gnome-terminal to launch settings * Fixes issue on restore window size after maximize causing width shrinking * Add ; exec bash to stay in terminal * Fixes issue on restore window size after maximize causing width shrinking * Tidying up input and output console modes * Fixes uninitialized screen buffer. * Revert "Fixes issue on restore window size after maximize causing width shrinking" This reverts commit e5edad7. * Reset console after sending escape sequences * Remove unnecessary code only for buggy VSDebugConsole * Fix more annoying exceptions * Ensure flush the input buffer before reset the console * Remove unnecessary ENABLE_VIRTUAL_TERMINAL_INPUT * Remove unnecessary error handles * Fix CI warnings * Fix more CI warnings * Fix more CI warnings * Fixes #2796. CursesDriver doesn't render wide codepoints correctly --------- Co-authored-by: Tig <[email protected]>
1 parent 6b7855e commit ad8ebc9

File tree

19 files changed

+501
-459
lines changed

19 files changed

+501
-459
lines changed

Examples/UICatalog/Properties/launchSettings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,30 @@
4848
"commandLineArgs": "dotnet UICatalog.dll --driver v2net",
4949
"distributionName": ""
5050
},
51+
"WSL-Gnome: UICatalog": {
52+
"commandName": "Executable",
53+
"executablePath": "wsl",
54+
"commandLineArgs": "bash -c 'while [ ! -e \"$XDG_RUNTIME_DIR/bus\" ]; do sleep 0.1; done; gnome-terminal --wait -- bash -l -c \"dotnet UICatalog.dll; exec bash\"'",
55+
"distributionName": ""
56+
},
57+
"WSL-Gnome: UICatalog --driver NetDriver": {
58+
"commandName": "Executable",
59+
"executablePath": "wsl",
60+
"commandLineArgs": "bash -c 'while [ ! -e \"$XDG_RUNTIME_DIR/bus\" ]; do sleep 0.1; done; gnome-terminal --wait -- bash -l -c \"dotnet UICatalog.dll --driver NetDriver; exec bash\"'",
61+
"distributionName": ""
62+
},
63+
"WSL-Gnome: UICatalog --driver v2": {
64+
"commandName": "Executable",
65+
"executablePath": "wsl",
66+
"commandLineArgs": "bash -c 'while [ ! -e \"$XDG_RUNTIME_DIR/bus\" ]; do sleep 0.1; done; gnome-terminal --wait -- bash -l -c \"dotnet UICatalog.dll --driver v2; exec bash\"'",
67+
"distributionName": ""
68+
},
69+
"WSL-Gnome: UICatalog --driver v2net": {
70+
"commandName": "Executable",
71+
"executablePath": "wsl",
72+
"commandLineArgs": "bash -c 'while [ ! -e \"$XDG_RUNTIME_DIR/bus\" ]; do sleep 0.1; done; gnome-terminal --wait -- bash -l -c \"dotnet UICatalog.dll --driver v2net; exec bash\"'",
73+
"distributionName": ""
74+
},
5175
"Benchmark All": {
5276
"commandName": "Project",
5377
"commandLineArgs": "--benchmark"

Examples/UICatalog/Scenarios/NumericUpDownDemo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void IncrementOnAccept (object? o, EventArgs eventArgs)
252252
{
253253
X = Pos.Center (),
254254
Y = Pos.Bottom (_increment) + 1,
255-
Increment = NumericUpDown<int>.TryConvert (1, out T? increment) ? increment : default,
255+
Increment = NumericUpDown<int>.TryConvert (1, out T? increment) ? increment : default (T?),
256256
};
257257

258258
_numericUpDown.ValueChanged += NumericUpDownOnValueChanged;

Examples/UICatalog/UICatalogTop.cs

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,23 @@ View [] CreateThemeMenuItems ()
166166
CheckedState = Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked
167167
};
168168

169+
_force16ColorsMenuItemCb.CheckedStateChanging += (sender, args) =>
170+
{
171+
if (Application.Force16Colors
172+
&& args.Result == CheckState.UnChecked
173+
&& !Application.Driver!.SupportsTrueColor)
174+
{
175+
args.Handled = true;
176+
}
177+
};
178+
169179
_force16ColorsMenuItemCb.CheckedStateChanged += (sender, args) =>
170-
{
171-
Application.Force16Colors = args.Value == CheckState.Checked;
180+
{
181+
Application.Force16Colors = args.Value == CheckState.Checked;
172182

173-
_force16ColorsShortcutCb!.CheckedState = args.Value;
174-
Application.LayoutAndDraw ();
175-
};
183+
_force16ColorsShortcutCb!.CheckedState = args.Value;
184+
Application.LayoutAndDraw ();
185+
};
176186

177187
menuItems.Add (
178188
new MenuItemv2
@@ -608,11 +618,22 @@ private StatusBar CreateStatusBar ()
608618
};
609619

610620
_force16ColorsShortcutCb.CheckedStateChanging += (sender, args) =>
611-
{
612-
Application.Force16Colors = args.Result == CheckState.Checked;
613-
_force16ColorsMenuItemCb!.CheckedState = args.Result;
614-
Application.LayoutAndDraw ();
615-
};
621+
{
622+
if (Application.Force16Colors
623+
&& args.Result == CheckState.UnChecked
624+
&& !Application.Driver!.SupportsTrueColor)
625+
{
626+
// If the driver does not support TrueColor, we cannot disable 16 colors
627+
args.Handled = true;
628+
}
629+
};
630+
631+
_force16ColorsShortcutCb.CheckedStateChanged += (sender, args) =>
632+
{
633+
Application.Force16Colors = args.Value == CheckState.Checked;
634+
_force16ColorsMenuItemCb!.CheckedState = args.Value;
635+
Application.LayoutAndDraw ();
636+
};
616637

617638
statusBar.Add (
618639
_shQuit,

Terminal.Gui/Drawing/Sixel/SixelSupportDetector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class SixelSupportDetector
2020
public void Detect (Action<SixelSupportResult> resultCallback)
2121
{
2222
var result = new SixelSupportResult ();
23-
result.SupportsTransparency = IsWindowsTerminal () || IsXtermWithTransparency ();
23+
result.SupportsTransparency = IsVirtualTerminal () || IsXtermWithTransparency ();
2424
IsSixelSupportedByDar (result, resultCallback);
2525
}
2626

@@ -142,7 +142,7 @@ private static void QueueRequest (AnsiEscapeSequence req, Action<string> respons
142142

143143
private static bool ResponseIndicatesSupport (string response) { return response.Split (';').Contains ("4"); }
144144

145-
private static bool IsWindowsTerminal ()
145+
private static bool IsVirtualTerminal ()
146146
{
147147
return !string.IsNullOrWhiteSpace (Environment.GetEnvironmentVariable ("WT_SESSION"));
148148

Terminal.Gui/Drivers/ConsoleDriver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void AddRune (Rune rune)
269269
if (Contents [Row, Col - 1].Rune.GetColumns () > 1)
270270
{
271271
// Invalidate cell to left
272-
Contents [Row, Col - 1].Rune = Rune.ReplacementChar;
272+
Contents [Row, Col - 1].Rune = (Rune)'\0';
273273
Contents [Row, Col - 1].IsDirty = true;
274274
}
275275
}
@@ -308,7 +308,7 @@ public void AddRune (Rune rune)
308308
{
309309
// Invalidate cell to right so that it doesn't get drawn
310310
// TODO: Figure out if it is better to show a replacement character or ' '
311-
Contents [Row, Col + 1].Rune = Rune.ReplacementChar;
311+
Contents [Row, Col + 1].Rune = (Rune)'\0';
312312
Contents [Row, Col + 1].IsDirty = true;
313313
}
314314
}

0 commit comments

Comments
 (0)