Cell.cs 1.4 KB

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