#504 HTML mode: Fix mode properties in <script> blocks.

None
closed-accepted
Dale Anson
None
5
2014-02-15
2013-07-13
Marc Häfner
No
0 up votes | 0 down votes | 0%
13 comments

Fix #3614631 by delegating to script modes, instead of just importing their rules.

The indentation rules for the script mode are only applied if (real) delegation is used. (Some relevant code can be found in JEditBuffer.getIndentRules)

This patch also shortens and simplifies the file nicely, but for the price of reintroducing a corner-case bug: Closing </script> tags may be consumed by script comments, which is inconsistent with the XML plugin and most browsers.

Given that it seems impossible to fix this (in a mode file) while using (real) delegation, I'd say that having correct script mode properties is preferable to not having this bug.

(Thanks to Matthieu Casanova for pointing in the right direction.)

Discussion

<< < 1 2 (Page 2 of 2)
  • funa take
    funa take
    2013-12-13

    It looks good to me.
    Thank you.

     
  • Marc Häfner
    Marc Häfner
    2013-12-16

    Version 3 doesn't really solve the problem of script-comments consuming html-tags. If I understand TokenMarker etc. correctly (and testing seems to confirm that) one can either:

    • use <IMPORT DELEGATE=... /> to be able to "override" the offending EOL_SPANs. This imports the rules into the current rule set. But it does not import any mode properties (the original issue for this ticket)

    • use real delegation (i.e. DELEGATE on SEQ or SPAN), where we get the (original) RuleSet with the appropriate modeName and thus the correct mode properties. But it seems impossible to somehow inject rules into another mode / rule set.

    But version 3 fixes the delegate issue nicely. (Sorry for the oversight and thanks for testing.) I attached a version 4 which includes only those changes from V3.

     
    Last edit: Marc Häfner 2013-12-27
    Attachments
  • Dale Anson
    Dale Anson
    2014-02-15

    Applied version 4 in svn revision 23418, this patch fixes several other bugs in the html mode. Thanks, Marc!

     
  • Dale Anson
    Dale Anson
    2014-02-15

    • status: open --> closed-accepted
    • Group: -->
     
<< < 1 2 (Page 2 of 2)