Menu

#47 Macro Templates don't work correctly on Unicode source files

Closed
closed-fixed
None
5
2017-07-20
2017-07-16
No

Expanding of macro templates creates a mess in the code area where the template is expanded if (and only if) the file has non-ASCII characters above the line of code where you try to expand the macro template.

This is true since Gexperts v1.38 stable. Up to and including v1.38Beta1 all was fine.

Bug Details:
The bug is reproducible 100% of the time
The bug occurs on multiple machines

Steps:

  1. Start Delphi XE2 from the start menu
  2. Create new VCL forms application
    3a. Include a const with non ascii characters in the interface section
    OR
    3b. Include a comment with non-ASCII characters in the interface section
  3. Create a forms method like FormCreate()
  4. line of code ShowMessage('TEST')
  5. select that line of code and expand the begin macro template

--> code is messed up

The more non-ascii chars there are in your code above your cursor position where you expand the macro template the more messy the resulting code is.

reported by Philip von Melle

Discussion

  • Thomas Mueller

    Thomas Mueller - 2017-07-16

    Yet another Unicode vs. byte offsets issue.

     
  • Thomas Mueller

    Thomas Mueller - 2017-07-20

    Das "begin"-Makro funktioniert nach meinen Tests nun einwandfrei (dabei markiere ich
    immer ganze Zeilen).

    Ein Makro, das ich selber hinzugefügt habe und sehr oft benutze ist "(%SELECTION%)". Da
    kommt es zu merkwürdigen Resultaten, z.T. auch ohne Umlaute im Quelltext:

    Neue VCL forms application, OnCreateMessage des Forms, Code:

    ShowMessageTEST

    TEST markieren und Makro (%SELECTION%) ausführen. Dann landet "(TEST)" vor (!)
    ShowMessage. Wenn ich in ShowMessage'TEST' den substring 'TEST' markiere, dann
    klappt es. Zu wieder anderen Resultaten kommt es, wenn ich in ShowMessage'TEST' nur
    TEST markiere.

    reported by Philip von Melle

     
    • Thomas Mueller

      Thomas Mueller - 2017-07-20

      Should now work again.

       
      • Thomas Mueller

        Thomas Mueller - 2017-07-29

        While the above worked, there was still an issue if the selected text did not match the macro name. Fixed now.

         

Log in to post a comment.

MongoDB Logo MongoDB