Przeglądaj źródła

Fixes #2933 - Refactors Cell to simplify code (#2934)

* refactored Cell

* Fixed usings

* Wierd CI/Cd unit test failure. Will this fix?
Tig 1 rok temu
rodzic
commit
21e8a70cee

+ 12 - 12
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -170,12 +170,12 @@ public abstract class ConsoleDriver {
 				// TODO: Remove hard-coded [0] once combining pairs is supported
 
 				// Convert Runes to string and concatenate
-				string combined = Contents [Row, Col - 1].Runes [0].ToString () + rune.ToString ();
+				string combined = Contents [Row, Col - 1].Rune.ToString () + rune.ToString ();
 
 				// Normalize to Form C (Canonical Composition)
 				string normalized = combined.Normalize (NormalizationForm.FormC);
 
-				Contents [Row, Col - 1].Runes = new List<Rune> { (Rune)normalized [0] }; ;
+				Contents [Row, Col - 1].Rune = (Rune)normalized [0]; ;
 				Contents [Row, Col - 1].Attribute = CurrentAttribute;
 				Contents [Row, Col - 1].IsDirty = true;
 
@@ -186,19 +186,19 @@ public abstract class ConsoleDriver {
 
 				if (Col > 0) {
 					// Check if cell to left has a wide glyph
-					if (Contents [Row, Col - 1].Runes [0].GetColumns () > 1) {
+					if (Contents [Row, Col - 1].Rune.GetColumns () > 1) {
 						// Invalidate cell to left
-						Contents [Row, Col - 1].Runes = new List<Rune> { Rune.ReplacementChar };
+						Contents [Row, Col - 1].Rune = Rune.ReplacementChar;
 						Contents [Row, Col - 1].IsDirty = true;
 					}
 				}
 
 
 				if (runeWidth < 1) {
-					Contents [Row, Col].Runes = new List<Rune> { Rune.ReplacementChar };
+					Contents [Row, Col].Rune = Rune.ReplacementChar;
 
 				} else if (runeWidth == 1) {
-					Contents [Row, Col].Runes = new List<Rune> { rune };
+					Contents [Row, Col].Rune = rune;
 					if (Col < Clip.Right - 1) {
 						Contents [Row, Col + 1].IsDirty = true;
 					}
@@ -206,19 +206,19 @@ public abstract class ConsoleDriver {
 					if (Col == Clip.Right - 1) {
 						// We're at the right edge of the clip, so we can't display a wide character.
 						// TODO: Figure out if it is better to show a replacement character or ' '
-						Contents [Row, Col].Runes = new List<Rune> { Rune.ReplacementChar };
+						Contents [Row, Col].Rune = Rune.ReplacementChar;
 					} else {
-						Contents [Row, Col].Runes = new List<Rune> { rune };
+						Contents [Row, Col].Rune = rune;
 						if (Col < Clip.Right - 1) {
 							// 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].Runes = new List<Rune> { Rune.ReplacementChar };
+							Contents [Row, Col + 1].Rune = Rune.ReplacementChar;
 							Contents [Row, Col + 1].IsDirty = true;
 						}
 					}
 				} else {
 					// This is a non-spacing character, so we don't need to do anything
-					Contents [Row, Col].Runes = new List<Rune> { (Rune)' ' };
+					Contents [Row, Col].Rune = (Rune)' ';
 					Contents [Row, Col].IsDirty = false;
 				}
 				_dirtyLines [Row] = true;
@@ -239,7 +239,7 @@ public abstract class ConsoleDriver {
 				Contents [Row, Col].Attribute = CurrentAttribute;
 
 				// TODO: Determine if we should wipe this out (for now now)
-				//Contents [Row, Col].Runes [0] = (Rune)' ';
+				//Contents [Row, Col].Rune = (Rune)' ';
 			}
 			Col++;
 		}
@@ -346,7 +346,7 @@ public abstract class ConsoleDriver {
 				for (var row = 0; row < Rows; row++) {
 					for (var c = 0; c < Cols; c++) {
 						Contents [row, c] = new Cell () {
-							Runes = new List<Rune> { (Rune)' ' },
+							Rune = (Rune)' ',
 							Attribute = new Attribute (Color.White, Color.Black),
 							IsDirty = true
 						};

+ 1 - 1
Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs

@@ -309,7 +309,7 @@ internal class CursesDriver : ConsoleDriver {
 				}
 				Curses.attrset (Contents [row, col].Attribute.GetValueOrDefault ().PlatformColor);
 
-				var rune = Contents [row, col].Runes [0];
+				var rune = Contents [row, col].Rune;
 				if (rune.IsBmp) {
 					// BUGBUG: CursesDriver doesn't render CharMap correctly for wide chars (and other Unicode) - Curses is doing something funky with glyphs that report GetColums() of 1 yet are rendered wide. E.g. 0x2064 (invisible times) is reported as 1 column but is rendered as 2. WindowsDriver & NetDriver correctly render this as 1 column, overlapping the next cell.
 					if (rune.GetColumns () < 2) {

+ 1 - 1
Terminal.Gui/ConsoleDrivers/FakeDriver/FakeDriver.cs

@@ -133,7 +133,7 @@ public class FakeDriver : ConsoleDriver {
 						FakeConsole.BackgroundColor = (ConsoleColor)attr.Background.ColorName;
 					}
 					outputWidth++;
-					var rune = (Rune)Contents [row, col].Runes [0];
+					var rune = (Rune)Contents [row, col].Rune;
 					output.Append (rune.ToString ());
 					if (rune.IsSurrogatePair () && rune.GetColumns () < 2) {
 						WriteToConsole (output, ref lastCol, row, ref outputWidth);

+ 1 - 1
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -808,7 +808,7 @@ internal class NetDriver : ConsoleDriver {
 
 					}
 					outputWidth++;
-					var rune = (Rune)Contents [row, col].Runes [0];
+					var rune = (Rune)Contents [row, col].Rune;
 					output.Append (rune.ToString ());
 					if (rune.IsSurrogatePair () && rune.GetColumns () < 2) {
 						WriteToConsole (output, ref lastCol, row, ref outputWidth);

+ 3 - 3
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1546,12 +1546,12 @@ internal class WindowsDriver : ConsoleDriver {
 					continue;
 				}
 				_outputBuffer [position].Empty = false;
-				if (Contents [row, col].Runes [0].IsBmp) {
-					_outputBuffer [position].Char = (char)Contents [row, col].Runes [0].Value;
+				if (Contents [row, col].Rune.IsBmp) {
+					_outputBuffer [position].Char = (char)Contents [row, col].Rune.Value;
 				} else {
 					//_outputBuffer [position].Empty = true;
 					_outputBuffer [position].Char = (char)Rune.ReplacementChar.Value;
-					if (Contents [row, col].Runes [0].GetColumns () > 1 && col + 1 < Cols) {
+					if (Contents [row, col].Rune.GetColumns () > 1 && col + 1 < Cols) {
 						// TODO: This is a hack to deal with non-BMP and wide characters.
 						col++;
 						position = row * Cols + col;

+ 13 - 4
Terminal.Gui/Drawing/Cell.cs

@@ -10,11 +10,20 @@ namespace Terminal.Gui;
 /// </summary>
 public class Cell {
 	/// <summary>
-	/// The list of Runes to draw in this cell. If the list is empty, the cell is blank. If the list contains
-	/// more than one Rune, the cell is a combining sequence.
-	/// (See #2616 - Support combining sequences that don't normalize)
+	/// The character to display. If <see cref="Rune"/> is <see langword="null"/>, then <see cref="Rune"/> is ignored.
 	/// </summary>
-	public List<Rune> Runes { get; set; } = new List<Rune> ();
+	public Rune Rune { get; set; }
+
+	// TODO: Uncomment this once combining sequences that could not be normalized are supported.
+	///// <summary>
+	///// The combining mark for <see cref="Rune"/> that when combined makes this Cell a combining sequence that could
+	///// not be normalized to a single Rune.
+	///// If <see cref="CombiningMark"/> is <see langword="null"/>, then <see cref="CombiningMark"/> is ignored.
+	///// </summary>
+	///// <remarks>
+	///// Only valid in the rare case where <see cref="Rune"/> is a combining sequence that could not be normalized to a single Rune.
+	///// </remarks>
+	//internal Rune CombiningMark { get; set; }
 
 	/// <summary>
 	/// The attributes to use when drawing the Glyph.

+ 1 - 1
Terminal.Gui/Drawing/LineCanvas.cs

@@ -556,7 +556,7 @@ namespace Terminal.Gui {
 			var cell = new Cell ();
 			var rune = GetRuneForIntersects (driver, intersects);
 			if (rune.HasValue) {
-				cell.Runes.Add (rune.Value);
+				cell.Rune = rune.Value;
 			}
 			cell.Attribute = GetAttributeForIntersects (intersects);
 			return cell;

+ 2 - 2
Terminal.Gui/View/ViewDrawing.cs

@@ -389,7 +389,7 @@ namespace Terminal.Gui {
 					Driver.SetAttribute (p.Value.Attribute ?? ColorScheme.Normal);
 					Driver.Move (p.Key.X, p.Key.Y);
 					// TODO: #2616 - Support combining sequences that don't normalize
-					Driver.AddRune (p.Value.Runes [0]);
+					Driver.AddRune (p.Value.Rune);
 				}
 				LineCanvas.Clear ();
 			}
@@ -405,7 +405,7 @@ namespace Terminal.Gui {
 					Driver.SetAttribute (p.Value.Attribute ?? ColorScheme.Normal);
 					Driver.Move (p.Key.X, p.Key.Y);
 					// TODO: #2616 - Support combining sequences that don't normalize
-					Driver.AddRune (p.Value.Runes [0]);
+					Driver.AddRune (p.Value.Rune);
 				}
 				LineCanvas.Clear ();
 			}

+ 20 - 20
Terminal.Gui/Views/Slider.cs

@@ -656,12 +656,12 @@ public class Slider<T> : View {
 	{
 		switch (_config._sliderOrientation) {
 		case Orientation.Horizontal:
-			_style.SpaceChar = new Cell () { Runes = { CM.Glyphs.HLine } }; // '─'
-			_style.OptionChar = new Cell () { Runes = { CM.Glyphs.BlackCircle } }; // '┼●🗹□⏹'
+			_style.SpaceChar = new Cell () { Rune = CM.Glyphs.HLine }; // '─'
+			_style.OptionChar = new Cell () { Rune = CM.Glyphs.BlackCircle }; // '┼●🗹□⏹'
 			break;
 		case Orientation.Vertical:
-			_style.SpaceChar = new Cell () { Runes = { CM.Glyphs.VLine } };
-			_style.OptionChar = new Cell () { Runes = { CM.Glyphs.BlackCircle } };
+			_style.SpaceChar = new Cell () { Rune = CM.Glyphs.VLine };
+			_style.OptionChar = new Cell () { Rune = CM.Glyphs.BlackCircle };
 			break;
 		}
 
@@ -685,12 +685,12 @@ public class Slider<T> : View {
 		*/
 
 		_config._legendsOrientation = _config._sliderOrientation;
-		_style.EmptyChar = new Cell () { Runes = { new Rune (' ') } };
-		_style.SetChar = new Cell () { Runes = { CM.Glyphs.ContinuousMeterSegment } }; // ■
-		_style.RangeChar = new Cell () { Runes = { CM.Glyphs.Stipple } }; // ░ ▒ ▓   // Medium shade not blinking on curses.
-		_style.StartRangeChar = new Cell () { Runes = { CM.Glyphs.ContinuousMeterSegment } };
-		_style.EndRangeChar = new Cell () { Runes = { CM.Glyphs.ContinuousMeterSegment } };
-		_style.DragChar = new Cell () { Runes = { CM.Glyphs.Diamond } };
+		_style.EmptyChar = new Cell () { Rune = new Rune (' ') };
+		_style.SetChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment }; // ■
+		_style.RangeChar = new Cell () { Rune = CM.Glyphs.Stipple }; // ░ ▒ ▓   // Medium shade not blinking on curses.
+		_style.StartRangeChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
+		_style.EndRangeChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
+		_style.DragChar = new Cell () { Rune = CM.Glyphs.Diamond };
 
 		// TODO: Support left & right (top/bottom)
 		// First = '├',
@@ -972,7 +972,7 @@ public class Slider<T> : View {
 		}
 
 		if (_dragPosition.HasValue && _moveRenderPosition.HasValue) {
-			AddRune (_moveRenderPosition.Value.X, _moveRenderPosition.Value.Y, _style.DragChar.Runes [0]);
+			AddRune (_moveRenderPosition.Value.X, _moveRenderPosition.Value.Y, _style.DragChar.Rune);
 		}
 	}
 
@@ -1033,7 +1033,7 @@ public class Slider<T> : View {
 		if (_config._showSpacing && _config._startSpacing > 0) {
 
 			Driver.SetAttribute (isSet && _config._type == SliderType.LeftRange ? _style.RangeChar.Attribute ?? normalScheme : _style.SpaceChar.Attribute ?? normalScheme);
-			var rune = isSet && _config._type == SliderType.LeftRange ? _style.RangeChar.Runes [0] : _style.SpaceChar.Runes [0];
+			var rune = isSet && _config._type == SliderType.LeftRange ? _style.RangeChar.Rune : _style.SpaceChar.Rune;
 
 			for (var i = 0; i < this._config._startSpacing; i++) {
 				MoveAndAdd (x, y, rune);
@@ -1043,7 +1043,7 @@ public class Slider<T> : View {
 			Driver.SetAttribute (_style.EmptyChar.Attribute ?? normalScheme);
 			// for (int i = 0; i < this.config.StartSpacing + ((this.config.StartSpacing + this.config.EndSpacing) % 2 == 0 ? 1 : 2); i++) {
 			for (var i = 0; i < this._config._startSpacing; i++) {
-				MoveAndAdd (x, y, _style.EmptyChar.Runes [0]);
+				MoveAndAdd (x, y, _style.EmptyChar.Rune);
 				if (isVertical) y++; else x++;
 			}
 		}
@@ -1086,14 +1086,14 @@ public class Slider<T> : View {
 				//		Driver.SetAttribute (ColorScheme.Focus);
 				//	}
 				//}
-				Rune rune = drawRange ? _style.RangeChar.Runes [0] : _style.OptionChar.Runes [0];
+				Rune rune = drawRange ? _style.RangeChar.Rune : _style.OptionChar.Rune;
 				if (isSet) {
 					if (_setOptions [0] == i) {
-						rune = _style.StartRangeChar.Runes [0];
+						rune = _style.StartRangeChar.Rune;
 					} else if (_setOptions.Count > 1 && _setOptions [1] == i) {
-						rune = _style.EndRangeChar.Runes [0];
+						rune = _style.EndRangeChar.Rune;
 					} else if (_setOptions.Contains (i)) {
-						rune = _style.SetChar.Runes [0];
+						rune = _style.SetChar.Rune;
 					}
 				}
 				MoveAndAdd (x, y, rune);
@@ -1103,7 +1103,7 @@ public class Slider<T> : View {
 				if (_config._showSpacing || i < _options.Count - 1) { // Skip if is the Last Spacing.
 					Driver.SetAttribute (drawRange && isSet ? _style.RangeChar.Attribute ?? setScheme : _style.SpaceChar.Attribute ?? normalScheme);
 					for (var s = 0; s < _config._innerSpacing; s++) {
-						MoveAndAdd (x, y, drawRange && isSet ? _style.RangeChar.Runes [0] : _style.SpaceChar.Runes [0]);
+						MoveAndAdd (x, y, drawRange && isSet ? _style.RangeChar.Rune : _style.SpaceChar.Rune);
 						if (isVertical) y++; else x++;
 					}
 				}
@@ -1114,7 +1114,7 @@ public class Slider<T> : View {
 		// Right Spacing
 		if (_config._showSpacing) {
 			Driver.SetAttribute (isSet && _config._type == SliderType.RightRange ? _style.RangeChar.Attribute ?? normalScheme : _style.SpaceChar.Attribute ?? normalScheme);
-			var rune = isSet && _config._type == SliderType.RightRange ? _style.RangeChar.Runes [0] : _style.SpaceChar.Runes [0];
+			var rune = isSet && _config._type == SliderType.RightRange ? _style.RangeChar.Rune : _style.SpaceChar.Rune;
 			for (var i = 0; i < remaining; i++) {
 				MoveAndAdd (x, y, rune);
 				if (isVertical) y++; else x++;
@@ -1122,7 +1122,7 @@ public class Slider<T> : View {
 		} else {
 			Driver.SetAttribute (_style.EmptyChar.Attribute ?? normalScheme);
 			for (var i = 0; i < remaining; i++) {
-				MoveAndAdd (x, y, _style.EmptyChar.Runes [0]);
+				MoveAndAdd (x, y, _style.EmptyChar.Rune);
 				if (isVertical) y++; else x++;
 			}
 		}

+ 1 - 1
UICatalog/Scenarios/LineDrawing.cs

@@ -143,7 +143,7 @@ namespace UICatalog.Scenarios {
 					foreach (var c in canvas.GetCellMap ()) {
 						Driver.SetAttribute (c.Value.Attribute ?? ColorScheme.Normal);
 						// TODO: #2616 - Support combining sequences that don't normalize
-						this.AddRune (c.Key.X, c.Key.Y, c.Value.Runes [0]);
+						this.AddRune (c.Key.X, c.Key.Y, c.Value.Rune);
 					}
 				}
 			}

+ 8 - 8
UICatalog/Scenarios/Sliders.cs

@@ -125,7 +125,7 @@ public class Sliders : Scenario {
 					s.AdjustBestHeight ();
 					s.Width = Dim.Percent (50);
 
-					s.Style.SpaceChar = new Cell () { Runes = { CM.Glyphs.HLine } };
+					s.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.HLine };
 
 					if (prev == null) {
 						s.LayoutStyle = LayoutStyle.Absolute;
@@ -143,7 +143,7 @@ public class Sliders : Scenario {
 					s.AdjustBestWidth ();
 					s.Height = Dim.Fill ();
 
-					s.Style.SpaceChar = new Cell () { Runes = { CM.Glyphs.VLine } };
+					s.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.VLine };
 
 
 					if (prev == null) {
@@ -292,15 +292,15 @@ public class Sliders : Scenario {
 
 		single.LayoutStarted += (s, e) => {
 			if (single.Orientation == Orientation.Horizontal) {
-				single.Style.SpaceChar = new Cell () { Runes = { CM.Glyphs.HLine } };
-				single.Style.OptionChar = new Cell () { Runes = { CM.Glyphs.HLine } };
+				single.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.HLine };
+				single.Style.OptionChar = new Cell () { Rune = CM.Glyphs.HLine };
 			} else {
-				single.Style.SpaceChar = new Cell () { Runes = { CM.Glyphs.VLine } };
-				single.Style.OptionChar = new Cell () { Runes = { CM.Glyphs.VLine } };
+				single.Style.SpaceChar = new Cell () { Rune = CM.Glyphs.VLine };
+				single.Style.OptionChar = new Cell () { Rune = CM.Glyphs.VLine };
 			}
 		};
-		single.Style.SetChar = new Cell () { Runes = { CM.Glyphs.ContinuousMeterSegment } };
-		single.Style.DragChar = new Cell () { Runes = { CM.Glyphs.ContinuousMeterSegment } };
+		single.Style.SetChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
+		single.Style.DragChar = new Cell () { Rune = CM.Glyphs.ContinuousMeterSegment };
 
 		v.Add (single);
 

+ 1 - 1
UnitTests/Application/ApplicationTests.cs

@@ -434,7 +434,7 @@ public class ApplicationTests {
 		Application.Shutdown ();
 
 		var task = TaskWithAsyncContinuation ();
-		Thread.Sleep (20);
+		Thread.Sleep (100);
 		Assert.True (task.IsCompletedSuccessfully);
 	}
 

+ 16 - 16
UnitTests/ConsoleDrivers/AddRuneTests.cs

@@ -23,7 +23,7 @@ public class AddRuneTests {
 		driver.Init ();
 
 		driver.AddRune (new Rune ('a'));
-		Assert.Equal ((Rune)'a', driver.Contents [0, 0].Runes [0]);
+		Assert.Equal ((Rune)'a', driver.Contents [0, 0].Rune);
 
 		driver.End ();
 		Application.Shutdown ();
@@ -41,7 +41,7 @@ public class AddRuneTests {
 
 		for (var col = 0; col < driver.Cols; col++) {
 			for (var row = 0; row < driver.Rows; row++) {
-				Assert.Equal ((Rune)' ', driver.Contents [row, col].Runes [0]);
+				Assert.Equal ((Rune)' ', driver.Contents [row, col].Rune);
 			}
 		}
 
@@ -57,12 +57,12 @@ public class AddRuneTests {
 		driver.Init ();
 
 		driver.AddRune ('a');
-		Assert.Equal ((Rune)'a', driver.Contents [0, 0].Runes [0]);
+		Assert.Equal ((Rune)'a', driver.Contents [0, 0].Rune);
 		Assert.Equal (0, driver.Row);
 		Assert.Equal (1, driver.Col);
 
 		driver.AddRune ('b');
-		Assert.Equal ((Rune)'b', driver.Contents [0, 1].Runes [0]);
+		Assert.Equal ((Rune)'b', driver.Contents [0, 1].Rune);
 		Assert.Equal (0, driver.Row);
 		Assert.Equal (2, driver.Col);
 
@@ -74,7 +74,7 @@ public class AddRuneTests {
 
 		// Add a rune to the last column of the first row; should increment the row or col even though it's now invalid
 		driver.AddRune ('c');
-		Assert.Equal ((Rune)'c', driver.Contents [0, lastCol].Runes [0]);
+		Assert.Equal ((Rune)'c', driver.Contents [0, lastCol].Rune);
 		Assert.Equal (lastCol + 1, driver.Col);
 
 		// Add a rune; should succeed but do nothing as it's outside of Contents
@@ -82,7 +82,7 @@ public class AddRuneTests {
 		Assert.Equal (lastCol + 2, driver.Col);
 		for (var col = 0; col < driver.Cols; col++) {
 			for (var row = 0; row < driver.Rows; row++) {
-				Assert.NotEqual ((Rune)'d', driver.Contents [row, col].Runes [0]);
+				Assert.NotEqual ((Rune)'d', driver.Contents [row, col].Rune);
 			}
 		}
 
@@ -104,12 +104,12 @@ public class AddRuneTests {
 		Assert.Equal (2, rune.GetColumns ());
 
 		driver.AddRune (rune);
-		Assert.Equal (rune, driver.Contents [0, 0].Runes [0]);
+		Assert.Equal (rune, driver.Contents [0, 0].Rune);
 		Assert.Equal (0, driver.Row);
 		Assert.Equal (2, driver.Col);
 
 		//driver.AddRune ('b');
-		//Assert.Equal ((Rune)'b', driver.Contents [0, 1].Runes [0]);
+		//Assert.Equal ((Rune)'b', driver.Contents [0, 1].Rune);
 		//Assert.Equal (0, driver.Row);
 		//Assert.Equal (2, driver.Col);
 
@@ -121,7 +121,7 @@ public class AddRuneTests {
 
 		//// Add a rune to the last column of the first row; should increment the row or col even though it's now invalid
 		//driver.AddRune ('c');
-		//Assert.Equal ((Rune)'c', driver.Contents [0, lastCol].Runes [0]);
+		//Assert.Equal ((Rune)'c', driver.Contents [0, lastCol].Rune);
 		//Assert.Equal (lastCol + 1, driver.Col);
 
 		//// Add a rune; should succeed but do nothing as it's outside of Contents
@@ -129,7 +129,7 @@ public class AddRuneTests {
 		//Assert.Equal (lastCol + 2, driver.Col);
 		//for (var col = 0; col < driver.Cols; col++) {
 		//	for (var row = 0; row < driver.Rows; row++) {
-		//		Assert.NotEqual ((Rune)'d', driver.Contents [row, col].Runes [0]);
+		//		Assert.NotEqual ((Rune)'d', driver.Contents [row, col].Rune);
 		//	}
 		//}
 
@@ -149,24 +149,24 @@ public class AddRuneTests {
 
 		var text = "\u1eaf";
 		driver.AddStr (text);
-		Assert.Equal (expected, driver.Contents [0, 0].Runes [0]);
-		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Runes [0]);
+		Assert.Equal (expected, driver.Contents [0, 0].Rune);
+		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Rune);
 
 		driver.ClearContents ();
 		driver.Move (0, 0);
 
 		text = "\u0103\u0301";
 		driver.AddStr (text);
-		Assert.Equal (expected, driver.Contents [0, 0].Runes [0]);
-		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Runes [0]);
+		Assert.Equal (expected, driver.Contents [0, 0].Rune);
+		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Rune);
 
 		driver.ClearContents ();
 		driver.Move (0, 0);
 
 		text = "\u0061\u0306\u0301";
 		driver.AddStr (text);
-		Assert.Equal (expected, driver.Contents [0, 0].Runes [0]);
-		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Runes [0]);
+		Assert.Equal (expected, driver.Contents [0, 0].Rune);
+		Assert.Equal ((Rune)' ', driver.Contents [0, 1].Rune);
 
 		//		var s = "a\u0301\u0300\u0306";
 

+ 8 - 8
UnitTests/ConsoleDrivers/ClipRegionTests.cs

@@ -91,24 +91,24 @@ namespace Terminal.Gui.DriverTests {
 
 			driver.Move (0, 0);
 			driver.AddRune ('x');
-			Assert.Equal ((Rune)'x', driver.Contents [0, 0].Runes [0]);
+			Assert.Equal ((Rune)'x', driver.Contents [0, 0].Rune);
 
 			driver.Move (5, 5);
 			driver.AddRune ('x');
-			Assert.Equal ((Rune)'x', driver.Contents [5, 5].Runes [0]);
+			Assert.Equal ((Rune)'x', driver.Contents [5, 5].Rune);
 
 			// Clear the contents
 			driver.FillRect (new Rect (0, 0, driver.Rows, driver.Cols), ' ');
-			Assert.Equal ((Rune)' ', driver.Contents [0, 0].Runes [0]);
+			Assert.Equal ((Rune)' ', driver.Contents [0, 0].Rune);
 
 			// Setup the region with a single rectangle, fill screen with 'x'
 			driver.Clip = new Rect (5, 5, 5, 5);
 			driver.FillRect (new Rect (0, 0, driver.Rows, driver.Cols), 'x');
-			Assert.Equal ((Rune)' ', driver.Contents [0, 0].Runes [0]);
-			Assert.Equal ((Rune)' ', driver.Contents [4, 9].Runes [0]);
-			Assert.Equal ((Rune)'x', driver.Contents [5, 5].Runes [0]);
-			Assert.Equal ((Rune)'x', driver.Contents [9, 9].Runes [0]);
-			Assert.Equal ((Rune)' ', driver.Contents [10, 10].Runes [0]);
+			Assert.Equal ((Rune)' ', driver.Contents [0, 0].Rune);
+			Assert.Equal ((Rune)' ', driver.Contents [4, 9].Rune);
+			Assert.Equal ((Rune)'x', driver.Contents [5, 5].Rune);
+			Assert.Equal ((Rune)'x', driver.Contents [9, 9].Rune);
+			Assert.Equal ((Rune)' ', driver.Contents [10, 10].Rune);
 
 			Application.Shutdown ();
 		}

+ 2 - 2
UnitTests/TestHelpers.cs

@@ -159,7 +159,7 @@ partial class TestHelpers {
 		for (int r = 0; r < driver.Rows; r++) {
 			for (int c = 0; c < driver.Cols; c++) {
 				// TODO: Remove hard-coded [0] once combining pairs is supported
-				Rune rune = contents [r, c].Runes [0];
+				Rune rune = contents [r, c].Rune;
 				if (rune.DecodeSurrogatePair (out char [] spair)) {
 					sb.Append (spair);
 				} else {
@@ -214,7 +214,7 @@ partial class TestHelpers {
 			var runes = new List<Rune> ();
 			for (var c = 0; c < driver.Cols; c++) {
 				// TODO: Remove hard-coded [0] once combining pairs is supported
-				Rune rune = contents [r, c].Runes [0];
+				Rune rune = contents [r, c].Rune;
 				if (rune != (Rune)' ') {
 					if (x == -1) {
 						x = c;

+ 1 - 1
UnitTests/View/Layout/LayoutTests.cs

@@ -586,7 +586,7 @@ Y
 			{
 				var text = "";
 				for (int i = 0; i < 4; i++) {
-					text += Application.Driver.Contents [0, i].Runes [0];
+					text += Application.Driver.Contents [0, i].Rune;
 				}
 				return text;
 			}

+ 6 - 6
UnitTests/View/ViewTests.cs

@@ -466,11 +466,11 @@ namespace Terminal.Gui.ViewTests {
 				Application.Begin (Application.Top);
 
 				// should have the initial text
-				Assert.Equal ((Rune)'t', driver.Contents [0, 0].Runes [0]);
-				Assert.Equal ((Rune)'e', driver.Contents [0, 1].Runes [0]);
-				Assert.Equal ((Rune)'s', driver.Contents [0, 2].Runes [0]);
-				Assert.Equal ((Rune)'t', driver.Contents [0, 3].Runes [0]);
-				Assert.Equal ((Rune)' ', driver.Contents [0, 4].Runes [0]);
+				Assert.Equal ((Rune)'t', driver.Contents [0, 0].Rune);
+				Assert.Equal ((Rune)'e', driver.Contents [0, 1].Rune);
+				Assert.Equal ((Rune)'s', driver.Contents [0, 2].Rune);
+				Assert.Equal ((Rune)'t', driver.Contents [0, 3].Rune);
+				Assert.Equal ((Rune)' ', driver.Contents [0, 4].Rune);
 			} finally {
 				Application.Shutdown ();
 			}
@@ -612,7 +612,7 @@ namespace Terminal.Gui.ViewTests {
 
 				for (int i = 0; i < Application.Driver.Rows; i++) {
 					for (int j = 0; j < Application.Driver.Cols; j++) {
-						if (contents [i, j].Runes[0] != (Rune)' ') {
+						if (contents [i, j].Rune != (Rune)' ') {
 							runesCount++;
 						}
 					}

+ 1 - 1
UnitTests/Views/ListViewTests.cs

@@ -240,7 +240,7 @@ namespace Terminal.Gui.ViewsTests {
 			{
 				var item = "";
 				for (int i = 0; i < 7; i++) {
-					item += Application.Driver.Contents [line, i].Runes[0];
+					item += Application.Driver.Contents [line, i].Rune;
 				}
 				return item;
 			}

Plik diff jest za duży
+ 570 - 570
UnitTests/Views/ProgressBarTests.cs


+ 1 - 1
UnitTests/Views/TextFieldTests.cs

@@ -1137,7 +1137,7 @@ namespace Terminal.Gui.ViewsTests {
 			{
 				var item = "";
 				for (int i = 0; i < 16; i++) {
-					item += Application.Driver.Contents [0, i].Runes [0];
+					item += Application.Driver.Contents [0, i].Rune;
 				}
 				return item;
 			}

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików