Hans-Peter Diettrich <[email protected]> hat am 17. November 2011 um 09:33
geschrieben:

> In forms.IsAccel I suspect an bug, which manifests in very rare cases only:
>
>    position := UTF8Pos(AmpersandChar, ACaption);
> This is the position of the &
>
> ...
>
>        UTF8Delete(ACaption, 1, position+1);
>
> This IMO removes the character *after* the ampersand 
Yes, which is another ampersand (&&). So it deletes both ampersands. 
 
 

>, so that>
>        position := UTF8Pos(AmpersandChar, ACaption);
>
> finds the same & over and over again, while it should find the next one. 
Have you tested it? It looks correct to me. 
 
 

>
>
> Now for some questionable constructs:
>
> A simple Pos would be sufficient, because '&' is an ASCII character. 
Yes. The whole UTF8 in there unneeded, except for the comparison of the one
character with the VK. 
 

>
> It would be sufficient to replace the found '&' by something else, in place.
>
> Or a loop until the last char could be used, which eliminates any string
> time and memory consuming string manipulation. 
Feel free to provide a patch.
 
 
Mattias
 
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to