• 9 Votes
    20 Posts
    1k Views
    PeterJonesP

    @notdodgeball ,

    Apparently the xml.etree library behaves differently between Python 2.7 and 3.12 (used by PS2 and PS3 respectively).

    I really wish PS3 would move out of alpha and release into Plugins Admin, so that we could just stick with PythonScript 3 for sharing scripts in the forum, and not have to contend with all the headaches of keeping scripts compatible with two major versions of Python, and all the library differences that come with that.

    (it also would’ve been nice if Don hadn’t allowed theme authors to submit themes with XML that have invalid top-level comments, which the XML parsing engines don’t like because it’s not valid XML)

    v1.08 is available from the permalink, fixing the handling of the invalid XML in PythonScript 2.

    However, I highly recommend making the switch to PythonScript 3, despite it claiming to be alpha, unless you are using a lot of ANSI characterset files rather than real unicode-based encodings. I don’t know how much longer I’ll support PythonScript 2 for this script.

  • how to extract number between the tags then adding some number?

    2
    0 Votes
    2 Posts
    109 Views
    guy038G

    Hello, @fajar-zulianto and All,

    Very easy with regexes !

    So, starting with your INPUT text, below, that I slightly changed in order to introduce possible leading indentation, on any line :

    <audGrainData> <startSample>253</startSample> <pitch>14.1668348</pitch> </audGrainData> <audGrainData> <startSample>2390</startSample> <pitch>14.1668348</pitch> </audGrainData> <audGrainData> <startSample>4521</startSample> <pitch>14.1668348</pitch> </audGrainData> <audGrainData> <startSample>6475</startSample> <pitch>14.1668348</pitch> </audGrainData> <audGrainData> <startSample>8547</startSample> <pitch>14.2084284</pitch> </audGrainData>

    Open the Replace dialog ( Ctrl + H )

    Uncheck all box options

    SEARCH (?-is)^\h*<(audGrainData)>\R\h*<(startSample)>(.+)</\2>\R\h*<(pitch)>(.+)</\4>\R\h*</\1>

    REPLACE \3 \5 10000 10200

    Check the Wrap around option

    Select the Regular expression search mode

    Click once on the Repalce All button

    => You should get the expected OUTPUT text :

    253 14.1668348 10000 10200 2390 14.1668348 10000 10200 4521 14.1668348 10000 10200 6475 14.1668348 10000 10200 8547 14.2084284 10000 10200

    Voila !

    NOTES :

    The (?-is) syntax are in-line modifiers which ensure that the search is sensible to case and that the . represents one standard character only

    There are five groups, located between parentheses, whose three of them store the name of the tags ( audGrainData, startSample and pitch ) and two of them store the numbers (.+) to re-use them in the replacement, with the \3 and \5 syntax

    The \h* syntax represents possible leading space or tabulation characters, on any line

    The \R syntax stands for any kind of line-break ( \r\n, \n or \r )

    Best Regards,

    guy038

  • UDL styles are defunct

    2
    0 Votes
    2 Posts
    123 Views
    PeterJonesP

    @Sean-Harding

    UDL styles are defunct

    I have never found that to be true.

    However, Notepad++ has decided that this (left) was what I wanted. Spoiler alert: it is not.

    Then tell it what colors you actually want for they various keywords, rather than telling it the wrong color.

    You need to change the individual style colors for each keyword group. So whatever keyword# the LD and PUSH keywords are in, you need to choose it’s Styler button, then set the foreground color to green, probably with bold enabled. And whichever keyword# A and AF and C are defined in, you need to set to your aqua/cyan color with the right background (instead of white background). And your number style definition need to be set to magenta rather than white+italic+underline

    I will admit, UDL does have limitations, and there are some things you won’t be able to do. But I believe that the symptoms you showed are easily correctable by you hitting the Styler button and selecting appropriate colors.

  • Operation of Sorting "Sort Lines as Decimals"

    7
    0 Votes
    7 Posts
    252 Views
    Alan KilbornA

    @guy038

    Peter should document all of this in the user manual.
    (Just kidding, Peter!)

  • Is there a way to prevent the cursor moving after a undo/redo command?

    17
    1 Votes
    17 Posts
    739 Views
    Alan KilbornA

    @notdodgeball said:

    After using the macros for some more time, I came to the realization that the problem also manifests when the screen is in a different position from that of the cursor, in fact, the cursor is not what matters. It only may seem it does when it’s visible in the screen (which is most of the time), otherwise jumping to it’s position is not the solution.

    So I made a simple python script

    top_line = editor.getFirstVisibleLine()
    editor.undo() #redo
    editor.setFirstVisibleLine(top_line)

    I really don’t see how that is going to be a workaround that always works, either. It’s likely going to be situation-dependent, I’m afraid.

    The virtue of the “bookmark” workaround is that bookmarks seem to stay set “around” where they were first set, even when the original line of the bookmark is removed.

  • problem with char encoding for suggested words

    7
    1 Votes
    7 Posts
    272 Views
    guy038G

    Hello, @pilagit, @peterjones, @coises, @mpheath and All,

    Not really off-topic but yes, sorting problems are always a nightmare :-(( Just some general remarks about the alphabetical sorting order :

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

    Read, particularly, the section below :

    https://en.wikipedia.org/wiki/Alphabetical_order#Language-specific_conventions

    Just an example, which, however, concerns two bordering countries :

    (for example, the correct lexicographic order is baa, baá, báa, báá, bab, báb, bac, bác, bač, báč [in Czech] and baa, baá, baä, báa, báá, báä, bäa, bäá, bää, bab, báb, bäb, bac, bác, bäc, bač, báč, bäč [in Slovak])

    On the other hand, on the Unicode consortium site, take the time to fully read this technical and interesting report :

    https://www.unicode.org/reports/tr10/

    The beginning of this article says :

    Collation is the general term for the process and function of determining the sorting order of strings of characters.
    It is a key function in computer systems; whenever a list of strings is presented to users, they are likely to want it
    in a sorted order so that they can easily and reliably find individual strings. Thus it is widely used in user interfaces.
    It is also crucial for databases, both in sorting records and in selecting sets of records with fields within given bounds.

    You’ll be stunned by the complexity of the problem !

    So, practically, I suppose that anyone, trying to create a sort algorithm, must do a lot of simplifications. Indeed, taking in account all the specifications, for a correct sorting of all languages, seems to be a superhuman task !

    Luckily, there’s nothing mysterious about the sort algorithm used by Notepad++ :

    If you use the Edit > Line Operations > Sort lines Lexicographically Ascending option, any character is simply sorted by its Unicode code-point.

    However, for all code-points over the BMP ( Basic Multilingual Plane ), i.e. with code-point over U + FFFF, they all lie within the surrogates section. So :

    After the D7FF and previous code-points of the BMP

    Before the E000 and next code-points of the BMP

    Thus, a general N++ sorted list, with Unicode v16.0, is always of this form :

    U + 0000 NULL character \ ... | ... | ... | Plane 0 : Basic Multilingual Plane ( BMP ) ... | ¯¯¯¯¯¯¯¯ ... | U + D7FB HANGUL JONGSEONG PHIEUPH-THIEUTH character / U + 10000 LINEAR B SYLLABLE B008 A \ ... | ... | ... | Plane 1 : Supplementary Multilingual Plane ( SMP ) ... | ... | U + 1FBF9 SEGMENTED DIGIT NINE / U + 20000 CJK Ideograph Extension B GKX-0075.06 \ ... | ... | ... | Plane 2 : Supplementary Ideographic Plane ( SIP ) ... | ... | U + 2FA1D CJK COMPATIBILITY IDEOGRAPH-2FA1D / U + 30000 CJK Unified Ideographs Extension G UK-02764 \ ... | ... | ... | Plane 3 : Tertiary Ideographic Plane ( TIP ) ... | ... | U + 323AF CJK Unified Ideographs Extension H T13-3D2C / U + E0001 BEGIN LANGUAGE TAG \ ... | ... | ... | Plane 14 : Supplementary Special-purpose Plane ( SSP ) ... | ... | U + E01EF VARIATION SELECTOR-256 / U + F0000 Private Use-A \ ... | ... | ... | Plane 15 : Supplementary Private Use Area A ( SPUA-A ) ... | ... | U + FFFFD Private Use-A / U + 100000 Private Use-B \ ... | ... | ... | Plane 16 : Supplementary Private Use Area B ( SPUA-B ) ... | ... | U + 10FFFD Private Use B / U + E000 Private Use Area \ ... | ... | ... | Plane 0 : Basic Multilingual Plane ( BMP ) ... | ¯¯¯¯¯¯¯¯ ... | U + FFFD REPLACEMENT character /

    Best Regards,

    guy038

  • Does Notepad++ support Language Server Protocol (LSP)

    5
    0 Votes
    5 Posts
    814 Views
    EkopalypseE

    @PeterJones said in Does Notepad++ support Language Server Protocol (LSP):

    though it’s not feature-complete yet

    If you, or anyone else, would like to have a missing feature implemented in the LSP client, feel free to start a discussion on github because for me it already has everything I need ;-)

    Even though the goal is to have a 3.17 compatible client I’m happy to listen to suggestions on what to implement first.

  • 0 Votes
    3 Posts
    162 Views
    PeterJonesP

    @Jim-Harris ,

    See, for example, this official request and accompanying discussion

  • 0 Votes
    2 Posts
    97 Views
    PeterJonesP

    @Jim-Harris said in Enable snapshot backups without enabling opening the last file at startup?:

    It would be better if these options were separate.

    Since the one was implemented using the other, it would require a significant rework of both of those features to disentangle them, which I doubt is likely to happen

  • Automatic sum of numbers in a column

    4
    4 Votes
    4 Posts
    646 Views
    Alan KilbornA

    @guy038 said:

    I suppose you were a bit upset to not be able to add a comment for the 1602 message, relative to the replacement.

    <Action type=“3” message=“1602” wParam=“0” lParam=“0” sParam=“(?1+:=)(?2 ‘Replace with’ regex)” />

    Nice one!
    For readers that don’t see it, I’m talking about the addition of (?2 'Replace with' regex) as the “comment” for this action line.
    And note also, with that addition, it is needed to wrap the original ?1+:= with parentheses.

    When considering “commenting” a macro by using unused sParam values, how is one to know if sParam is needed by the macro, or you can safely stick a comment in there?

    Well, it isn’t always obvious, so, in that case it might be best to use a “null” command, which for sure doesn’t use sParam, like I did in the first line of the revised macro:

    <Action type="0" message="2172" wParam="0" lParam="0" sParam="see https://community.notepad-plus-plus.org/topic/26363" />

    Message 2172 is SCI_NULL.

  • Closing all tabs when closing Notepad++

    2
    0 Votes
    2 Posts
    158 Views
    PeterJonesP

    @radpopl ,

    It’s called the current “session”.

    Disable Settings > Preferences > Backup > Remember current session for next launch

    This behavior (along with all the other settings) is described both in the user manual in the sections on sessions

  • Does anyone else hate "Enable Copy/Cut Line without selection"?

    16
    4 Votes
    16 Posts
    563 Views
    Alan KilbornA

    I had forgotten that some else has the same fat fingers that I do, and thus shared my pain; it’s a bit of a rant, but some good reading: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15480

  • Bug? "Find All.." does very often not work anymore

    14
    2 Votes
    14 Posts
    952 Views
    xomxX

    @ahopsu said in Bug? "Find All.." does very often not work anymore:

    To me, with 8.6.7 (32-bit) version, the search results window came back, after I changed this “curr” value from “5” to “3” for the “InternalFunction”

    Thanks for the report. I know about such N++ Docking Manager problems (it can happen in some specific steps) but currently I do not have a simple fix for it.

    Did you undock that Search results panel to the floating state before?

  • Bug: Cntrl+End is not recorded in the macro

    2
    0 Votes
    2 Posts
    110 Views
    Terry RT

    @Jigar-Patel said in Bug: Cntrl+End is not recorded in the macro:

    When Cntrl+End key is used to go to the end of the file, it’s not recorded in the macro

    Macro’s are saved in the shortcuts.xml file. This is normally located in the folder %appdata%\notepad++. If you open it in Notepad++, be aware that Notepad++ will write to that file when closing if any configuration setting within that file need updating, so don’t edit the file unless it is the only thing you do in a Notepad++ session.

    As you are using macro’s it might be a good idea to read the online manual on macros’ here.

    I created the same macro as you were trying to record and got the following in my shortcuts.xml file. Note the last entry has a message value of 2318. Since this is a type 0, it means it’s a Scintilla command. Scintilla is what Notepad++ uses under the hood, so a lot of the commands are directed to the Scintilla process for completing.

    <Macro name="reload-goto-end" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="0" message="2422" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2325" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2422" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2325" wParam="0" lParam="0" sParam="" /> <Action type="2" message="0" wParam="41014" lParam="0" sParam="" /> <Action type="0" message="2318" wParam="0" lParam="0" sParam="" /> </Macro>

    The Goto-End command is this one, 2318. See this image of the relevant Scintilla code.

    NPP-gotoend.jpg

    So, obviously from the code I just presented above, the macro works exactly as expected, the Ctrl-End shortcut was recorded. You should first check what your macro actually saved, is it the same as I show above?

    What happens when you use the Ctrl-End keystrokes manually, does the caret move to the end of the document? If so, then the macro should have that as the last entry as did mine.

    I would also suggest reading the FAQ post called “Notepad++ Crashes/Freezes/Unresponsive after Update”. It may not seem relevant, but part of the post refers to running Notepad++ without any plugins running. See if that changes the outcome.

    When you come back with more information, please include the debug info. It’s available from the “?” menu, copy and paste that in your post so we might get a better idea of your setup. That may provide a clue to the problem.

    Terry

  • How do we wrap the search results?

    5
    1 Votes
    5 Posts
    174 Views
    A

    @Terry-R okay. I’ll check that page and request it on GitHub. Again thank you for the help here.

  • Does this plugin exist? number manipulation

    6
    1 Votes
    6 Posts
    250 Views
    nick klausN

    Yeah MultiReplace worked out, thanks all, if I had the rep upvotes all round.
    Just to clear up one thing the .cue standard doesn’t use 1/100th of seconds, it uses frames (75 frames = 1s) that’s why the last 2 digits has a : as a separator (another CD era throwback)

    For the record
    .cue file to modern youtube style time stamps in one pass

    MultiReplaceList.CSV

    Selected,Find,Replace,WholeWord,MatchCase,UseVariables,Regex,Extended 1,"([\\r\\n]{0,1})\\s*TRACK \\d+ AUDIO\\r\\n\\s{4}TITLE ""(.+)""\\r\\n\\s{4}PERFORMER ""(.+)""\\r\\n\\s{4}INDEX \\d+ (\\d+:\\d+):\\d+","\\1**\\4 - \\3 - \\2**",0,0,0,0,1 1,"\\*\\*(\\d+)","set( string.format(""**%02d:%02d"", math.floor(CAP1 / 60), CAP1 % 60) )",0,0,1,0,1

    Input

    TRACK 01 AUDIO TITLE "Tragedy Blows on the Dancefloor (Kesha, Sophie Ellis-Bextor, Cutting Crew vs. Bee Gees)" PERFORMER "Titus Jones" INDEX 01 00:00:00 TRACK 02 AUDIO TITLE "Call My Name" PERFORMER "BLOND:ISH" INDEX 01 61:41:00 TRACK 03 AUDIO TITLE "HIPS DON`T LIE / SMACK YO (Charlie Roennez Mashup)" PERFORMER "Shakira" INDEX 01 122:49:00

    Output

    **00:00:00 - Titus Jones - Tragedy Blows on the Dancefloor (Kesha, Sophie Ellis-Bextor, Cutting Crew vs. Bee Gees)** **01:01:41 - BLOND:ISH - Call My Name** **02:02:49 - Shakira - HIPS DON`T LIE / SMACK YO (Charlie Roennez Mashup)**
  • Automate blank space on or carriage return

    14
    0 Votes
    14 Posts
    398 Views
    Alan KilbornA

    @Jim-Dailey said:

    I have a USB device that someone purchased…

    We’re getting off-topic but I’ll just point out that a script costs less. :-)

  • When pressing TAB, how to remove thin line?

    7
    0 Votes
    7 Posts
    271 Views
    EnnPLUserE

    @guy038 , I’ve just had a thought regarding the double post issue. After I posted my question, I changed my user name. Could that have triggered a double post issue?

    (BTW, I’ve had a message saying that I can’t post any further comments for the next 1200 seconds, so I hope this comment doesn’t generate any excess posts!)

    Deselecting the Show indent guide option fixed my problem.

  • NPP RSS Feed broken?

    5
    0 Votes
    5 Posts
    246 Views
    LagunaJimL

    @PeterJones sadly their free account inc;ludes zero tech support contact. May jump to another reader - tested with ‘feeder’ and the npp feed is fine :)

  • 1 Votes
    2 Posts
    163 Views
    PeterJonesP

    @KdL ,

    This may be related to the other reports of Search Results issues that have come up multiple times. To keep the discussion in one place, please read the v8.7 Search Results section of the missing-panel FAQ, and then continue any discussion in the v8.7 Search Results Missing topic.

    Locking This Thread (to keep discussion in one place)