-
Notifications
You must be signed in to change notification settings - Fork 702
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
Cell
needs much deeper thought to truly support Unicode
#2933
Comments
I agree.
I've doubt about because I think that can have more than 2 runes. So I suggest to make this as follow in case of doubt. |
I've researched this. There are no known examples of unicode codepoints where there will be more than one combining mark. Regardless, in the current PR public List<Rune> CombiningMarks { get; set; } = new List<Rune> (); |
@tig thinking better this change will have complicate more than before because when you replace the previous column with the normalized rune list, now you have to deal with the new property |
Without say you broke all my idea about this. You could wait to merge first and do the change later. |
Yes, this will complicate If you have an alternative solution, I'm all ears, but only if it does not make library user's code more complex. |
Cell
needs much deeper thoughtCell
needs much deeper thought to truly support Unicode
Why don't we (or you?) somewhat combine both of your proposals/ideas? the result would look something like this: /// <summary>
/// Represents a single row/column in a Terminal.Gui rendering surface
/// (e.g. <see cref="LineCanvas"/> and <see cref="ConsoleDriver"/>).
/// </summary>
public class Cell
{
/// <summary>
/// The character to display. If <see cref="Rune"/> is <see langword="null"/>, then <see cref="Rune"/> is ignored.
/// </summary>
/// <remarks>
/// Stores and reads from <see cref="Runes"/>[0]
/// </remarks>
public Rune Rune { get; set; } // { get => Runes[0]; set => {Runes[0] = value}; }
/// <summary>
/// The list where the Runes are stored.
/// </summary>
/// <remarks>
/// Could be made internal, but keeping this public prevents older apps from breaking as long as they operate within the lists size limit.
/// </remarks>
public List<Rune> Runes { get; set; } // = new List<Rune>(2){null, null} // Limits List size to two Items. Can be mmade larger if required, but may help detect faulty code that else would result in improperly drawn cells
/// <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. Stores and reads from <see cref="Runes"/>[1]
/// </remarks>
public Rune CombiningMark { get; set; } // { get => Runes[1]; set => {Runes[1] = value}; }
/// <summary>
/// The attributes to use when drawing the Glyph.
/// </summary>
public Attribute? Attribute { get; set; }
/// <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; }
}
} Effectively, |
@tig already did the PR #2934, which is well done. |
Isn't |
Right. |
But rune doesn't support combining unicode characters? |
Yes, support. The reason for puts them on another property is because they should not occupy another column but the same as the Rune. Edit: |
That makes sense. |
On the v1 that is done on the override |
I started down the path of experimenting with the other Curses APIs for wide-chars to try to figure out what the heck Curses is doing, but decided to focus on Windows first. I'm still experimenting with how to do all this right on Windows. I think a key to getting Curses working right is to use APIs other than https://linux.die.net/man/3/curs_add_wch I really do not like the current architecture of the Curses driver. It was clearly hacked together by Miguel back in the day and has some really suspect code. I hope to significantly simplify and modernize it and I'd rather not spend any more energy trying to hack the current code to work. For example, this is just nuts: Note TrueColor doesn't work yet either. |
This is super-relevant and super-cool: A new Unicode Terminal Complex Script Support, or TCSS proposal |
I hate the design I came up with for this for v2:
It forces simple code to do
cell.Runes[0]
which makes code hard to read.I propose changing this to:
When so, all code that currently does
cell.Runes[0]
will becomecell.Rune
.Only ConsoleDriver will need to use
CombiningMark
(see #2932)See #2939
The text was updated successfully, but these errors were encountered: