• 0 Votes
    6 Posts
    428 Views

    @ThosRTanner said in sort seems to get confused if you've done a find and replace:

    It’s a bit confusing of it to display the things the same though.

    It’s a Scintilla thing. Scintilla considers CR alone, LF alone, or CRLF (together) as the end of a line, regardless of the file’s line-ending type as shown in the status bar.

    BTW, I think I remember that the line-ending type (determined when a file is loaded) isn’t a complicated algorithm: it’s simply the first line-ending in the file.

  • 1 Votes
    2 Posts
    845 Views

    Hello, All,

    In my last post, I forgot some important points ! So, refer to this correct version, below and forget the previous one !

    When I began to “follow” Notepad++, in 2012, I was using N++ ANSI versions. At this time, N++'s forums were located on SourceForge.Net and, of course, my first replies to users were stored as ANSI files.

    Recently, I was wondering how many files, among my 1,800 posts about, stored on my laptop, have a true ANSI encoding, in order to re-encode them as UTF-8 with the two commands :

    Encoding > Convert to UTF-8

    File > Save

    I suceeded to find out a way to achieve it ! You just need two DOS tools : iconv.exe and xxd.exe

    Notes :

    Using the xxd.exe program alone, which is a hexdump utility, is not enough to determine the correct encoding. In fact, it can identify, without error :

    True UTF-8-BOM files with the first three bytes EFBBBF

    True UTF-16 BE BOM with the first two bytes FEFF

    True UTF-16 LE BOM with the first two bytes FFFE

    But it cannot display, at the first sight, any difference between an ANSI and a UTF-8 file without a BOM, unless scanning the files completely !

    Rememver also that, if all bytes of a file have a value below \x80, Notepad++ considers that it’s a pseudo UTF-8 file, by default !

    Thus,

    Download the binaries, dependencies and documentation archives, relative to the iconv.exe program, from :

    https://gnuwin32.sourceforge.net/packages/libiconv.htm

    Move to the directory where you extract the iconv.exe program and its 3 dependencies : libcharset1.dll, libiconv2.dll and libintl3.dll

    Now, in this same directory, download the xxd archive from :

    https://sourceforge.net/projects/xxd-for-windows/files/xxd-1.11_win32(static).zip/download

    Extract the xxd.exe file

    Open a DOS window

    Run, first, the command chcp 1252 ( in order to get an ANSI output for this DOS window ! )

    Move to the folder containing, both, iconv.exe and xxd.exe

    Then, run the command iconv -f UTF-8 -t UTF-8 <Full_Directory_Path>\*.* 1> NUL 2>> results.txt

    Of course, you must replace the <Full_Directory_Path> zone by the folder location containing all the files to scan for encoding !

    => With this command, you are certain that the OUTPUT file ( results.txt ) contains only files which are not presently encoded in UTF-8 ( so, in N++, they can be true ANSI files, with some bytes between \x80 and \xFF or true UTF-16 files with a BOM )

    Now, open the results.txt file in N++

    Open the Replace dialog ( Ctrl + H )

    SEARCH (?-si)^Permission denied\R|^.*iconv:\x20|: cannot convert$

    REPLACE Leave EMPTY

    Tick the Wrap around option

    Select the Regular expression search mode

    Click on the Replace All button

    => We keep the full pathnames, only

    Save the results.txt file

    Open, again, the Replace dialog ( Ctrl + H )

    SEARCH (?-s)^.+

    REPLACE \( echo | set /p="$0 " & xxd.exe -l2 -u "$0" \) >> results.txt

    Tick the Wrap around option

    Select the Regular expression search mode

    Click on the Replace All button

    Now, add the line @echo OFF at the very beginning of the file

    And rename this file as results.bat

    If the current encoding of this batch file is UTF-8, run the Encoding > Convert to ANSI option ( IMPORTANT, as the DOS window is ANSI too )

    Save this new results.bat file

    Run the results.bat file, in the DOS window

    Back to Notepad++, open the new results.txt file

    Open the Replace dialog ( Ctrl + H )

    SEARCH (?-s)^.+(FFFE|FEFF).+\R|\x2000000000:.+

    REPLACE Leave EMPTY

    Tick the Wrap around option

    Select the Regular expression search mode

    Click on the Replace All button

    => We get rid of the UTF-16 files which have a BOM equal to FEFF or FFFE

    Save the results.txt file

    => Thus, you should get, only, the true ANSI files, containing some bytes between \x80 and \xFF, that need a further UTF-8 or UTF-8-BOM encoding !

    Delete the results.bat file

    Finally, close the DOS window

    Best Regards,

    guy038

  • Column To Multi-Select FORCED ON

    Mar 10, 2024, 5:06 AM
    0 Votes
    5 Posts
    321 Views

    @Alan-Kilborn thank you so much for replying. I must apologize for being rude and abrupt. I was only using the empty “%APPDATA%\Notepad++\noColumnToMultiSelect.xml” file to disable. I went into the settings, unchecked those boxes… and now it has disabled. Thank you again for your patience and consideration.

  • Wildcard in Replace Line?

    Mar 10, 2024, 4:54 PM
    1 Votes
    4 Posts
    366 Views

    @x-77-x said in Wildcard in Replace Line?:

    how do you guys even know this stuff!?

    Umm, it’s all documented in the User Manual, which is linked to from the ? menu option in Notepad++…

    Look under the Searching heading, for Regular Expressions.

  • 0 Votes
    3 Posts
    280 Views

    For this specific instance, debug continued in chat (because of privacy issues).

    But if you are a reader in the future, who is encountering the same thing:

    The link you are provided in the confirmation email is a one-time link. So if you follow the link twice, or if you accidentally hit “reload” in your browser, or if your browser for whatever reason requests the page twice (view source, reload, network confusion, …) then the second time will give a “Not Found” error. It may be that you never saw the first successful load, even though it was successful behind-the-scenes.

  • Filtering the shortcut mapper

    Feb 14, 2024, 2:24 AM
    3 Votes
    15 Posts
    831 Views

    The proposed feature of filtering the shortcut mapper has been added to Notepad++ via this commit.

    See this issue in the user manual repo for some examples of how the new functionality will work.

  • help! regular express

    Mar 2, 2024, 6:22 AM
    0 Votes
    2 Posts
    223 Views

    Hello, @李唯任 and All,

    Not difficult with regular expressions !

    Do a normal selection of your first text part to modify

    Open the Replace dialog ( Ctrl + H )

    Untick all box options

    Tick the Wrap around box option

    Select the Regular expression search mode

    Enter (?-s)(?:.+(\R))+.+ in the Find what: zone

    Enter {\1$0\1}, in the Replace with: zone

    FIRST possibility :

    Tick the In selection box option

    Click on the Replace All button

    SECOND possibility :

    Do not tick the In selection box option

    Click on the Find Next button

    Click on the Replace button if the present selection must be replaced (A)

    Click again on the Find Next button, if the present selection must stay unchanged

    Return to line (A)

    And so on…

    => the FIRST possibility just produce one global replacement on your selection whereas the SECOND possibility allows you to choose the zones of text to modify or not !

    Notes :

    First, the in-line modifier ( (?-s) ) means that the regex character . represents a unique standard char only ( not EOL )

    Then the (?:.+(\R))+ part represents a bunch of, at least, 1 complete line(s), surrounded by a non-capturing group ( (?:.......) ), each with :

    1 or more standard characters

    Any kind of End of Line ( \R ), so \r\n or \n or \r, stored as the group 1 , which will be re-used in replacement

    Finally the .+ part match a LAST non-empty line ( Thus, the case if your last section is at the very end of file, without any EOL, will be matched, too )

    In replacement, we simply write the { character first, followed with an EOL character ( the group \1 ), followed with the whole regex ( $0 ) and, again, followed with a second EOL character and, finally, the } character

    Best Regards,

    guy038

  • 1 Votes
    12 Posts
    1k Views

    @Coises
    Thank you soo much! Works perfectly now.

  • 0 Votes
    6 Posts
    1k Views

    The two solutions given here solved my issue. Thank you so much to the contributors!!

  • 0 Votes
    4 Posts
    2k Views

    Hello, @michelle-pace,

    You may also be interested by this Python script, built up with the @alan-kilborn’s collaboration and some other Python gurus !

    On the last line of this Summary report, it will give you, at the same time, the number of characters, words and bytes of all your selected text, in one or several ranges, of the current file, whatever the view used !

    https://community.notepad-plus-plus.org/topic/20218/emulation-of-the-view-summary-feature-with-a-python-script/14

    Of course, if you select all the file contents, the results, reported in the last SELECTION(S) line, should be identical to the 3 lines just above :
    Total chars, Words count and Buffer length

    BTW, note, that I added the mention (Caution !) in the Words line, because the word notion is quite odd in many languages ! Refer to this post :

    https://community.notepad-plus-plus.org/topic/20218/emulation-of-the-view-summary-feature-with-a-python-script/3

    If needed, you may even change the default definition of a word character, as explained at the beginning of the post !

    Best Regards,

    guy038

  • 0 Votes
    3 Posts
    237 Views

    Yes, that’s what I need! Thanks for the help!

  • 0 Votes
    4 Posts
    329 Views

    @CodeBiene said in Perl folding fails on comment with right curley brace "#}":

    So it has nothing to do with the fact that there are several consecutive comment lines.

    I agree that It is something that has not been mentioned yet.

    The hexadecimal 3FF displayed in the margin is negative folding caused by unbalanced braces.

    perl_fold4.gif

    2 frames alternate every 4 seconds displaying the default lexer property value of

    fold.perl.comment.explicit=1

    and the changed value of

    fold.perl.comment.explicit=0

    Comment explicit enabled for the lexer is usually the leading comment character(s) followed with a brace. Perl comment explicit is #{ as a open fold and #} as a close fold.

    Notice the line with #} { shows fold flags of 402 401 which means it is closing a fold. The next frame with that same line shows fold flags as 402 402 which means that there is no change in the folding state.

    The Ctrl+Q key sequence changes } { to # } { which is not recognized as a fold by comment explicit as to the space after the # symbol.

    PythonScript can be used to disable the comment explicit option which is enabled with the value of 1 by default:

    editor.setProperty('fold.perl.comment.explicit', 0)

    This setting will not survive changing buffers so may need a callback to be setup.

  • 1 Votes
    1 Posts
    229 Views
    No one has replied
  • 1 Votes
    12 Posts
    842 Views

    @Alan-Kilborn ,
    Thanks to you, (grumble :) ) I’ve started checking out the YT videos by Chris Amit to check out some of the other things NPP and Plugins do that I’ve not been using and already have enabled 3 more plugins. ::sigh:: Ignorance was bliss, now that I’ve eaten the apple, like Adam, I’m screwed. :)

  • How to highlight text?

    Jun 7, 2019, 4:47 PM
    0 Votes
    10 Posts
    145k Views
  • 0 Votes
    1 Posts
    262 Views
    No one has replied
  • WinGup update waiting...

    Feb 12, 2024, 8:19 PM
    0 Votes
    4 Posts
    569 Views

    @mattesh ,

    I’ll put it there little later

    I actually already pointed it out to Don here, and he has tagged wingup 5.2.8. He has incorporated that new wingup into Notepad++ v8.6.3-RC2

    seems that this fix might even not be enough for some use cases

    If you find a use case that isn’t covered by wingup 5.2.8, you will have to create a new wingup issue. A fix for a new issue (likely) won’t make it into the final Notepad++ v8.6.3 release, but it should make it eventually (assuming he is able to come up with a fix).

  • 1 Votes
    8 Posts
    565 Views

    @big_guitar
    If you’re using JsonTools 4.4, you should upgrade to v6.1.1 or v7 even if it’s not responsible for your problem (and I seriously doubt it is).

  • 0 Votes
    10 Posts
    822 Views

    @PeterJones
    OK. I get the picture now. Although notepad++ has many features - great editing and the ability to run external programs - it lacks the ability to handle projects properly.

    The ability to have $(CURRENT_PROJECT_FILE) and $(CURRENT_PROJECT_NAME) is all it would take.

    Although notepad++ is my editor of choice I will just have to ‘bite the bullet’ and carry on as I currently do. I manually create a file containing the file list and compile that.

    I can currently do what I require by creating the panel information file in my data directory with the extension npp then looking for this file in the current addressed directory. Only one project/directory allowed.

  • "Summary" feature improvement

    Jan 25, 2024, 1:32 PM
    3 Votes
    31 Posts
    3k Views

    @guy038 said in Improved version of the "Summary" feature, ...:

    what do you think of ?

    I wouldn’t bother trying to rename things at this point.
    It’s no problem simply because I was confused (that’s MY problem). :-)
    Carry on… :-)