Enhance UDL lexer

  • Hi, @eko-palypse, and All,

    I noticed something really weird, regarding styling. This happens, whatever your script version !

    If the Word wrap option is ON and that you’re looking at some code of an UDL language, if this code is near the top editor window, one of the new stylings, produced by the script, may disappear if you zoom in, at least, 9 times on Ctrl + + and other stylings, if any, may also disappear if you go on zooming in, till the maximum !

    Note that scrolling this part of code, downwards, makes styling(s) to be present, again !

    Eko, can you reproduce that issue ? May be, it could be because of my weak Win XP configuration ?

    This happens for code, let’s say, on the first or second visible lines and only if the Word wrap is set ? When the Word wrap option is unset, script stylings seem permanent, as expected ;-))



  • Hi @guy038,

    thanks again for testing and yes I can confirm, this happens for me as well.
    The reason why this happens is that editor.getFirstVisibleLine returns
    an incorrect line. Example: with normal zoom the first visible line might be 7.
    But when zooming in and without scrolling the document, at some point
    getFirstVisibleLine returns suddenly 8 and the maximum I got was 141.
    141 got returned when choosing the maximum zoom level and reducing the
    document width so that only the first column was visible.
    I have to check scintilla documentation but I can’t remember that there is
    an method for this purpose available.

    Unfortunately, while investigating this behavior I found another feature.
    When using both views and having a UDL document open in each of them
    then only the document with the focus does get styled. Could be explained
    as the ui update callback is handled on the current active window only but what it
    makes it worse is the following situation.

    Les’s assume you are working in one of the two documents and you click into
    the other and now you decide to scroll the first document without
    activating/clicking into it you won’t see any styling for the new scrolling in text.
    Can also be explained by the current design but isn’t nice …
    I guess it have to go back to the drawing board.

  • I have all files zipped.
    I will now test the last template.

  • @Gerald-Kirchner

    am I correct to say that the line /* block comment in one line, forbidden */
    should be colored?
    If so, then you have to remove style 1 from excluded style list, like
    excluded_styles = [2, 16, 17, 18, 19, 20, 21, 22, 23]

  • I have 2 removed. 1 is line style.

  • Ich schreibe jetzt einfach mal auf Deutsch, da müssen die anderen durch. :-)
    Ich hoffe ich liege dabei auch richtig.

    Die exclusion Liste soll dafür dienen, RegexMatches in Bereichen welche bereits von
    anderen Styles genutzt werden zu ignorieren.
    In Ihrem Fall wollen Sie aber genau hier ansetzen, da diese Art von CommentBlock
    wohl falsch ist, daher muß Style 1 herausgenommen werden damit der Match auch
    farblich dargestellt wird.
    Ich hoffe ich habe mich einigermaßen deutlich ausgedrückt.

  • Dann mal auf Deutsch. Das fällt mir leichter :-)
    Ja, es funktioniert mit weglassen der 1. Auch mit der Vorlage aus /enhance-udl-lexer/7.
    Aber ich begreife nicht warum.
    Definition of which area should not be styled
    übersetze ich mit
    Festlegung, welcher Bereich nicht gestaltet werden soll
    comment line style is ; <-- der soll so bleiben
    comment style is /* */ <-- den will ich ändern

    <Keywords name="Comments">00; 01 02 03/* 04*/</Keywords>

  • Das fällt mir leichter :-)

    Mir ebenfalls und erspart den Umweg über DeepL.com :-)

    Ich verstehe die Verwirrung. Eigentlich ist es genauso gedacht.
    Zum Beispiel: Sie suchen nach Wörter die meinetwegen auf $ enden aber nur dann
    wenn sie nicht in einem Kommentarfeld sind. Dann macht die exclusion Liste diesen Filter. Da das Wort in einem Kommentarfeld gefunden wurde und entweder Style1 der 2
    benutzt würde der Match ignoriert.
    Bei Ihnen ist der Anwendungsfall nun gerade umgekehrt. Sie wollen die Zeilen finden,
    welche den Style 1 benutzt aber fehlerhaft geschrieben wurde, da nur in einer Zeile
    und nicht wie vorgesehen über mehrere Zeilen. Nun darf die exclusion Liste diesen Style nicht mehr enthalten damit dies auch farblich dargestellt wird.

  • Nach der Definition

    Definition of which area should not be styled
    1 = comment line style
    2 = comment style

    will ich aber genau die 2 bearbeiten. Und nicht die 1.
    Kann es sein, das die Definition eventuell mit 0 beginnt und bei mir deshalb die 1 als “comment style” passt?
    In welcher Quelle findet man diese Zuweisung?

  • Der Source Code zu UDL ist hier einzusehen.

    Aber das Problem liegt bei mir.
    Ich habe comment style id und comment line style id verwechselt.
    Es muß genau anders herum sein

    1 = comment style
    2 = comment line style

    Sorry, verdameleite …

  • English, anyone?

    Normally I wouldn’t complain, except Chrome right-click Translate to English failed on this.

  • @Ekopalypse

    I’d say the burden is on posters to post in English, not others to translate later. (AFAIK, the accepted language of this forum in English.)

  • @Alan-Kilborn

    Manager summary :-)

    I failed at the documentation by stating that comment style is using id 2 and
    comment line style is using 1 whereas it is exactly the opposite.

  • @Alan-Kilborn

    (AFAIK, the accepted language of this forum in English.)

    maybe one accepted language as we see more often :-)

  • But thanks, @Alan-Kilborn,

    Chrome used to be my backup browser, but I’ve recently switched to it being my primary, and I didn’t know there was an easy RClick>Translate option in Chrome. When I ran it on the German on this page, it translated okay for me. (Which is good, because my 2 years of highschool German from more than a quarter-century ago just didn’t cut it.)

    But I do agree that the forum’s default language is English, and if people want help here, they should at least provide the translation for us. I understand that some of the posters might be more comfortable (or equally comfortable) in German; and it’s fine for someone fluent in German to answer in German; but also provide a translation to English, so the other people who read this thread – both for those who have started to help, and got lost when it switched language; and for those who come here searching for a solution to a similar problem, and find that the actual answer is buried in another language, when it started in English.

  • In the source code I find the place where the numbers are assigned or do not arise.
    I would like to find that to be able to understand it.
    Then the template would have to be adjusted.

  • Ok, :-D

    the outcome of the discussion is that I need to post another version of the script
    which hopefully adresses @guy038 findings as well,

    So dear future reader,
    if you have read until here - forget about everything you read and hope that you will find
    a new version of the script as another post after this one.

  • @Ekopalypse

    omg … you are german speaking … that’s the last thing i would have expected … your name sounded so apocalyptically greek 😉

  • @Gerald-Kirchner

    starting from line 266.

Log in to reply