• UDL Folding Fail -Help Please

    Locked
    2
    0 Votes
    2 Posts
    703 Views
    Scott K. SmithS

    After several days hacking away at this, I found the problem was simple EOL conversion. All the scripts that I have been working originated in unix (LF). Edit->EOL Conversion->Windows (CR LF) on the file makes it obey my UDL folding.

    I would like to thank a someone who replies on this list, since I found the tip about checking the EOL in another post. Now I can’t find the post…

  • Find content in files and rename/delete files not containing content

    Locked
    7
    0 Votes
    7 Posts
    3k Views
    PeterJonesP

    I doubt @Samos007 will come back to confirm, but I am assuming Samos actually used File Explorer to delete the files after updating their timestamps and sorting by date.

    (And I’m happy that Samos didn’t just expect us to solve the problem, but put more effort into it; that’s encouraging that there are still random users who do put in effort into their own issues.)

    If Samos does return, Scott’s “without any special tools” challenged me: using only Windows builtin commands, two one-liner alternatives:

    for %F IN ( *.txt ) DO @( FIND /C "special text" %F > NUL && DEL %F) for %F IN ( *.txt ) DO @( FINDSTR /L "special text" %F > NUL && DEL %F)

    the builtin FIND command, using FIND /C, will print out a count of the number of matches, and also return an %ErrorLevel% of 0 to the system if it matches, or 1 if there’s no match; since I don’t care about the printing, I redirect it to NUL. I then use the windows && to cause the next command to only run if the previous %ErrorLevel% was 0 (a match). DEL will thus be run only on any files that match

    The builtin FINDSTR command, using FINDSTR /L, works similarly.

    Someday, I’ll maybe think “FINDSTR” or “FIND” instead of gnuwin32’s “grep” for matching text in Windows files… but probably not before MS has discontinued cmd.exe completely and forced me to learn PowerShell.

  • How to make new lines without deleting

    Locked
    17
    0 Votes
    17 Posts
    3k Views
    MarkomarinM

    @Scott-Sumner
    That was just the thing I was looking for, that was another thing I learned from this great community, Thanks guys.

  • Collapse level 2 not working for python language

    Locked
    2
    1 Votes
    2 Posts
    893 Views
    PeterJonesP

    I tried on v7.5.6 32bit, and it seems to not work right for me: collapse level 2 doesn’t collapse the two def’s. When I switched to a different language (Perl), with

    sub blah { do { tertiary: { 1; } }; while(1) { } }

    I was able to properly collapse and uncollapse levels 1, 2, or 3 without difficulty in Perl; but if I switch the language to python, it will only do level 1.

    Thus, it doesn’t seem to be solely the fault of v7.5.8, and it seems to be limited to Python.

    I just searched the issues page, and found https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4633 already reported … Based on what they said there (each space if indent gives a new level), I tried to collapse level 5 on your example, and the two def’s collapsed. So the bug isn’t with Notepad++, it’s with the Python-lexer that comes bundled with Scintilla that comes bundled with Notepad++. And it appears that it’s not going to be fixed, because the author disagrees that it’s a bug (it’s working as he designed it, apparently).

    So you might have to get used to calling a 4-space indent “level 5”. (sorry to be the bearer of bad news.)

  • How to find numbers and start new lines with the numbers

    9
    0 Votes
    9 Posts
    4k Views
    PeterJonesP

    (argh, typo. That should have been TIMTOWTDI… where’d my I go?)

  • 0 Votes
    4 Posts
    2k Views
    Scott SumnerS

    This question comes up rather frequently, and it is always tackled with a regular-expression solution. This is okay… but sometimes people have trouble with that, so how about this time we throw down a Pythonscript solution? [Thanks, Alan, for the hint…]

    A variant of this question is “How do I replace a list of words (and corresponding replacement values) in one document and have the replace act upon another document?”. The question in this thread is just a special case of that: Deleting is simply where a replacement value is zero length.

    So I propose that the word list should have the following form, and be present in the clipboard when the script is run, with the data file to be operated on in the active Notepad++ editor tab:

    DELIMITERsearhtextDELIMITERreplacementtext
    where replacementtext can be empty in order to do a deletion

    Here’s an example:

    Text to be copied to clipboard prior to running the script:

    :silver:golden @silently@sqwalkingly .sqwalkingly .

    I purposefully used a different delimiter character on each line to show that that is possible…hmmm, maybe this just confuses things? Oh, well…

    Text to be operated on, all by itself in a fresh editor tab:

    Six silver swans swam silently seaward

    After running the script with that editor tab active, its text should be changed to:

    Six golden swans swam seaward

    Note that in the second line of the list, silently is changed to sqwalkingly. But…in the third line, sqwalkingly followed by a space is deleted (no text follows the final delimiter, meaning change the search text to nothing, i.e., delete it).

    Hopefully the reader can follow the progression of replacements in this case.

    So…to perform the OP’s original deletion of data, one would create the word list as follows and copy it to the clipboard:

    !user3;! !user9;! !user10;! !user2;! !user30;!

    Remember, the format is: DELIMITERsearhtextDELIMITERreplacementtext where replacementtext can be empty in order to do a deletion (as we are doing here). This time I have arbitrarily used the ! character as the delimiter, and I was consistent about it in each line, as one usually would be.

    Then, running the script in the file of the original data:

    [role] rid=2000 rdesc=Members user=user100;user70;user4030;user10;user300;user33;user9;user2;user35;user290;user30;user158;user3;user893;user10;

    One obtains, with the desired users eliminated:

    [role] rid=2000 rdesc=Members user=user100;user70;user4030;user300;user33;user35;user290;user158;user893;

    Here’s the script code for ReplaceUsingListInClipboard.py:

    def RULIC__main(): if not editor.canPaste(): return cp = editor.getCurrentPos() editor.setSelection(cp, cp) # cancel any active selection(s) doc_orig_len = editor.getTextLength() editor.paste() # paste so we can get easy access to the clipboard text cp = editor.getCurrentPos() # this has moved because of the paste clipboard_lines_list = editor.getTextRange(cp - editor.getTextLength() + doc_orig_len, cp).splitlines() editor.undo() # revert the paste action, but sadly, this puts it in the undo buffer...so it can be redone editor.beginUndoAction() for line in clipboard_lines_list: try: (search_text, replace_text) = line.rstrip('\n\r')[1:].split(line[0]) except (ValueError, IndexError): continue editor.replace(search_text, replace_text) editor.endUndoAction() RULIC__main()
  • JS embedded in HTML

    Locked
    2
    0 Votes
    2 Posts
    761 Views
    Scott SumnerS

    @Gianluca-F

    i am trying to create an HTML page with one or more JS script in order integrate a survey module in a image

    We’re happy for you…but…see here.

  • Emmet not working

    14
    0 Votes
    14 Posts
    9k Views
    Jan KijlstraJ

    Sorry, but this did not work for me.

    I’ve installed HTML-Kit Tools now, this editor
    works fine with Emmet

    So I decided to leave Notepad++.

  • Notepad++ Format lost when same file opened on another computer

    Locked
    5
    0 Votes
    5 Posts
    1k Views
    Scott SumnerS

    Probably the OP is talking about lexer-based (or plugin-based) formatting for languages such a C++, Python, XML, HTML, etc. (where the content of the file is pure text and only the view of the text is formatted/colorized). Hard to advise about what might be going wrong for him/her without more detail, though.

  • Session Manager Error 7 loading the global properties file

    Locked
    2
    0 Votes
    2 Posts
    799 Views
    Claudia FrankC

    @Roger-K.

    did you check/confirm that the “global properties file” is there and is accessible?
    Maybe by using tools like sysinternals procmon?

    Cheers
    Claudia

  • How to replace the last word on the bookmark line?

    Locked
    2
    0 Votes
    2 Posts
    652 Views
    Claudia FrankC

    @Vivian-Zheng

    Did you have created the bookmarked lines manually or with a find operation?
    If the latter is the case you might be able to get what you want in one find/replace action
    but therefore more information is needed about your data.

    If the first is the case you would need to do bookmark action (menu search->bookmark)
    or using a scripting language to solve your problem.

    Cheers
    Claudia

  • Frequently use 'Find and Replace' combinations

    Locked
    7
    0 Votes
    7 Posts
    2k Views
    Terry RT

    I agree Scott that it does somewhat seem to be a failure on Notepad++ behalf that you can’t do the macro edits in a ‘proper’ manner within itself.

    To offset that, Notepad++ isn’t on it’s own in this. There are other situations where external editors are used when the app itself doesn’t perform to users expectations (slow or unwieldy).

    And Peter, agreed that is another option. The thing is though that all these ideas become messy or complicated. Maybe Notepad++ needs to have a “pretty-up” to support this functionality internally and in a correct manner, otherwise each user will resort to whatever measures they think appropriate. For me it’s using that ‘dirty and disgusting’ plain old vanilla Notepad app.

    Do you think a “I want this” question to enhance Notepad++ in this manner would get any traction. Concept of breaking the shortcuts.xml file apart and having a separate macros.xml file. That way you would only have 1 situation where the file could be overwritten, and even that could be tempered with a flag so that if you did create a macro or even edit it’s shortcut in the current session you wouldn’t be allowed to open the macro.xml file to edit.

    We can all wish!

    Terry

  • Not persisting last open tab in version x64 after v7.5.6

    Locked
    2
    0 Votes
    2 Posts
    736 Views
  • auto highlight of words/numbers multiple lines not in columns...

    Locked
    4
    2 Votes
    4 Posts
    2k Views
    dkuenzi3phD

    Thank you for the quick reply Scott. just to be clear, the auto highlight is intended only to alert the user to other instances NOT as an editing tool.

    d k

  • 0 Votes
    2 Posts
    2k Views
    guy038G

    Hello, @gary-rowswell, and All,

    To begin with, I would strongly advice anyone, to use the UTF-8 BOM encoding, in all cases. Indeed, compared to the UTF-8 encoding, current file size is just 3 bytes more, which are invisible and stands for the UTF-8 representation of the Byte Order Mark, of Unicode code point \x{FEFF}.

    As any decent editor or browser recognizes BOM, you are absolutely sure that your UTF-8 encoded text will be correctly displayed, whatever the Unicode code-point of characters, between 0 to 10FFFD ( except for the surrogates area ), assuming, of course, that the current font used can handle all the characters of your text and displays their glyphs, properly !

    For additional information, refer to :

    https://en.wikipedia.org/wiki/Byte_order_mark

    Gary, what you call utf8mb4 seems to be a MySQL encoding ( The mb4 probably means MultiBytes-4 ) and, as well as UTF-8, allows to use Unicode characters, located outside the BMP ( Basic Multilingual Plane ), that is to say with a code point > \x{FFFF}, encoded with four bytes !

    Your “🆔” character is part of the Unicode block "Enclosed alphanumeric Supplement", between 1F100 and 1F1FF. See the PDF file, below :

    http://www.unicode.org/charts/PDF/U1F100.pdf

    Now, if you persist to use the UTF-8 ( so, without BOM ), here is a work-around :

    Start Notepad++ ( I personally used the last 7.5.8 version )

    Go to Settings > Preferences… > MISC. and check the Autodetect character encoding option

    Open a new document ( Ctrl + N )

    If its current encoding is different from UTF-8, choose the option Encoding > Convert to UTF-8

    Then, insert, preferably in a comment, at least 3 NON-ASCII characters, with code-point > \x{007F} ( or > 127 in decimal ). For this matter, if you can’t type them easily, with your keyboard, you may use the Edit > Character Panel dialog, in N++

    Now, add your text containing characters, located outside the BMP, with code-point > \x{FFFF}

    Save your UTF-8 encoded file

    Close and restart N++

    => The UTF-8 encoding should have been kept ;-))

    Voilà !

    Notes :

    During tests, I noticed that these 3 chars must be inserted BEFORE any character as yours ( “🆔” ) !

    In theory, 2NON-ASCII characters seems enough to get the right behaviour !

    Best Regards,

    guy038

    P.S. :

    I should have explained why we need to add some NON-pure ASCII characters, in current text. This is because, when text contains characters with code-point > \x{007f}, it is always encoded with 1 byte, in ANSI whereas it is encoded in 2, 3 or 4 bytes, in UTF-8. So, this helps N++ to correctly detect the present encoding, even without any BOM !

  • The thread with no title idea

    Locked
    5
    1 Votes
    5 Posts
    1k Views
    Scott SumnerS

    @Terry-R

    I tend to give 'em what they ask for, let them refine it once when they realize they’ve screwed it up, then lose interest like an airplane losing altitude when they keep changing it infinitely and think I’m going to provide an equal amount of free consulting work (which is what it is). Trying to read their minds is a losing proposition. If they provide sample data, they’d better make it representative. Otherwise I point them to some regex docs and wish them well. This ISN’T a regex site, after all…

  • Lost unsaved data on open file after upgrade

    Locked
    7
    0 Votes
    7 Posts
    2k Views
    PeterJonesP

    I just added issue#4729 to ask for something that will improve the auto-save during auto-update: whether it be immediately triggering the periodic backup, and/or updating the dialog message after an auto-update, and/or asking for explicit save before starting the auto-update. I don’t know if it will happen, but it’s at least requested

  • 0 Votes
    5 Posts
    2k Views
    PeterJonesP

    I just added issue#4729 to ask for something that will improve the auto-save during auto-update: whether it be immediately triggering the periodic backup, and/or updating the dialog message after an auto-update, and/or asking for explicit save before starting the auto-update. I don’t know if it will happen, but it’s at least requested

  • Horizontal scroll using mouse

    Locked
    2
    0 Votes
    2 Posts
    924 Views
    Scott SumnerS

    @Jernej-Habjan

    You already made an issue of it…reporting it here also is overkill and is of less significance than reporting it on github.

  • PlugIn-Manager crashes when it starts

    5
    0 Votes
    5 Posts
    2k Views
    SkodaRunnerS

    Die Version habe ich. :-)

    Habe den Fehler für die Abstürze gefunden.
    Ich hatte sowohl
    CSScriptNpp.x86.dll
    als auch
    CSScriptNpp.dll
    im Ordner \plugins