Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions NStack/strings/ustring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,8 @@ public ustring RuneSubstring (int runeStart, int length = 0)
public int RuneCount => Utf8.RuneCount (this);

/// <summary>
/// Returns the number of columns used by the unicode string on console applications. This is done by calling the Rune.ColumnWidth on each rune.
/// Returns the number of columns used by the unicode string on console applications.
/// This is done by calling the Rune.ColumnWidth or zero, if it's negative, on each rune.
/// </summary>
public int ConsoleWidth {
get {
Expand All @@ -1065,7 +1066,7 @@ public int ConsoleWidth {
for (int i = 0; i < blen;) {
(var rune, var size) = Utf8.DecodeRune (this, i, i - blen);
i += size;
total += Rune.ColumnWidth (rune);
total += Math.Max (Rune.ColumnWidth (rune), 0);
}
return total;
}
Expand Down
Loading