This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ada/6726: -gnaty miscounts characters in UTF-8 source text


>State-Changed-From-To: open->closed
[...]
>    The line length limitation of -gnaty switch is intended to make sure that all lines fit on a regular terminal screen, so that the source can be viewed without problems on all screens. Another issue is that not all wide characters necessarily are the same width: many Asian fixed-spacing terminal fonts use double-width characters for certain glyphs.

You've stated the problems involved in getting this to work completely right.
What about actually fixing the bug in some way? You could

* Drop in a wcwidth implementation. Markus Kuhn has a wcwidth implementation
in a page or two of code.

* Just calling all non-ASCII Unicode characters single width or double 
width. It's a better approximation then the triple width, which most 
UTF-8 characters are counted as and which is never actually true.

* Disabling character counts for lines on which non-ASCII characters appear,
possibly with a warning. It's ugly, and the warning is probably overkill,
but it works.

* Documenting it would be a good start. The current documentation says

If the ^letter m^word LINE_LENGTH^ appears in the string after @option{-gnaty}
then the length of source lines must not exceed 79 characters, including
any trailing blanks. The value of 79 allows convenient display on an
80 character wide device or window, allowing for possible special
treatment of 80 character lines.

If you chose to interpret this as a documentation error instead of a
code error, then so be it. But it's clearly one or the other or both.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]