[Bug c++/88501] Improve suggested alternative to be closer to typo
jg at jguk dot org
gcc-bugzilla@gcc.gnu.org
Mon Dec 17 15:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88501
--- Comment #5 from Jonny Grant <jg at jguk dot org> ---
(In reply to Jonathan Wakely from comment #4)
[..]
> > "st!ing"
>
> ! is a single byte in UTF-8
Fair enough. Just my idea below.
How about converting those two utf8 bytes, to a marker one byte, to help the
suggestion at least? (although it still needs to get past the identifier
parser stopping at "st"
if(utf8_found)
{
convert_utf8_to_to_char(inbuf, outbuf);
suggest_alternative(outbuf);
}
else
{
suggest_alternative(inbuf);
}
in this case, inbuf would contain "st£ing" and be 7bytes+NUL and outbuf would
contain "str!ing" 6 bytes+NUL, that way, when it was compared, it would
correctly propose an identifier that was also 6 characters long
More information about the Gcc-bugs
mailing list