• Remarks Bug?

    2
    0 Votes
    2 Posts
    209 Views
    PeterJonesP

    @Zaidy036,

    The batch-file lexer is part of the scintilla-component library, which is a separate project whose source code gets embedded
    in the projects that include that library. Per the Sctintilla source code included in Notepad++, LexBatch.cxx line 92,
    “// Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
    According to the wayback
    for that linked article,

    What’s a “fake label?” Commonly, it’s two (or more) colons at the start of a line. The first colon makes it a label, but DOS doesn’t know what to do with the second colon, so it simply abandons the line and moves on, at high speed.

    ? So, you can, if you wish, substitute “::” for REM in your batch files

    Thus, using :: as a pseudo-REM comment is making use of the fact that any invalid label-line is ignored and processed quickly

    The official GOTO docs are very specific:

    The label within the batch program must begin with a colon (:). If a line begins with a colon, it is treated as a label and any commands on that line are ignored.

    Note, both those docs specific “start of a line” or “line begins”. After some other command and the & command separator is not the beginning of a line.

    It’s not a comment (or event a “fake label”) after another command. Technically, it’s not even a comment at the beginning of a line. The fact that the lexer treats :: as a comment-start in any situation is just a concession to how abuses of a language can become considered “features” with enough people abusing it.

    Whether you think that it’s a bug, or whether you think the compromise that the Scintilla authors used is reasonable (my camp), or whether you think that the Scintilla authors should have never allowed for the abuse of the technical batch-file definition is, however, irrelevant. The Notepad++ project takes the source code for the Scintilla component wholesale from Scintilla. If you want a change in the built-in batch-file parser, you will have to check the Scintilla bug list and feature tracker; then, if you can convince the Scintilla team to incorporate your bug-fix or improvement, and an updated Scintilla version is released, you can then create a Notepad++ issue to request that Notepad++ update its Scintilla version. That process may take a while, especially if you have to try to convince the Scintilla side that your use of “fake label after ampersand is still a comment” should be implemented.

    In the mean time, since your batch files are obviously using that syntax successfully, regardless of the Sctinilla-team’s opinion, you can add extra highlighting to a builtin lexer (like the batch-file lexer) using regexes, via the script EnhanceAnyBuiltinLexer.py that @Ekopalypse shares in this linked post. That would allow you to define a regex like (?-s)\&\h*\K::.*$ that could be used to add highlighting for that circumstance (the regex might need to be tweaked to handle all your variations for ampersands and spacing; I haven’t tested it in the script; might need to check if the match-reset \K works in the python regex (I forget), or whether you’ll have to use some other lookbehind mechanism for that).

  • Run As Administrator.

    4
    0 Votes
    4 Posts
    514 Views
    EkopalypseE

    You would, for example, use runas.

    In run menu, you would call cmd /k runas /user:YOUR_NAME@YOUR_HOST PROGRAM_TO_EXECUTE

    Once everything works as expected, you can substitute /k with /c and
    the cmd shell gets closed automatically.

  • UDL: A folding problem.

    12
    1 Votes
    12 Posts
    1k Views
    UltiMaxKomU

    @Alan-Kilborn I’m sorry to inform you, but your new dick-evaluation (For the LOL) result came in just an hour ago, and it’s was marked as “Not dick-enough”. Along with that, the carcinogenic tube test of yours proved to be even more downgraded from the tier of “Lethal”, to just “Toxic”. You might want to improve them by trying the upgraded insult technique that you can learn from your skill tree.
    ⠀⠀⠀So try it, use the [Super Insult] move, and overcharge it beyond the eleven. The Dickindex says that it’s very effective against the type of new membermon like the one you’re facing right now.
    ⠀⠀⠀I really recommend you to increase your stats by leveling up through the dickin’ route. Many speedrunners used this specific strat.

    ⠀⠀⠀By the way, you haven’t responded to my apology. I would really like to be forgiven for all my sins that I’ve done to you. I hope you would accept it. Anywise, thank you in advance.



    Best regards,
    Professor Fool.

  • Disconnect on save with latest NppFTP

    2
    0 Votes
    2 Posts
    582 Views
    CrêpoC

    I’ve solved my own problem. It looks like a weird bug. I had the hostname set to username@hostname, so somehow I was connected to username@username@hostname which apparently works fine but something goes wrong when you save.

    Please don’t ask how I managed this.

  • Mark line in all files

    4
    0 Votes
    4 Posts
    1k Views
    Gary SmithG

    @Alan-Kilborn

    Tanks Alan, that was a great suggestion.

    With each line being a hyperlink it got a bit messy in the end but managed to comment out each line so it no longer appeared :)

    Thanks again

  • "no to all" for dialog box that opens dozens of times

    2
    2 Votes
    2 Posts
    301 Views
    Alan KilbornA

    @meiskam

    There has been a recent effort to add No to All to certain sections of the UI (N++ 7.8 and above I believe).
    Perhaps this is one area where it hasn’t been applied.
    In this case you can probably result to the trick of holding down the n key to close all the popups.
    If you hold down too long (likely) and get a bunch of nnnnnnn in your document that gets focus when all the non-existent files have gone away, a simple Undo (ctrl+z) should clean those n up.

  • Number line style

    5
    1 Votes
    5 Posts
    321 Views
    montserrat civitM

    @Ekopalypse
    oh, yes!
    I’ve just removed it! Now it’s ok
    Thank you

  • Very difficult find and replace in glossary

    7
    0 Votes
    7 Posts
    416 Views
    guy038G

    Hello, @scott-smith-0, @peterjones and All,

    Just a clarification about greedy and lazy quantifiers :

    Imagine the following regex, using the free-spacing mode for a better readability :

    (?x) \w+? ABC test ABC

    You may think that we must use the lazy quantifier +?, in order to get the first occurrence of the string ABC. But, it’s a common mistake of reasoning !

    Indeed, in fact, the regex are looking for the shortest range of word characters, followed with the string ABCtestABC

    Easy to prove :

    Against the text XYZ 12345ABCtestABCdefghiABCtestABCjklmn the regex \w+?ABCtestABC does match the string 12345ABCtestABC, whereas the regex \w+ABCtestABC matches the string 12345ABCtestABCdefghiABCtestABC. Given this subject text, the difference between the two kinds of quantifiers is obvious !

    Now, against the shorter text XYZ 12345ABCtestABCdefghi, as there is only 1 occurrence of the string ABCtestABC, you don’t have to bother about lazy vs greedy quantifiers ! Both, the regexes \w+?ABCtestABC and \w+ABCtestABC will match the same string 12345ABCtestABC

    Of course, had we used the simple regexes \w+?ABC and \w+?ABC, the matched strings would have been quite distinct !

    Now, let’s imagine :

    The subject text XYZ 12345" display="defghi, where I replaced the two strings ABC with a double-quote " and the word test with <sp>display=

    The regex \w+?" display="

    In this specific case, there an additional reason why the lazy quantifier is useless ;-))

    Indeed, if you think, wrongly, at first sight, that this quantifier is needed in order to get the first " symbol, it could not match a further bunch of chars as, both, the double-quote and the following space character are not word characters, anyway !

    Just try the two regexes \w+?" display=" and \w+" display=", against the following text :

    XYZ 12345" display=“defghi” display="jklmn

    In both cases, the matched string is just 12345" display="

    Best Regards,

    guy038

    Reminder : for correct tests, replace any and quoting characters with a classic double-quote char " ( \x{0022} )

  • Search result export

    3
    0 Votes
    3 Posts
    2k Views
    Alan KilbornA

    It isn’t directly possible.

    You might be best off using the marking feature of Notepad++ (Search > Mark…) and then supplementing that with a Pythonscript to copy that text to the clipboard; see here. But that only handles a single file at a time; some people want that extended to multiple files, see here.

    In theory you could do some of the things discussed here…or rather, currently just hinted at…because some of those ideas are currently evolving. ;-)

    Sadly, no solution for you, just pointers to possible workarounds. :-(

  • Function list

    1
    1 Votes
    1 Posts
    172 Views
    No one has replied
  • Save found files?

    26
    0 Votes
    26 Posts
    3k Views
    EkopalypseE

    @Alan-Kilborn

    Not a big burden, only the “print” line for that…

    and the encode is not needed as py2 returns bytes
    as well as the b before the “%p”.

    But…What’s your magic behind f_editor?

    Nothing, this is just my object which represents the editor in the find in files window.
    As you said, what you would have expected must be done on your side.

  • Prefix folding keywords

    2
    0 Votes
    2 Posts
    213 Views
    EkopalypseE

    @Hein-Mulder

    if you use it in folding in code 2 style (separators needed) then it shouldn’t happen.

  • Viewing Find/Search results...

    9
    0 Votes
    9 Posts
    5k Views
    PeterJonesP

    @Vasile-Caraus,

    See my PS in your thread about your issue.

  • How to "show/display the results of what I replaced" ?

    5
    0 Votes
    5 Posts
    603 Views
    PeterJonesP

    In another thread, rather than here, @Vasile-Caraus said in Viewing Find/Search results...:

    you should include this feature (such as a console) in a plugin as NppExec. Because I want to see what exactly did I “Replace”, and if I have to perform an undo before saving.

    If you have a new feature you’d like to request, please see this FAQ for instructions on how to do that.

    PS: If you want more discussion on your issue, please do so in the thread you started, or other active threads. Re-awakening another thread that has been completed for 2.5 years, when the only commonality between that thread and your issue are the words “find/search”, is considered poor forum etiquette (here or in any other forum I’ve been involved in). It’s fine to re-open a thread that’s actually related to the issue you’re having, but in this case, wanting to see a list of all the lines changed by a replace function is a completely different topic than was being discussed in that “Viewing Find/Search results...” thread.

  • Blank sheet is printed on dark background themes

    4
    0 Votes
    4 Posts
    1k Views
    marwinM

    @Alan-Kilborn
    i don’t know why i didn’t found the Print-Settings, shame on me. The setting “Black on white” is the one that works for me.

    Thank You

  • how to show line in hex

    4
    0 Votes
    4 Posts
    1k Views
    PeterJonesP

    @andrecool-68 ,

    Oh, right, I forgot that the Converter plugin came with the ASCII->HEX command. Since Plugins > Converter comes by default with Notepad++, that’s definitely the best solution.

  • Where do I find the UDL I'm looking for?

    9
    0 Votes
    9 Posts
    1k Views
    PeterJonesP

    No, those are ones distributed with Notepad++ itself. We don’t really want every submitted UDL to be automatically distributed with Notepad++.

  • How do I "replace all" in columnar selection?

    10
    0 Votes
    10 Posts
    1k Views
    guy038G

    Hi, All,

    I even found out a shorter syntax, both in the search and replacement parts !

    So, the generic regex to use would be :

    SEARCH (?-s)(()|^.{Co-1}\K\x20*)(?=Ch)

    REPLACE ?2\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20

    As the Ch character is the = sign and should be located at position Co = 23, we get the exact regex syntax :

    SEARCH (?-s)(()|^.{22}\K\x20*)(?==)

    REPLACE ?2\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20

    Notes :

    Beware that the empty group 2 (), before the alternation symbol |, is needed !!

    If the 1st alternative is chosen, the regex engine looks for an empty string, only if followed with an = sign

    In replacement, this empty string is replaced with the range of space characters, as group 2 exists

    If the 2nd alternative is chosen, the regex engine looks for a range of space characters, beginning at position 23, but only if followed with an = sign

    In replacement, this non-wanted range of space characters are simply deleted, as group 2 does not exist

    Cheers,

    guy038

  • -1 Votes
    14 Posts
    1k Views
    Vasile CarausV

    @guy038 said in Loop or "batch command" - Search and Replace (especially regex) , in order to run multiple times the operation:

    (?-si)(?<=<p class=“best”>)\K\h*|\G((?!</p>).)*?\K(\h+(?=</p>)|\h\K\h+)

    now, this is the best solution ! Probably, if I didn’t test other cases, it would not have been complete.

    thank you very much @guy038 .

  • Encrypt file with access to run

    8
    0 Votes
    8 Posts
    762 Views
    Metza ErfanM

    Thanks to @Ekopalypse & @PeterJones for your advise
    Actally Tekla can’t read encrypt .ini file, I will try to find another solution.

    Thanks all