Cell.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections.Generic;
  2. using System.Text;
  3. namespace Terminal.Gui;
  4. /// <summary>
  5. /// Represents a single row/column in a Terminal.Gui rendering surface
  6. /// (e.g. <see cref="LineCanvas"/> and <see cref="ConsoleDriver"/>).
  7. /// </summary>
  8. public class Cell {
  9. Rune _rune;
  10. /// <summary>
  11. /// The character to display. If <see cref="Rune"/> is <see langword="null"/>, then <see cref="Rune"/> is ignored.
  12. /// </summary>
  13. public Rune Rune {
  14. get => _rune;
  15. set {
  16. CombiningMarks.Clear ();
  17. _rune = value;
  18. }
  19. }
  20. /// <summary>
  21. /// The combining marks for <see cref="Rune"/> that when combined makes this Cell a combining sequence.
  22. /// If <see cref="CombiningMarks"/> empty, then <see cref="CombiningMarks"/> is ignored.
  23. /// </summary>
  24. /// <remarks>
  25. /// Only valid in the rare case where <see cref="Rune"/> is a combining sequence that could not be normalized to a single Rune.
  26. /// </remarks>
  27. internal List<Rune> CombiningMarks { get; } = new List<Rune> ();
  28. /// <summary>
  29. /// The attributes to use when drawing the Glyph.
  30. /// </summary>
  31. public Attribute? Attribute { get; set; }
  32. /// <summary>
  33. /// Gets or sets a value indicating whether this <see cref="T:Terminal.Gui.Cell"/> has
  34. /// been modified since the last time it was drawn.
  35. /// </summary>
  36. public bool IsDirty { get; set; }
  37. /// <inheritdoc />
  38. public override string ToString () => $"[{Rune}, {Attribute}]";
  39. }