diff --git a/Terminal.Gui/Drawing/Cell.cs b/Terminal.Gui/Drawing/Cell.cs
index 55da05184..581cc6bd6 100644
--- a/Terminal.Gui/Drawing/Cell.cs
+++ b/Terminal.Gui/Drawing/Cell.cs
@@ -4,19 +4,18 @@
/// Represents a single row/column in a Terminal.Gui rendering surface (e.g. and
/// ).
///
-public record struct Cell ()
+public record struct Cell (Attribute? Attribute = null, bool IsDirty = false, Rune Rune = default)
{
-
/// The attributes to use when drawing the Glyph.
- public Attribute? Attribute { get; set; } = null;
+ public Attribute? Attribute { get; set; } = Attribute;
///
/// Gets or sets a value indicating whether this has been modified since the
/// last time it was drawn.
///
- public bool IsDirty { get; set; } = false;
+ public bool IsDirty { get; set; } = IsDirty;
- private Rune _rune = default;
+ private Rune _rune = Rune;
/// The character to display. If is , then is ignored.
public Rune Rune
@@ -29,6 +28,8 @@ public record struct Cell ()
}
}
+ private List _combiningMarks;
+
///
/// The combining marks for that when combined makes this Cell a combining sequence. If
/// empty, then is ignored.
@@ -37,8 +38,132 @@ public record struct Cell ()
/// Only valid in the rare case where is a combining sequence that could not be normalized to a
/// single Rune.
///
- internal List CombiningMarks { get; } = new ();
+ internal List CombiningMarks
+ {
+ get => _combiningMarks ?? [];
+ private set => _combiningMarks = value ?? [];
+ }
///
public override string ToString () { return $"[{Rune}, {Attribute}]"; }
+
+ /// Converts the string into a .
+ /// The string to convert.
+ /// The to use.
+ ///
+ public static List ToCellList (string str, Attribute? attribute = null)
+ {
+ List cells = new ();
+
+ foreach (Rune rune in str.EnumerateRunes ())
+ {
+ cells.Add (new () { Rune = rune, Attribute = attribute });
+ }
+
+ return cells;
+ }
+
+ ///
+ /// Splits a string into a List that will contain a for each line.
+ ///
+ /// The string content.
+ /// The color scheme.
+ /// A for each line.
+ public static List> StringToLinesOfCells (string content, Attribute? attribute = null)
+ {
+ List cells = content.EnumerateRunes ()
+ .Select (x => new Cell { Rune = x, Attribute = attribute })
+ .ToList ();
+
+ return SplitNewLines (cells);
+ }
+
+ /// Converts a generic collection into a string.
+ /// The enumerable cell to convert.
+ ///
+ public static string ToString (IEnumerable cells)
+ {
+ var str = string.Empty;
+
+ foreach (Cell cell in cells)
+ {
+ str += cell.Rune.ToString ();
+ }
+
+ return str;
+ }
+
+ // Turns the string into cells, this does not split the contents on a newline if it is present.
+
+ internal static List StringToCells (string str, Attribute? attribute = null)
+ {
+ List cells = [];
+
+ foreach (Rune rune in str.ToRunes ())
+ {
+ cells.Add (new () { Rune = rune, Attribute = attribute });
+ }
+
+ return cells;
+ }
+
+ internal static List ToCells (IEnumerable runes, Attribute? attribute = null)
+ {
+ List cells = new ();
+
+ foreach (Rune rune in runes)
+ {
+ cells.Add (new () { Rune = rune, Attribute = attribute });
+ }
+
+ return cells;
+ }
+
+ private static List> SplitNewLines (List cells)
+ {
+ List> lines = [];
+ int start = 0, i = 0;
+ var hasCR = false;
+
+ // ASCII code 13 = Carriage Return.
+ // ASCII code 10 = Line Feed.
+ for (; i < cells.Count; i++)
+ {
+ if (cells [i].Rune.Value == 13)
+ {
+ hasCR = true;
+
+ continue;
+ }
+
+ if (cells [i].Rune.Value == 10)
+ {
+ if (i - start > 0)
+ {
+ lines.Add (cells.GetRange (start, hasCR ? i - 1 - start : i - start));
+ }
+ else
+ {
+ lines.Add (StringToCells (string.Empty));
+ }
+
+ start = i + 1;
+ hasCR = false;
+ }
+ }
+
+ if (i - start >= 0)
+ {
+ lines.Add (cells.GetRange (start, i - start));
+ }
+
+ return lines;
+ }
+
+ ///
+ /// Splits a rune cell list into a List that will contain a for each line.
+ ///
+ /// The cells list.
+ ///
+ public static List> ToCells (List cells) { return SplitNewLines (cells); }
}
diff --git a/Terminal.Gui/Views/RuneCellEventArgs.cs b/Terminal.Gui/Drawing/CellEventArgs.cs
similarity index 57%
rename from Terminal.Gui/Views/RuneCellEventArgs.cs
rename to Terminal.Gui/Drawing/CellEventArgs.cs
index 1283cfe57..14b98f36b 100644
--- a/Terminal.Gui/Views/RuneCellEventArgs.cs
+++ b/Terminal.Gui/Drawing/CellEventArgs.cs
@@ -1,27 +1,27 @@
namespace Terminal.Gui;
-/// Args for events that relate to a specific .
-public class RuneCellEventArgs
+/// Args for events that relate to a specific .
+public class CellEventArgs
{
- /// Creates a new instance of the class.
+ /// Creates a new instance of the class.
/// The line.
/// The col index.
/// The unwrapped row and col index.
- public RuneCellEventArgs (List line, int col, (int Row, int Col) unwrappedPosition)
+ public CellEventArgs (List line, int col, (int Row, int Col) unwrappedPosition)
{
Line = line;
Col = col;
UnwrappedPosition = unwrappedPosition;
}
- /// The index of the RuneCell in the line.
+ /// The index of the Cell in the line.
public int Col { get; }
- /// The list of runes the RuneCell is part of.
- public List Line { get; }
+ /// The list of runes the Cell is part of.
+ public List Line { get; }
///
- /// The unwrapped row and column index into the text containing the RuneCell. Unwrapped means the text without
+ /// The unwrapped row and column index into the text containing the Cell. Unwrapped means the text without
/// word wrapping or other visual formatting having been applied.
///
public (int Row, int Col) UnwrappedPosition { get; }
diff --git a/Terminal.Gui/Drawing/LineCanvas.cs b/Terminal.Gui/Drawing/LineCanvas.cs
index 9a7365f26..235d657d9 100644
--- a/Terminal.Gui/Drawing/LineCanvas.cs
+++ b/Terminal.Gui/Drawing/LineCanvas.cs
@@ -138,7 +138,7 @@ public class LineCanvas : IDisposable
int length,
Orientation orientation,
LineStyle style,
- Attribute? attribute = default
+ Attribute? attribute = null
)
{
_cachedViewport = Rectangle.Empty;
diff --git a/Terminal.Gui/Drawing/StraightLine.cs b/Terminal.Gui/Drawing/StraightLine.cs
index 2f36995df..fe2ccdc1d 100644
--- a/Terminal.Gui/Drawing/StraightLine.cs
+++ b/Terminal.Gui/Drawing/StraightLine.cs
@@ -16,7 +16,7 @@ public class StraightLine
int length,
Orientation orientation,
LineStyle style,
- Attribute? attribute = default
+ Attribute? attribute = null
)
{
Start = start;
diff --git a/Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs b/Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs
index 2686c1024..ed55b0d3f 100644
--- a/Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs
+++ b/Terminal.Gui/Text/Autocomplete/AutocompleteContext.cs
@@ -7,7 +7,7 @@ namespace Terminal.Gui;
public class AutocompleteContext
{
/// Creates a new instance of the class
- public AutocompleteContext (List currentLine, int cursorPosition, bool canceled = false)
+ public AutocompleteContext (List currentLine, int cursorPosition, bool canceled = false)
{
CurrentLine = currentLine;
CursorPosition = cursorPosition;
@@ -18,7 +18,7 @@ public class AutocompleteContext
public bool Canceled { get; set; }
/// The text on the current line.
- public List CurrentLine { get; set; }
+ public List CurrentLine { get; set; }
/// The position of the input cursor within the .
public int CursorPosition { get; set; }
diff --git a/Terminal.Gui/Views/AutocompleteFilepathContext.cs b/Terminal.Gui/Views/AutocompleteFilepathContext.cs
index a379f2001..b21724816 100644
--- a/Terminal.Gui/Views/AutocompleteFilepathContext.cs
+++ b/Terminal.Gui/Views/AutocompleteFilepathContext.cs
@@ -6,7 +6,7 @@ namespace Terminal.Gui;
internal class AutocompleteFilepathContext : AutocompleteContext
{
public AutocompleteFilepathContext (string currentLine, int cursorPosition, FileDialogState state)
- : base (RuneCell.ToRuneCellList (currentLine), cursorPosition)
+ : base (Cell.ToCellList (currentLine), cursorPosition)
{
State = state;
}
@@ -30,7 +30,7 @@ internal class FilepathSuggestionGenerator : ISuggestionGenerator
return Enumerable.Empty ();
}
- var path = RuneCell.ToString (context.CurrentLine);
+ var path = Cell.ToString (context.CurrentLine);
int last = path.LastIndexOfAny (FileDialog.Separators);
if (string.IsNullOrWhiteSpace (path) || !Path.IsPathRooted (path))
diff --git a/Terminal.Gui/Views/HistoryTextItemEventArgs.cs b/Terminal.Gui/Views/HistoryTextItemEventArgs.cs
index ca2ad3ad7..c75f4a5e8 100644
--- a/Terminal.Gui/Views/HistoryTextItemEventArgs.cs
+++ b/Terminal.Gui/Views/HistoryTextItemEventArgs.cs
@@ -9,11 +9,11 @@ internal partial class HistoryText
public Point CursorPosition;
public Point FinalCursorPosition;
public bool IsUndoing;
- public List> Lines;
+ public List> Lines;
public LineStatus LineStatus;
public HistoryTextItemEventArgs RemovedOnAdded;
- public HistoryTextItemEventArgs (List> lines, Point curPos, LineStatus linesStatus)
+ public HistoryTextItemEventArgs (List> lines, Point curPos, LineStatus linesStatus)
{
Lines = lines;
CursorPosition = curPos;
@@ -22,7 +22,7 @@ internal partial class HistoryText
public HistoryTextItemEventArgs (HistoryTextItemEventArgs historyTextItem)
{
- Lines = new List> (historyTextItem.Lines);
+ Lines = new List> (historyTextItem.Lines);
CursorPosition = new Point (historyTextItem.CursorPosition.X, historyTextItem.CursorPosition.Y);
LineStatus = historyTextItem.LineStatus;
}
diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs
index acbefdf9a..a352e586c 100644
--- a/Terminal.Gui/Views/TextField.cs
+++ b/Terminal.Gui/Views/TextField.cs
@@ -546,12 +546,12 @@ public class TextField : View
if (!Secret && !_historyText.IsFromHistory)
{
_historyText.Add (
- new List> { RuneCell.ToRuneCellList (oldText) },
+ new List> { Cell.ToCellList (oldText) },
new Point (_cursorPosition, 0)
);
_historyText.Add (
- new List> { RuneCell.ToRuneCells (_text) },
+ new List> { Cell.ToCells (_text) },
new Point (_cursorPosition, 0),
HistoryText.LineStatus.Replaced
);
@@ -648,7 +648,7 @@ public class TextField : View
}
_historyText.Add (
- new List> { RuneCell.ToRuneCells (_text) },
+ new List> { Cell.ToCells (_text) },
new Point (_cursorPosition, 0)
);
@@ -702,7 +702,7 @@ public class TextField : View
}
_historyText.Add (
- new List> { RuneCell.ToRuneCells (_text) },
+ new List> { Cell.ToCells (_text) },
new Point (_cursorPosition, 0)
);
@@ -1342,7 +1342,7 @@ public class TextField : View
private void GenerateSuggestions ()
{
- List currentLine = RuneCell.ToRuneCellList (Text);
+ List currentLine = Cell.ToCellList (Text);
int cursorPosition = Math.Min (CursorPosition, currentLine.Count);
Autocomplete.Context = new AutocompleteContext (
@@ -1390,7 +1390,7 @@ public class TextField : View
return;
}
- Text = RuneCell.ToString (obj?.Lines [obj.CursorPosition.Y]);
+ Text = Cell.ToString (obj?.Lines [obj.CursorPosition.Y]);
CursorPosition = obj.CursorPosition.X;
Adjust ();
}
@@ -1398,7 +1398,7 @@ public class TextField : View
private void InsertText (Key a, bool usePreTextChangedCursorPos)
{
_historyText.Add (
- new List> { RuneCell.ToRuneCells (_text) },
+ new List> { Cell.ToCells (_text) },
new Point (_cursorPosition, 0)
);
diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index 5223c210e..67b2afe2e 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -9,163 +9,9 @@ using Terminal.Gui.Resources;
namespace Terminal.Gui;
-///
-/// Represents a single row/column within the . Includes the glyph and the
-/// foreground/background colors.
-///
-[DebuggerDisplay ("{ColorSchemeDebuggerDisplay}")]
-public class RuneCell : IEquatable
-{
- /// The color sets to draw the glyph with.
- [JsonConverter (typeof (ColorSchemeJsonConverter))]
- public ColorScheme? ColorScheme { get; set; }
-
- /// The glyph to draw.
- [JsonConverter (typeof (RuneJsonConverter))]
- public Rune Rune { get; set; }
-
- private string ColorSchemeDebuggerDisplay => ToString ();
-
- /// Indicates whether the current object is equal to another object of the same type.
- /// An object to compare with this object.
- ///
- /// if the current object is equal to the parameter; otherwise,
- /// .
- ///
- public bool Equals (RuneCell? other) { return other is { } && Rune.Equals (other.Rune) && ColorScheme == other.ColorScheme; }
-
- /// Returns a string that represents the current object.
- /// A string that represents the current object.
- public override string ToString ()
- {
- string colorSchemeStr = ColorScheme?.ToString () ?? "null";
-
- return $"U+{Rune.Value:X4} '{Rune.ToString ()}'; {colorSchemeStr}";
- }
-
- /// Converts the string into a .
- /// The string to convert.
- /// The to use.
- ///
- public static List ToRuneCellList (string str, ColorScheme? colorScheme = null)
- {
- List cells = new ();
-
- foreach (Rune rune in str.EnumerateRunes ())
- {
- cells.Add (new () { Rune = rune, ColorScheme = colorScheme });
- }
-
- return cells;
- }
-
- ///
- /// Splits a string into a List that will contain a for each line.
- ///
- /// The string content.
- /// The color scheme.
- /// A for each line.
- public static List> StringToLinesOfRuneCells (string content, ColorScheme? colorScheme = null)
- {
- List cells = content.EnumerateRunes ()
- .Select (x => new RuneCell { Rune = x, ColorScheme = colorScheme })
- .ToList ();
-
- return SplitNewLines (cells);
- }
-
- /// Converts a generic collection into a string.
- /// The enumerable cell to convert.
- ///
- public static string ToString (IEnumerable cells)
- {
- var str = string.Empty;
-
- foreach (RuneCell cell in cells)
- {
- str += cell.Rune.ToString ();
- }
-
- return str;
- }
-
- // Turns the string into cells, this does not split the contents on a newline if it is present.
- internal static List StringToRuneCells (string str, ColorScheme? colorScheme = null)
- {
- List cells = new ();
-
- foreach (Rune rune in str.ToRunes ())
- {
- cells.Add (new () { Rune = rune, ColorScheme = colorScheme });
- }
-
- return cells;
- }
-
- internal static List ToRuneCells (IEnumerable runes, ColorScheme? colorScheme = null)
- {
- List cells = new ();
-
- foreach (Rune rune in runes)
- {
- cells.Add (new () { Rune = rune, ColorScheme = colorScheme });
- }
-
- return cells;
- }
-
- private static List> SplitNewLines (List cells)
- {
- List> lines = new ();
- int start = 0, i = 0;
- var hasCR = false;
-
- // ASCII code 13 = Carriage Return.
- // ASCII code 10 = Line Feed.
- for (; i < cells.Count; i++)
- {
- if (cells [i].Rune.Value == 13)
- {
- hasCR = true;
-
- continue;
- }
-
- if (cells [i].Rune.Value == 10)
- {
- if (i - start > 0)
- {
- lines.Add (cells.GetRange (start, hasCR ? i - 1 - start : i - start));
- }
- else
- {
- lines.Add (StringToRuneCells (string.Empty));
- }
-
- start = i + 1;
- hasCR = false;
- }
- }
-
- if (i - start >= 0)
- {
- lines.Add (cells.GetRange (start, i - start));
- }
-
- return lines;
- }
-
- ///
- /// Splits a rune cell list into a List that will contain a for each line.
- ///
- /// The cells list.
- ///
- public static List> ToRuneCells (List cells) { return SplitNewLines (cells); }
-}
-
internal class TextModel
{
- private List> _lines = new ();
+ private List> _lines = new ();
private (Point startPointToFind, Point currentPointToFind, bool found) _toFind;
/// The number of text lines in the model
@@ -175,8 +21,8 @@ internal class TextModel
/// Adds a line to the model at the specified position.
/// Line number where the line will be inserted.
- /// The line of text and color, as a List of RuneCell.
- public void AddLine (int pos, List cells) { _lines.Insert (pos, cells); }
+ /// The line of text and color, as a List of Cell.
+ public void AddLine (int pos, List cells) { _lines.Insert (pos, cells); }
public bool CloseFile ()
{
@@ -191,12 +37,12 @@ internal class TextModel
return true;
}
- public List> GetAllLines () { return _lines; }
+ public List> GetAllLines () { return _lines; }
/// Returns the specified line as a List of Rune
/// The line.
/// Line number to retrieve.
- public List GetLine (int line)
+ public List GetLine (int line)
{
if (_lines.Count > 0)
{
@@ -224,7 +70,7 @@ internal class TextModel
for (int i = first; i < last; i++)
{
- List line = GetLine (i);
+ List line = GetLine (i);
int tabSum = line.Sum (c => c.Rune.Value == '\t' ? Math.Max (tabWidth - 1, 0) : 0);
int l = line.Count + tabSum;
@@ -251,17 +97,17 @@ internal class TextModel
}
}
- public void LoadListRuneCells (List> cellsList, ColorScheme? colorScheme)
+ public void LoadListCells (List> cellsList, Attribute? attribute)
{
_lines = cellsList;
- SetColorSchemes (colorScheme);
+ SetAttributes (attribute);
OnLinesLoaded ();
}
- public void LoadRuneCells (List cells, ColorScheme? colorScheme)
+ public void LoadCells (List cells, Attribute? attribute)
{
- _lines = RuneCell.ToRuneCells (cells);
- SetColorSchemes (colorScheme);
+ _lines = Cell.ToCells ((List)cells);
+ SetAttributes (attribute);
OnLinesLoaded ();
}
@@ -310,7 +156,7 @@ internal class TextModel
public void LoadString (string content)
{
- _lines = RuneCell.StringToLinesOfRuneCells (content);
+ _lines = Cell.StringToLinesOfCells (content);
OnLinesLoaded ();
}
@@ -330,7 +176,7 @@ internal class TextModel
}
}
- public void ReplaceLine (int pos, List runes)
+ public void ReplaceLine (int pos, List runes)
{
if (_lines.Count > 0 && pos < _lines.Count)
{
@@ -350,7 +196,7 @@ internal class TextModel
for (var i = 0; i < _lines.Count; i++)
{
- sb.Append (RuneCell.ToString (_lines [i]));
+ sb.Append (Cell.ToString (_lines [i]));
if (i + 1 < _lines.Count)
{
@@ -373,12 +219,12 @@ internal class TextModel
try
{
- RuneCell? cell = RuneAt (col, row);
+ Cell? cell = RuneAt (col, row);
Rune rune;
if (cell is { })
{
- rune = cell.Rune;
+ rune = cell.Value.Rune;
}
else
{
@@ -390,7 +236,7 @@ internal class TextModel
if (col == 0 && row > 0)
{
row--;
- List line = GetLine (row);
+ List line = GetLine (row);
return (line.Count, row);
}
@@ -464,7 +310,7 @@ internal class TextModel
return;
}
- List line = GetLine (nRow);
+ List line = GetLine (nRow);
if (nCol == 0
&& nRow == fromRow
@@ -523,7 +369,7 @@ internal class TextModel
try
{
- Rune rune = RuneAt (col, row).Rune;
+ Rune rune = RuneAt (col, row)!.Value.Rune;
RuneType runeType = GetRuneType (rune);
int lastValidCol = IsSameRuneType (rune, runeType) && (Rune.IsLetterOrDigit (rune) || Rune.IsPunctuation (rune) || Rune.IsSymbol (rune))
@@ -590,7 +436,7 @@ internal class TextModel
return;
}
- List line = GetLine (nRow);
+ List line = GetLine (nRow);
if (nCol == line.Count
&& nRow == fromRow
@@ -630,11 +476,11 @@ internal class TextModel
}
}
- internal static int CalculateLeftColumn (List t, int start, int end, int width, int tabWidth = 0)
+ internal static int CalculateLeftColumn (List t, int start, int end, int width, int tabWidth = 0)
{
List runes = new ();
- foreach (RuneCell cell in t)
+ foreach (Cell cell in t)
{
runes.Add (cell.Rune);
}
@@ -686,7 +532,7 @@ internal class TextModel
}
internal static (int size, int length) DisplaySize (
- List t,
+ List t,
int start = -1,
int end = -1,
bool checkNextRune = true,
@@ -695,7 +541,7 @@ internal class TextModel
{
List runes = new ();
- foreach (RuneCell cell in t)
+ foreach (Cell cell in t)
{
runes.Add (cell.Rune);
}
@@ -856,11 +702,11 @@ internal class TextModel
return foundPos;
}
- internal static int GetColFromX (List t, int start, int x, int tabWidth = 0)
+ internal static int GetColFromX (List t, int start, int x, int tabWidth = 0)
{
List runes = new ();
- foreach (RuneCell cell in t)
+ foreach (Cell cell in t)
{
runes.Add (cell.Rune);
}
@@ -909,7 +755,7 @@ internal class TextModel
for (var i = 0; i < _lines.Count; i++)
{
- List x = _lines [i];
+ List x = _lines [i];
string txt = GetText (x);
string matchText = !matchCase ? text.ToUpper () : text;
int col = txt.IndexOf (matchText);
@@ -935,7 +781,7 @@ internal class TextModel
found = true;
}
- _lines [i] = RuneCell.ToRuneCellList (ReplaceText (x, textToReplace!, matchText, col));
+ _lines [i] = Cell.ToCellList (ReplaceText (x, textToReplace!, matchText, col));
x = _lines [i];
txt = GetText (x);
pos = new (col, i);
@@ -951,9 +797,9 @@ internal class TextModel
}
}
- string GetText (List x)
+ string GetText (List x)
{
- string txt = RuneCell.ToString (x);
+ string txt = Cell.ToString (x);
if (!matchCase)
{
@@ -989,7 +835,7 @@ internal class TextModel
private void Append (List line)
{
var str = StringExtensions.ToString (line.ToArray ());
- _lines.Add (RuneCell.StringToRuneCells (str));
+ _lines.Add (Cell.StringToCells (str));
}
private bool ApplyToFind ((Point current, bool found) foundPos)
@@ -1025,8 +871,8 @@ internal class TextModel
{
for (int i = start.Y; i < linesCount; i++)
{
- List x = _lines [i];
- string txt = RuneCell.ToString (x);
+ List x = _lines [i];
+ string txt = Cell.ToString (x);
if (!matchCase)
{
@@ -1065,8 +911,8 @@ internal class TextModel
{
for (int i = linesCount; i >= 0; i--)
{
- List x = _lines [i];
- string txt = RuneCell.ToString (x);
+ List x = _lines [i];
+ string txt = Cell.ToString (x);
if (!matchCase)
{
@@ -1148,7 +994,7 @@ internal class TextModel
private bool MoveNext (ref int col, ref int row, out Rune rune)
{
- List line = GetLine (row);
+ List line = GetLine (row);
if (col + 1 < line.Count)
{
@@ -1189,7 +1035,7 @@ internal class TextModel
private bool MovePrev (ref int col, ref int row, out Rune rune)
{
- List line = GetLine (row);
+ List line = GetLine (row);
if (col > 0)
{
@@ -1227,9 +1073,9 @@ internal class TextModel
private void OnLinesLoaded () { LinesLoaded?.Invoke (this, EventArgs.Empty); }
- private string ReplaceText (List source, string textToReplace, string matchText, int col)
+ private string ReplaceText (List source, string textToReplace, string matchText, int col)
{
- string origTxt = RuneCell.ToString (source);
+ string origTxt = Cell.ToString (source);
(_, int len) = DisplaySize (source, 0, col, false);
(_, int len2) = DisplaySize (source, col, col + matchText.Length, false);
(_, int len3) = DisplaySize (source, col + matchText.Length, origTxt.GetRuneCount (), false);
@@ -1237,25 +1083,27 @@ internal class TextModel
return origTxt [..len] + textToReplace + origTxt.Substring (len + len2, len3);
}
- private RuneCell RuneAt (int col, int row)
+ private Cell? RuneAt (int col, int row)
{
- List line = GetLine (row);
+ List line = GetLine (row);
if (line.Count > 0)
{
return line [col > line.Count - 1 ? line.Count - 1 : col];
}
- return default (RuneCell)!;
+ return null;
}
- private void SetColorSchemes (ColorScheme? colorScheme)
+ private void SetAttributes (Attribute? attribute)
{
- foreach (List line in _lines)
+ foreach (List line in _lines)
{
- foreach (RuneCell cell in line)
+ for (var i = 0; i < line.Count; i++)
{
- cell.ColorScheme ??= colorScheme;
+ Cell cell = line [i];
+ cell.Attribute ??= attribute;
+ line [i] = cell;
}
}
}
@@ -1286,7 +1134,7 @@ internal partial class HistoryText
public bool HasHistoryChanges => _idxHistoryText > -1;
public bool IsFromHistory { get; private set; }
- public void Add (List> lines, Point curPos, LineStatus lineStatus = LineStatus.Original)
+ public void Add (List> lines, Point curPos, LineStatus lineStatus = LineStatus.Original)
{
if (lineStatus == LineStatus.Original && _historyTextItems.Count > 0 && _historyTextItems.Last ().LineStatus == LineStatus.Original)
{
@@ -1343,7 +1191,7 @@ internal partial class HistoryText
}
}
- public void ReplaceLast (List> lines, Point curPos, LineStatus lineStatus)
+ public void ReplaceLast (List> lines, Point curPos, LineStatus lineStatus)
{
HistoryTextItemEventArgs? found = _historyTextItems.FindLast (x => x.LineStatus == lineStatus);
@@ -1498,9 +1346,9 @@ internal class WordWrapManager
{
int modelRow = GetModelLineFromWrappedLines (row);
int modelCol = GetModelColFromWrappedLines (row, col);
- List line = GetCurrentLine (modelRow);
+ List line = GetCurrentLine (modelRow);
int restCount = line.Count - modelCol;
- List rest = line.GetRange (modelCol, restCount);
+ List rest = line.GetRange (modelCol, restCount);
line.RemoveRange (modelCol, restCount);
Model.AddLine (modelRow + 1, rest);
_isWrapModelRefreshing = true;
@@ -1584,9 +1432,9 @@ internal class WordWrapManager
return modelCol - colWidthOffset;
}
- public bool Insert (int row, int col, RuneCell cell)
+ public bool Insert (int row, int col, Cell cell)
{
- List line = GetCurrentLine (GetModelLineFromWrappedLines (row));
+ List line = GetCurrentLine (GetModelLineFromWrappedLines (row));
line.Insert (GetModelColFromWrappedLines (row, col), cell);
if (line.Count > _frameWidth)
@@ -1600,7 +1448,7 @@ internal class WordWrapManager
public bool RemoveAt (int row, int col)
{
int modelRow = GetModelLineFromWrappedLines (row);
- List line = GetCurrentLine (modelRow);
+ List line = GetCurrentLine (modelRow);
int modelCol = GetModelColFromWrappedLines (row, col);
if (modelCol > line.Count)
@@ -1628,7 +1476,7 @@ internal class WordWrapManager
{
lineRemoved = false;
int modelRow = GetModelLineFromWrappedLines (row);
- List line = GetCurrentLine (modelRow);
+ List line = GetCurrentLine (modelRow);
int modelCol = GetModelColFromWrappedLines (row, col);
if (modelCol == 0 && line.Count == 0)
@@ -1664,7 +1512,7 @@ internal class WordWrapManager
return false;
}
- List nextLine = Model.GetLine (modelRow + 1);
+ List nextLine = Model.GetLine (modelRow + 1);
line.AddRange (nextLine);
Model.RemoveLine (modelRow + 1);
@@ -1680,7 +1528,7 @@ internal class WordWrapManager
return false;
}
- List prevLine = Model.GetLine (modelRow - 1);
+ List prevLine = Model.GetLine (modelRow - 1);
prevLine.AddRange (line);
Model.RemoveLine (modelRow);
@@ -1696,7 +1544,7 @@ internal class WordWrapManager
public bool RemoveRange (int row, int index, int count)
{
int modelRow = GetModelLineFromWrappedLines (row);
- List line = GetCurrentLine (modelRow);
+ List line = GetCurrentLine (modelRow);
int modelCol = GetModelColFromWrappedLines (row, index);
try
@@ -1711,13 +1559,13 @@ internal class WordWrapManager
return true;
}
- public List> ToListRune (List textList)
+ public List> ToListRune (List textList)
{
- List> runesList = new ();
+ List> runesList = new ();
foreach (string text in textList)
{
- runesList.Add (RuneCell.ToRuneCellList (text));
+ runesList.Add (Cell.ToCellList (text));
}
return runesList;
@@ -1789,11 +1637,11 @@ internal class WordWrapManager
for (var i = 0; i < Model.Count; i++)
{
- List line = Model.GetLine (i);
+ List line = Model.GetLine (i);
- List> wrappedLines = ToListRune (
+ List> wrappedLines = ToListRune (
TextFormatter.Format (
- RuneCell.ToString (line),
+ Cell.ToString (line),
width,
Alignment.Start,
true,
@@ -1805,7 +1653,7 @@ internal class WordWrapManager
for (var j = 0; j < wrappedLines.Count; j++)
{
- List wrapLine = wrappedLines [j];
+ List wrapLine = wrappedLines [j];
if (!isRowAndColSet && modelRow == i)
{
@@ -1863,7 +1711,9 @@ internal class WordWrapManager
for (int k = j; k < wrapLine.Count; k++)
{
- wrapLine [k].ColorScheme = line [k].ColorScheme;
+ Cell cell = wrapLine [k];
+ cell.Attribute = line [k].Attribute;
+ wrapLine [k] = cell;
}
wrappedModel.AddLine (lines, wrapLine);
@@ -1883,7 +1733,7 @@ internal class WordWrapManager
return wrappedModel;
}
- private List GetCurrentLine (int row) { return Model.GetLine (row); }
+ private List GetCurrentLine (int row) { return Model.GetLine (row); }
private class WrappedLine
{
@@ -2613,7 +2463,7 @@ public class TextView : View
get => new (CurrentColumn, CurrentRow);
set
{
- List line = _model.GetLine (Math.Max (Math.Min (value.Y, _model.Count - 1), 0));
+ List line = _model.GetLine (Math.Max (Math.Min (value.Y, _model.Count - 1), 0));
CurrentColumn = value.X < 0 ? 0 :
value.X > line.Count ? line.Count : value.X;
@@ -2633,11 +2483,11 @@ public class TextView : View
public bool HasHistoryChanges => _historyText.HasHistoryChanges;
///
- /// If and the current is null will inherit from the
+ /// If and the current is null will inherit from the
/// previous, otherwise if (default) do nothing. If the text is load with
- /// this property is automatically sets to .
+ /// this property is automatically sets to .
///
- public bool InheritsPreviousColorScheme { get; set; }
+ public bool InheritsPreviousAttribute { get; set; }
///
/// Indicates whatever the text was changed or not. if the text was changed
@@ -2758,7 +2608,7 @@ public class TextView : View
get => _selectionStartColumn;
set
{
- List line = _model.GetLine (_selectionStartRow);
+ List line = _model.GetLine (_selectionStartRow);
_selectionStartColumn = value < 0 ? 0 :
value > line.Count ? line.Count : value;
@@ -2915,8 +2765,8 @@ public class TextView : View
}
else
{
- List currentLine = GetCurrentLine ();
- SetClipboard (RuneCell.ToString (currentLine));
+ List currentLine = GetCurrentLine ();
+ SetClipboard (Cell.ToString (currentLine));
_copyWithoutSelection = true;
}
@@ -2978,7 +2828,7 @@ public class TextView : View
ClearSelectedRegion ();
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
_historyText.Add (
new () { new (currentLine) },
@@ -3022,7 +2872,7 @@ public class TextView : View
ClearSelectedRegion ();
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
_historyText.Add (
new () { new (currentLine) },
@@ -3051,19 +2901,19 @@ public class TextView : View
}
/// Invoked when the normal color is drawn.
- public event EventHandler? DrawNormalColor;
+ public event EventHandler? DrawNormalColor;
/// Invoked when the ready only color is drawn.
- public event EventHandler? DrawReadOnlyColor;
+ public event EventHandler? DrawReadOnlyColor;
/// Invoked when the selection color is drawn.
- public event EventHandler? DrawSelectionColor;
+ public event EventHandler? DrawSelectionColor;
///
/// Invoked when the used color is drawn. The Used Color is used to indicate if the
/// was pressed and enabled.
///
- public event EventHandler? DrawUsedColor;
+ public event EventHandler? DrawUsedColor;
/// Find the next text based on the match case with the option to replace it.
/// The text to find.
@@ -3136,19 +2986,19 @@ public class TextView : View
/// Gets all lines of characters.
///
- public List> GetAllLines () { return _model.GetAllLines (); }
+ public List> GetAllLines () { return _model.GetAllLines (); }
///
/// Returns the characters on the current line (where the cursor is positioned). Use
/// to determine the position of the cursor within that line
///
///
- public List GetCurrentLine () { return _model.GetLine (CurrentRow); }
+ public List GetCurrentLine () { return _model.GetLine (CurrentRow); }
/// Returns the characters on the .
/// The intended line.
///
- public List GetLine (int line) { return _model.GetLine (line); }
+ public List GetLine (int line) { return _model.GetLine (line); }
///
public override Attribute GetNormalColor ()
@@ -3231,26 +3081,26 @@ public class TextView : View
UpdateWrapModel ();
}
- /// Loads the contents of the list into the .
+ /// Loads the contents of the list into the .
/// Rune cells list to load the contents from.
- public void Load (List cells)
+ public void Load (List cells)
{
SetWrapModel ();
- _model.LoadRuneCells (cells, ColorScheme);
+ _model.LoadCells (cells, ColorScheme?.Focus);
_historyText.Clear (Text);
ResetPosition ();
SetNeedsDisplay ();
UpdateWrapModel ();
- InheritsPreviousColorScheme = true;
+ InheritsPreviousAttribute = true;
}
- /// Loads the contents of the list of list into the .
+ /// Loads the contents of the list of list into the .
/// List of rune cells list to load the contents from.
- public void Load (List> cellsList)
+ public void Load (List> cellsList)
{
SetWrapModel ();
- InheritsPreviousColorScheme = true;
- _model.LoadListRuneCells (cellsList, ColorScheme);
+ InheritsPreviousAttribute = true;
+ _model.LoadListCells (cellsList, ColorScheme?.Focus);
_historyText.Clear (Text);
ResetPosition ();
SetNeedsDisplay ();
@@ -3347,7 +3197,7 @@ public class TextView : View
}
else if (ev.Flags.HasFlag (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition))
{
- ProcessMouseClick (ev, out List line);
+ ProcessMouseClick (ev, out List line);
PositionCursor ();
if (_model.Count > 0 && _shiftSelecting && Selecting)
@@ -3446,7 +3296,7 @@ public class TextView : View
StopSelecting ();
}
- ProcessMouseClick (ev, out List line);
+ ProcessMouseClick (ev, out List line);
(int col, int row)? newPos;
if (CurrentColumn == line.Count
@@ -3483,7 +3333,7 @@ public class TextView : View
StopSelecting ();
}
- ProcessMouseClick (ev, out List line);
+ ProcessMouseClick (ev, out List line);
CurrentColumn = 0;
if (!Selecting)
@@ -3509,7 +3359,7 @@ public class TextView : View
public void MoveEnd ()
{
CurrentRow = _model.Count - 1;
- List line = GetCurrentLine ();
+ List line = GetCurrentLine ();
CurrentColumn = line.Count;
TrackColumn ();
PositionCursor ();
@@ -3554,7 +3404,7 @@ public class TextView : View
for (int idxRow = _topRow; idxRow < _model.Count; idxRow++)
{
- List line = _model.GetLine (idxRow);
+ List line = _model.GetLine (idxRow);
int lineRuneCount = line.Count;
var col = 0;
@@ -3726,12 +3576,12 @@ public class TextView : View
if (_copyWithoutSelection && contents.FirstOrDefault (x => x == '\n' || x == '\r') == 0)
{
- List runeList = contents is null ? new () : RuneCell.ToRuneCellList (contents);
- List currentLine = GetCurrentLine ();
+ List runeList = contents is null ? new () : Cell.ToCellList (contents);
+ List currentLine = GetCurrentLine ();
_historyText.Add (new () { new (currentLine) }, CursorPosition);
- List> addedLine = new () { new (currentLine), runeList };
+ List> addedLine = new () { new (currentLine), runeList };
_historyText.Add (
new (addedLine),
@@ -3797,7 +3647,7 @@ public class TextView : View
SetNeedsDisplay ();
}
- List line = _model.GetLine (CurrentRow);
+ List line = _model.GetLine (CurrentRow);
var col = 0;
if (line.Count > 0)
@@ -3956,16 +3806,16 @@ public class TextView : View
/// The line.
/// The col index.
/// The row index.
- protected virtual void OnDrawNormalColor (List line, int idxCol, int idxRow)
+ protected virtual void OnDrawNormalColor (List line, int idxCol, int idxRow)
{
(int Row, int Col) unwrappedPos = GetUnwrappedPosition (idxRow, idxCol);
- var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
+ var ev = new CellEventArgs (line, idxCol, unwrappedPos);
DrawNormalColor?.Invoke (this, ev);
- if (line [idxCol].ColorScheme is { })
+ if (line [idxCol].Attribute is { })
{
- ColorScheme? colorScheme = line [idxCol].ColorScheme;
- Driver.SetAttribute (Enabled ? colorScheme!.Focus : colorScheme!.Disabled);
+ Attribute? attribute = line [idxCol].Attribute;
+ Driver.SetAttribute ((Attribute)attribute!);
}
else
{
@@ -3982,22 +3832,22 @@ public class TextView : View
/// The col index.
/// ///
/// The row index.
- protected virtual void OnDrawReadOnlyColor (List line, int idxCol, int idxRow)
+ protected virtual void OnDrawReadOnlyColor (List line, int idxCol, int idxRow)
{
(int Row, int Col) unwrappedPos = GetUnwrappedPosition (idxRow, idxCol);
- var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
+ var ev = new CellEventArgs (line, idxCol, unwrappedPos);
DrawReadOnlyColor?.Invoke (this, ev);
- ColorScheme? colorScheme = line [idxCol].ColorScheme is { } ? line [idxCol].ColorScheme : ColorScheme;
+ Attribute? cellAttribute = line [idxCol].Attribute is { } ? line [idxCol].Attribute : ColorScheme?.Disabled;
Attribute attribute;
- if (colorScheme!.Disabled.Foreground == colorScheme.Focus.Background)
+ if (cellAttribute!.Value.Foreground == cellAttribute.Value.Background)
{
- attribute = new (colorScheme.Focus.Foreground, colorScheme.Focus.Background);
+ attribute = new (cellAttribute.Value.Foreground, cellAttribute.Value.Background);
}
else
{
- attribute = new (colorScheme.Disabled.Foreground, colorScheme.Focus.Background);
+ attribute = new (cellAttribute.Value.Foreground, ColorScheme!.Focus.Background);
}
Driver.SetAttribute (attribute);
@@ -4012,18 +3862,18 @@ public class TextView : View
/// The col index.
/// ///
/// The row index.
- protected virtual void OnDrawSelectionColor (List line, int idxCol, int idxRow)
+ protected virtual void OnDrawSelectionColor (List line, int idxCol, int idxRow)
{
(int Row, int Col) unwrappedPos = GetUnwrappedPosition (idxRow, idxCol);
- var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
+ var ev = new CellEventArgs (line, idxCol, unwrappedPos);
DrawSelectionColor?.Invoke (this, ev);
- if (line [idxCol].ColorScheme is { })
+ if (line [idxCol].Attribute is { })
{
- ColorScheme? colorScheme = line [idxCol].ColorScheme;
+ Attribute? attribute = line [idxCol].Attribute;
Driver.SetAttribute (
- new (colorScheme!.Focus.Background, colorScheme.Focus.Foreground)
+ new (attribute!.Value.Background, attribute.Value.Foreground)
);
}
else
@@ -4046,20 +3896,20 @@ public class TextView : View
/// The col index.
/// ///
/// The row index.
- protected virtual void OnDrawUsedColor (List line, int idxCol, int idxRow)
+ protected virtual void OnDrawUsedColor (List line, int idxCol, int idxRow)
{
(int Row, int Col) unwrappedPos = GetUnwrappedPosition (idxRow, idxCol);
- var ev = new RuneCellEventArgs (line, idxCol, unwrappedPos);
+ var ev = new CellEventArgs (line, idxCol, unwrappedPos);
DrawUsedColor?.Invoke (this, ev);
- if (line [idxCol].ColorScheme is { })
+ if (line [idxCol].Attribute is { })
{
- ColorScheme? colorScheme = line [idxCol].ColorScheme;
- SetValidUsedColor (colorScheme!);
+ Attribute? attribute = line [idxCol].Attribute;
+ SetValidUsedColor (attribute!);
}
else
{
- SetValidUsedColor (ColorScheme);
+ SetValidUsedColor (ColorScheme?.Focus);
}
}
@@ -4072,7 +3922,7 @@ public class TextView : View
private void Adjust ()
{
(int width, int height) offB = OffSetBackground ();
- List line = GetCurrentLine ();
+ List line = GetCurrentLine ();
bool need = NeedsDisplay || _wrapNeeded || !Used;
(int size, int length) tSize = TextModel.DisplaySize (line, -1, -1, false, TabWidth);
(int size, int length) dSize = TextModel.DisplaySize (line, _leftColumn, CurrentColumn, true, TabWidth);
@@ -4234,11 +4084,11 @@ public class TextView : View
var maxrow = (int)(end >> 32);
var startCol = (int)(start & 0xffffffff);
var endCol = (int)(end & 0xffffffff);
- List line = _model.GetLine (startRow);
+ List line = _model.GetLine (startRow);
_historyText.Add (new () { new (line) }, new (startCol, startRow));
- List> removedLines = new ();
+ List> removedLines = new ();
if (startRow == maxrow)
{
@@ -4273,7 +4123,7 @@ public class TextView : View
removedLines.Add (new (line));
line.RemoveRange (startCol, line.Count - startCol);
- List line2 = _model.GetLine (maxrow);
+ List line2 = _model.GetLine (maxrow);
line.AddRange (line2.Skip (endCol));
for (int row = startRow + 1; row <= maxrow; row++)
@@ -4324,7 +4174,7 @@ public class TextView : View
if (CurrentColumn > 0)
{
// Delete backwards
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
_historyText.Add (new () { new (currentLine) }, CursorPosition);
@@ -4364,11 +4214,11 @@ public class TextView : View
}
int prowIdx = CurrentRow - 1;
- List prevRow = _model.GetLine (prowIdx);
+ List prevRow = _model.GetLine (prowIdx);
_historyText.Add (new () { new (prevRow) }, CursorPosition);
- List> removedLines = new () { new (prevRow) };
+ List> removedLines = new () { new (prevRow) };
removedLines.Add (new (GetCurrentLine ()));
@@ -4408,7 +4258,7 @@ public class TextView : View
{
SetWrapModel ();
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
if (CurrentColumn == currentLine.Count)
{
@@ -4421,9 +4271,9 @@ public class TextView : View
_historyText.Add (new () { new (currentLine) }, CursorPosition);
- List> removedLines = new () { new (currentLine) };
+ List> removedLines = new () { new (currentLine) };
- List nextLine = _model.GetLine (CurrentRow + 1);
+ List nextLine = _model.GetLine (CurrentRow + 1);
removedLines.Add (new (nextLine));
@@ -4503,7 +4353,7 @@ public class TextView : View
}
}
- private IEnumerable<(int col, int row, RuneCell rune)> ForwardIterator (int col, int row)
+ private IEnumerable<(int col, int row, Cell rune)> ForwardIterator (int col, int row)
{
if (col < 0 || row < 0)
{
@@ -4515,7 +4365,7 @@ public class TextView : View
yield break;
}
- List line = GetCurrentLine ();
+ List line = GetCurrentLine ();
if (col >= line.Count)
{
@@ -4537,7 +4387,7 @@ public class TextView : View
private void GenerateSuggestions ()
{
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
int cursorPosition = Math.Min (CurrentColumn, currentLine.Count);
Autocomplete.Context = new (
@@ -4613,7 +4463,7 @@ public class TextView : View
var maxrow = (int)(end >> 32);
var startCol = (int)(start & 0xffffffff);
var endCol = (int)(end & 0xffffffff);
- List line = model is null ? _model.GetLine (startRow) : model.GetLine (startRow);
+ List line = model is null ? _model.GetLine (startRow) : model.GetLine (startRow);
if (startRow == maxrow)
{
@@ -4738,9 +4588,9 @@ public class TextView : View
OnContentsChanged ();
}
- private void Insert (RuneCell cell)
+ private void Insert (Cell cell)
{
- List line = GetCurrentLine ();
+ List line = GetCurrentLine ();
if (Used)
{
@@ -4773,7 +4623,7 @@ public class TextView : View
return;
}
- List> lines = RuneCell.StringToLinesOfRuneCells (text);
+ List> lines = Cell.StringToLinesOfCells (text);
if (lines.Count == 0)
{
@@ -4782,7 +4632,7 @@ public class TextView : View
SetWrapModel ();
- List line = GetCurrentLine ();
+ List line = GetCurrentLine ();
_historyText.Add (new () { new (line) }, CursorPosition);
@@ -4821,7 +4671,7 @@ public class TextView : View
return;
}
- List? rest = null;
+ List? rest = null;
var lastp = 0;
if (_model.Count > 0 && line.Count > 0 && !_copyWithoutSelection)
@@ -4837,7 +4687,7 @@ public class TextView : View
//model.AddLine (currentRow, lines [0]);
- List> addedLines = new () { new (line) };
+ List> addedLines = new () { new (line) };
for (var i = 1; i < lines.Count; i++)
{
@@ -4848,7 +4698,7 @@ public class TextView : View
if (rest is { })
{
- List last = _model.GetLine (CurrentRow + lines.Count - 1);
+ List last = _model.GetLine (CurrentRow + lines.Count - 1);
lastp = last.Count;
last.InsertRange (last.Count, rest);
@@ -4872,7 +4722,7 @@ public class TextView : View
OnContentsChanged ();
}
- private bool InsertText (Key a, ColorScheme? colorScheme = null)
+ private bool InsertText (Key a, Attribute? attribute = null)
{
//So that special keys like tab can be processed
if (_isReadOnly)
@@ -4891,7 +4741,7 @@ public class TextView : View
if ((uint)a.KeyCode == '\n')
{
- _model.AddLine (CurrentRow + 1, new ());
+ _model.AddLine (CurrentRow + 1, []);
CurrentRow++;
CurrentColumn = 0;
}
@@ -4903,7 +4753,7 @@ public class TextView : View
{
if (Used)
{
- Insert (new () { Rune = a.AsRune, ColorScheme = colorScheme });
+ Insert (new () { Rune = a.AsRune, Attribute = attribute });
CurrentColumn++;
if (CurrentColumn >= _leftColumn + Viewport.Width)
@@ -4914,7 +4764,7 @@ public class TextView : View
}
else
{
- Insert (new () { Rune = a.AsRune, ColorScheme = colorScheme });
+ Insert (new () { Rune = a.AsRune, Attribute = attribute });
CurrentColumn++;
}
}
@@ -4946,7 +4796,7 @@ public class TextView : View
SetWrapModel ();
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
var setLastWasKill = true;
if (currentLine.Count > 0 && CurrentColumn == currentLine.Count)
@@ -4964,7 +4814,7 @@ public class TextView : View
{
if (CurrentRow < _model.Count - 1)
{
- List> removedLines = new () { new (currentLine) };
+ List> removedLines = new () { new (currentLine) };
_model.RemoveLine (CurrentRow);
@@ -5000,7 +4850,7 @@ public class TextView : View
else
{
int restCount = currentLine.Count - CurrentColumn;
- List rest = currentLine.GetRange (CurrentColumn, restCount);
+ List rest = currentLine.GetRange (CurrentColumn, restCount);
var val = string.Empty;
val += StringFromRunes (rest);
@@ -5045,7 +4895,7 @@ public class TextView : View
SetWrapModel ();
- List currentLine = GetCurrentLine ();
+ List currentLine = GetCurrentLine ();
var setLastWasKill = true;
if (currentLine.Count > 0 && CurrentColumn == 0)
@@ -5088,7 +4938,7 @@ public class TextView : View
CurrentRow--;
currentLine = _model.GetLine (CurrentRow);
- List> removedLine =
+ List> removedLine =
[
[..currentLine],
[]
@@ -5106,7 +4956,7 @@ public class TextView : View
else
{
int restCount = CurrentColumn;
- List rest = currentLine.GetRange (0, restCount);
+ List rest = currentLine.GetRange (0, restCount);
var val = string.Empty;
val += StringFromRunes (rest);
@@ -5146,7 +4996,7 @@ public class TextView : View
SetWrapModel ();
- List currentLine = GetCurrentLine ();
+ List| currentLine = GetCurrentLine ();
_historyText.Add ([ [.. GetCurrentLine ()]], CursorPosition);
@@ -5214,7 +5064,7 @@ public class TextView : View
SetWrapModel ();
- List | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |