diff --git a/frontend/main.cs b/frontend/main.cs index 31b2ad5..95f6209 100644 --- a/frontend/main.cs +++ b/frontend/main.cs @@ -149,10 +149,18 @@ namespace arookas sb.AppendLine(preview); for (var column = 1; column < location.Column; ++column) { - switch (preview[column - 1]) + var c = preview[column - 1]; + if (IsFullWidth(c)) { - case '\t': sb.Append('\t'); break; - default: sb.Append(" "); break; + sb.Append(" "); // full-width hack + } + else if (c == '\t') + { + sb.Append('\t'); + } + else + { + sb.Append(" "); } } sb.Append("^"); @@ -160,6 +168,10 @@ namespace arookas return sb.ToString(); } } + static bool IsFullWidth(char c) + { + return (c >= 0x2E80 && c <= 0x9FFF) || (c >= 0xFF00 && c <= 0xFFEF); + } static void Message(string format, params object[] args) { Console.Write(format, args); } static void Warning(string format, params object[] args)