-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextModel.ToRuneCellList is internal and is better move it to the public RuneCell class. #3774
Comments
Moving this from #3773 (comment)
|
I don't think |
I agree. What about |
@tznind or anyone interested can you please suggest a good name for |
ColoredRune is fine. Only others i thought of were: ColorSchemedRune And I think those are strictly worse |
I agree 😄 But thanks any way for your great help. If @tig agree with |
Add support for colored runes in the |
Someday we'll have Bold, etc as attributes in addition to color. Remind me again why this "cell" is different than 'Cell'? |
Great.
I don't remember, sincerely. Maybe because I wanted to use |
I encourage you to think through two things and be able to have clarity:
Thanks. |
I see what you mean. I'll use the Cell and move the methods to the Cell record. Then I'll remove the RuneCell class. Maybe it'll work. Thanks. |
@tig I really try and did all what I said and I end up with the bellow image. The reason to the unsuccess is because the |
Is there a reason we made it struct? Can't we just make it a class. It seems like there are many cases where you might want to be able to edit a Cell e.g. events etc. |
I don't know why it's a |
I already found the issue. Although public record struct Cell (Attribute? Attribute = null, bool IsDirty = false, Rune Rune = default)
{
/// <summary>The attributes to use when drawing the Glyph.</summary>
public Attribute? Attribute { get; set; } = Attribute;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="T:Terminal.Gui.Cell"/> has been modified since the
/// last time it was drawn.
/// </summary>
public bool IsDirty { get; set; } = IsDirty;
private Rune _rune = Rune;
/// <summary>The character to display. If <see cref="Rune"/> is <see langword="null"/>, then <see cref="Rune"/> is ignored.</summary>
public Rune Rune
{
get => _rune;
set
{
CombiningMarks?.Clear ();
_rune = value;
}
}
/// <summary>
/// The combining marks for <see cref="Rune"/> that when combined makes this Cell a combining sequence. If
/// <see cref="CombiningMarks"/> empty, then <see cref="CombiningMarks"/> 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 List<Rune> CombiningMarks { get; } = [];
/// <inheritdoc/>
public override string ToString () { return $"[{Rune}, {Attribute}]"; }
} Now the |
Final version. When Rune is changed the public record struct Cell (Attribute? Attribute = null, bool IsDirty = false, Rune Rune = default)
{
/// <summary>The attributes to use when drawing the Glyph.</summary>
public Attribute? Attribute { get; set; } = Attribute;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="T:Terminal.Gui.Cell"/> has been modified since the
/// last time it was drawn.
/// </summary>
public bool IsDirty { get; set; } = IsDirty;
private Rune _rune = Rune;
/// <summary>The character to display. If <see cref="Rune"/> is <see langword="null"/>, then <see cref="Rune"/> is ignored.</summary>
public Rune Rune
{
get => _rune;
set
{
CombiningMarks.Clear ();
_rune = value;
}
}
private List<Rune> _combiningMarks;
/// <summary>
/// The combining marks for <see cref="Rune"/> that when combined makes this Cell a combining sequence. If
/// <see cref="CombiningMarks"/> empty, then <see cref="CombiningMarks"/> 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 List<Rune> CombiningMarks
{
get => _combiningMarks ?? [];
private set => _combiningMarks = value ?? [];
}
/// <inheritdoc/>
public override string ToString () { return $"[{Rune}, {Attribute}]"; }
} Some observations about Advantages:
Disadvantages:
|
It can be moved to the public
RuneCell
class where it can be more useful for others users views that want to use it.Originally posted by @BDisp in #3773 (comment)
The text was updated successfully, but these errors were encountered: