mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Sorta fixed vertical. Broke wide runes
This commit is contained in:
@@ -304,6 +304,7 @@ public class TextFormatter
|
||||
{
|
||||
if (isVertical)
|
||||
{
|
||||
// BUGBUG: This works with a very limited set of wide-char scenarios.
|
||||
int runesWidth = runes.Length == 0 ? 0 : runes.Max (r => GetRuneWidth (r, TabWidth));
|
||||
x = screen.Left + (screen.Width - _lines.Count - 1) + (runesWidth + line);
|
||||
CursorPosition = screen.Width - runesWidth + (_hotKeyPos > -1 ? _hotKeyPos : 0);
|
||||
@@ -319,8 +320,11 @@ public class TextFormatter
|
||||
{
|
||||
if (isVertical)
|
||||
{
|
||||
int runesWidth = runes.Length == 0 ? 0 : runes.Max (r => GetRuneWidth (r, TabWidth));
|
||||
x = screen.Left + runesWidth + line - 1;
|
||||
// BUGBUG: This works only if a) all lines have only single-wide chars and b) only one line has wide chars
|
||||
int runesWidth = line > 0
|
||||
? GetColumnsRequiredForVerticalText (linesFormatted, 0, line, TabWidth)
|
||||
: 0;
|
||||
x = screen.Left + runesWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -333,8 +337,9 @@ public class TextFormatter
|
||||
{
|
||||
if (isVertical)
|
||||
{
|
||||
int runesWidth = runes.Length == 0 ? 0 : runes.Max (r => GetRuneWidth (r, TabWidth));
|
||||
x = screen.Left + (screen.Width / 2) - (_lines.Count / 2) + (runesWidth + line - 1);
|
||||
// BUGBUG: This works with a very limited set of wide-char scenarios.
|
||||
int runesWidth = GetColumnsRequiredForVerticalText (linesFormatted, tabWidth: TabWidth);
|
||||
x = screen.Left + line + (screen.Width - runesWidth) / 2;
|
||||
|
||||
CursorPosition = (screen.Width - runesWidth) / 2 + (_hotKeyPos > -1 ? _hotKeyPos : 0);
|
||||
}
|
||||
|
||||
@@ -3482,7 +3482,7 @@ ssb
|
||||
[InlineData ("A", 2, false, "A")]
|
||||
[InlineData ("AB12", 5, false, "AB12")]
|
||||
[InlineData ("AB\n12", 5, false, "A1\nB2")]
|
||||
[InlineData ("デモエ", 1, false, "")]
|
||||
[InlineData ("", 1, false, "")]
|
||||
|
||||
public void Draw_Vertical_TopBottom_LeftRight (string text, int width, bool autoSize, string expectedText)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user