Replace ExtendedCharInfo.Char with char array

This commit is contained in:
BDisp
2025-07-21 23:38:25 +01:00
parent 0a52c49e71
commit fea1d4f5c0
5 changed files with 18 additions and 18 deletions

View File

@@ -269,7 +269,7 @@ public abstract class ConsoleDriver : IConsoleDriver
if (Contents [Row, Col - 1].Rune.GetColumns () > 1)
{
// Invalidate cell to left
Contents [Row, Col - 1].Rune = Rune.ReplacementChar;
Contents [Row, Col - 1].Rune = (Rune)'\0';
Contents [Row, Col - 1].IsDirty = true;
}
}
@@ -308,7 +308,7 @@ public abstract class ConsoleDriver : IConsoleDriver
{
// Invalidate cell to right so that it doesn't get drawn
// TODO: Figure out if it is better to show a replacement character or ' '
Contents [Row, Col + 1].Rune = Rune.ReplacementChar;
Contents [Row, Col + 1].Rune = (Rune)'\0';
Contents [Row, Col + 1].IsDirty = true;
}
}

View File

@@ -256,7 +256,7 @@ public class OutputBuffer : IOutputBuffer
{
// Invalidate cell to right so that it doesn't get drawn
// TODO: Figure out if it is better to show a replacement character or ' '
Contents [Row, Col + 1].Rune = Rune.ReplacementChar;
Contents [Row, Col + 1].Rune = (Rune)'\0';
Contents [Row, Col + 1].IsDirty = true;
}
}

View File

@@ -139,7 +139,7 @@ internal partial class WindowsOutput : IConsoleOutput
if (buffer.Contents [row, col].IsDirty == false)
{
outputBuffer [position].Empty = true;
outputBuffer [position].Char = (char)Rune.ReplacementChar.Value;
outputBuffer [position].Char = [(char)buffer.Contents [row, col].Rune.Value];
continue;
}
@@ -148,12 +148,12 @@ internal partial class WindowsOutput : IConsoleOutput
if (buffer.Contents [row, col].Rune.IsBmp)
{
outputBuffer [position].Char = (char)buffer.Contents [row, col].Rune.Value;
outputBuffer [position].Char = [(char)buffer.Contents [row, col].Rune.Value];
}
else
{
//outputBuffer [position].Empty = true;
outputBuffer [position].Char = (char)Rune.ReplacementChar.Value;
outputBuffer [position].Char = [(char)buffer.Contents [row, col].Rune.ToString () [0],
(char)buffer.Contents [row, col].Rune.ToString () [1]];
if (buffer.Contents [row, col].Rune.GetColumns () > 1 && col + 1 < buffer.Cols)
{
@@ -161,7 +161,7 @@ internal partial class WindowsOutput : IConsoleOutput
col++;
position = row * buffer.Cols + col;
outputBuffer [position].Empty = false;
outputBuffer [position].Char = ' ';
outputBuffer [position].Char = ['\0'];
}
}
}
@@ -216,7 +216,7 @@ internal partial class WindowsOutput : IConsoleOutput
{
ci [i++] = new ()
{
Char = new () { UnicodeChar = info.Char },
Char = new () { UnicodeChar = info.Char [0] },
Attributes =
(ushort)((int)info.Attribute.Foreground.GetClosestNamedColor16 () | ((int)info.Attribute.Background.GetClosestNamedColor16 () << 4))
};
@@ -246,7 +246,7 @@ internal partial class WindowsOutput : IConsoleOutput
_redrawTextStyle = attr.Style;
}
if (info.Char != '\x1b')
if (info.Char [0] != '\x1b')
{
if (!info.Empty)
{

View File

@@ -198,7 +198,7 @@ internal partial class WindowsConsole
_redrawTextStyle = attr.Style;
}
if (info.Char != '\x1b')
if (info.Char [0] != '\x1b')
{
if (!info.Empty)
{
@@ -791,11 +791,11 @@ internal partial class WindowsConsole
public struct ExtendedCharInfo
{
public char Char { get; set; }
public char [] Char { get; set; }
public Attribute Attribute { get; set; }
public bool Empty { get; set; } // TODO: Temp hack until virtual terminal sequences
public ExtendedCharInfo (char character, Attribute attribute)
public ExtendedCharInfo (char [] character, Attribute attribute)
{
Char = character;
Attribute = attribute;

View File

@@ -337,7 +337,7 @@ internal class WindowsDriver : ConsoleDriver
if (Contents [row, col].IsDirty == false)
{
_outputBuffer [position].Empty = true;
_outputBuffer [position].Char = (char)Rune.ReplacementChar.Value;
_outputBuffer [position].Char = [(char)Contents [row, col].Rune.Value];
continue;
}
@@ -346,12 +346,12 @@ internal class WindowsDriver : ConsoleDriver
if (Contents [row, col].Rune.IsBmp)
{
_outputBuffer [position].Char = (char)Contents [row, col].Rune.Value;
_outputBuffer [position].Char = [(char)Contents [row, col].Rune.Value];
}
else
{
//_outputBuffer [position].Empty = true;
_outputBuffer [position].Char = (char)Rune.ReplacementChar.Value;
_outputBuffer [position].Char = [(char)Contents [row, col].Rune.ToString () [0],
(char)Contents [row, col].Rune.ToString () [1]];
if (Contents [row, col].Rune.GetColumns () > 1 && col + 1 < Cols)
{
@@ -359,7 +359,7 @@ internal class WindowsDriver : ConsoleDriver
col++;
position = row * Cols + col;
_outputBuffer [position].Empty = false;
_outputBuffer [position].Char = ' ';
_outputBuffer [position].Char = ['\0'];
}
}
}