• New API to fix eventual regression regarding SCN_MODIFIED for some plugins

    Pinned
    30
    2 Votes
    30 Posts
    2k Views
    Alan KilbornA

    @Lycan-Thrope said :

    there’s so many moving parts, that trying to interlace them all into one homogenous blob of code would be daunting for anyone to even fathom, let alone produce

    If this is the thinking, the project is in trouble.

  • Read This First

    Pinned Locked
    1
    5 Votes
    1 Posts
    2k Views
    No one has replied
  • Columns++: Where regex meets Unicode (Here there be dragons!)

    15
    6 Votes
    15 Posts
    266 Views
    guy038G

    Hi, @coises and All,

    First, here is the summary of the contents of the Total_Chars.txt file :

    •----------------•---------•------------------------------------------•-----------•-------------------------------------------------•-----------• | Range | Plane | COUNT / MARK of ALL characters | # Chars | COUNT / MARK of ALL UNASSIGNED characters | # Unas. | •----------------•---------•------------------------------------------•-----------•-------------------------------------------------•-----------• | 0000...FFFD | 0 | [\x{0000}-\x{FFFD}] | 63,454 | (?=[\x{0000}-\x{D7FF}]|[\x{F900}-\x{FFFD}])\Y | 1,398 | | 10000..1FFFD | 1 | [\x{10000}-\x{1FFFD}] | 65,534 | (?=[\x{10000}-\x{1FFFD}])\Y | 37,090 | | 20000..2FFFD | 2 | [\x{20000}-\x{2FFFD}] | 65,534 | (?=[\x{20000}-\x{2FFFD}])\Y | 4,039 | | 30000..3FFFD | 3 | [\x{30000}-\x{3FFFD}] | 65,534 | (?=[\x{30000}-\x{3FFFD}])\Y | 56,403 | | E0000..EFFFD | 14 | [\x{E01F0}-\x{EFFFD}] | 65,534 | (?=[\x{E0000}-\x{EFFFD}])\Y | 65,197 | •----------------•---------•------------------------------------------•-----------•-------------------------------------------------•-----------• | 00000..EFFFD | | (?s). \I \p{Any} [\x0-\x{EFFFD}] | 325,590 | (?![\x{E000}-\x{F8FF}])\Y \p{Not Assigned} | 164,127 | •----------------•---------•------------------------------------------•-----------•-------------------------------------------------•-----------•

    Indeed, I cannot post my new Unicode_Col++.txt file, in its entirety, with the detail of all the Unicode blocks ( Too large ! ). However, it will be part of my future Unicode.zip archive that I’ll post on my Google Drive account !

    Now, I tested your third experimental version of Columns++ and everything works as you surely expect to !!

    You said :

    Search in Columns++ shows a progress dialog when it estimates that a count, select or replace all operation will take more than two seconds…

    I pleased to tell you that with this new feature, my laptop did not hang on any more ! For example, I tried to select all the matches of the regex (?s)., against my Total_Chars.txt file and, with the process dialog on my HP ProBook 450 G8 / Windows 10 Pro 64 / Version 21H1 / Intel® Core™ i7 / RAM 32 GB DDR4-3200 MHz, after 8 m 21s, the green zone was complete and it said : 325590 matches selected ! I even copied all this selection on a new tab and, after suppression of all \r\n line-breaks, the ComparePlus plugin did not find any difference between Total_Chars.txt and this new tab !

    You said :

    [[:cntrl:]] matches only Unicode General Category Cc characters. Mnemonics for formatting characters [[.sflo.]], [[.sfco.]], [[.sfds.]] and [[.sfus.]] work.

    I confirm that these two changes are effective

    Now, I particularly tested the Equivalence classes feature. You can refer to the following link :

    https://unicode.org/charts/collation/index.html

    For the letter a, it detects 160 equivalences of a a letter

    However, against the Total_Chars.txt file, the regex [[=a=]] returns 86 matches. So we can deduce that :

    A lot of equivalences are not found with the [[=a=]] regex

    Some equivalents, not shown from this link, can be found with the [[=a=]] regex. it’s the case with the \x{249C} character ( PARENTHESIZED LATIN SMALL LETTER A ) !

    This situation happens with any character : for example, the regex [[=1=]] finds 54 matches, but, on the site, it shows 209 equivalences to the digit 1

    Now, with your experimental UTF-32 version, you can use any other equivalent character of the a letter to get the 86 matches ( ((=Ⱥ=]], [[=ⱥ=]], [[=Ɐ=]], … ). Note that, with our present Boost regex engine, some equivalences do not return the 86 matches. It’s the case for the regexes :

    [[=ɐ=]], [[=ɑ=]], [[=ɒ=]], [[=ͣ=]] , [[=ᵃ=]], [[=ᵄ=]], [[=ⱥ=]], [[=Ɑ=]], [[=Ɐ=]], [[=Ɒ=]]

    Thus, your version is more coherent, as it does give the same result, whatever the char used in the equivalence class regex !

    Here is below the list of all the equivalences of any char of the Windows-1252 code-page, from \x{0020} till \x{00DE} Note that, except for the DEL character, as en example, I did not consider the equivalence classes which return only one match !

    I also confirm, that I did not find any character over \x{FFFF} which would be part of a regex equivalence class, either with our Boost engine or with your Columns++ experimental version !

    [[= =]] = [[=space=]] => 3 (    ) [[=!=]] = [[=exclamation-mark=]] => 2 ( !! ) [[="=]] = [[=quotation-mark=]] => 3 ( "⁍" ) [[=#=]] = [[=number-sign=]] => 4 ( #؞⁗# ) [[=$=]] = [[=dollar-sign=]] => 3 ( $⁒$ ) [[=%=]] = [[=percent-sign=]] => 3 ( %⁏% ) [[=&=]] = [[=ampersand=]] => 3 ( &⁋& ) [[='=]] = [[=apostrophe=]] => 2 ( '' ) [[=(=]] = [[=left-parenthesis=]] => 4 ( (⁽₍( ) [[=)=]] = [[=right-parenthesis=]] => 4 ( )⁾₎) ) [[=*=]] = [[=asterisk=]] => 2 ( ** ) [[=+=]] = [[=plus-sign=]] => 6 ( +⁺₊﬩﹢+ ) [[=,=]] = [[=comma=]] => 2 ( ,, ) [[=-=]] = [[=hyphen=]] => 3 ( -﹣- ) [[=.=]] = [[=period=]] => 3 ( .․. ) [[=/=]] = [[=slash=]] => 2 ( // ) [[=0=]] = [[=zero=]] => 48 ( 0٠۟۠۰߀०০੦૦୦୵௦౦౸೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐⁰₀↉⓪⓿〇㍘꘠ꛯ꠳꣐꤀꧐꩐꯰0 ) [[=1=]] = [[=one=]] => 54 ( 1¹١۱߁१১੧૧୧௧౧౹౼೧൧๑໑༡၁႑፩១᠑᥇᧑᧚᪁᪑᭑᮱᱁᱑₁①⑴⒈⓵⚀❶➀➊〡㋀㍙㏠꘡ꛦ꣑꤁꧑꩑꯱1 ) [[=2=]] = [[=two=]] => 54 ( 2²ƻ٢۲߂२২੨૨୨௨౨౺౽೨൨๒໒༢၂႒፪២᠒᥈᧒᪂᪒᭒᮲᱂᱒₂②⑵⒉⓶⚁❷➁➋〢㋁㍚㏡꘢ꛧ꣒꤂꧒꩒꯲2 ) [[=3=]] = [[=three=]] => 53 ( 3³٣۳߃३৩੩૩୩௩౩౻౾೩൩๓໓༣၃႓፫៣᠓᥉᧓᪃᪓᭓᮳᱃᱓₃③⑶⒊⓷⚂❸➂➌〣㋂㍛㏢꘣ꛨ꣓꤃꧓꩓꯳3 ) [[=4=]] = [[=four=]] => 51 ( 4٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔፬៤᠔᥊᧔᪄᪔᭔᮴᱄᱔⁴₄④⑷⒋⓸⚃❹➃➍〤㋃㍜㏣꘤ꛩ꣔꤄꧔꩔꯴4 ) [[=5=]] = [[=five=]] => 53 ( 5Ƽƽ٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕፭៥᠕᥋᧕᪅᪕᭕᮵᱅᱕⁵₅⑤⑸⒌⓹⚄❺➄➎〥㋄㍝㏤꘥ꛪ꣕꤅꧕꩕꯵5 ) [[=6=]] = [[=six=]] => 52 ( 6٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖፮៦᠖᥌᧖᪆᪖᭖᮶᱆᱖⁶₆ↅ⑥⑹⒍⓺⚅❻➅➏〦㋅㍞㏥꘦ꛫ꣖꤆꧖꩖꯶6 ) [[=7=]] = [[=seven=]] => 50 ( 7٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗፯៧᠗᥍᧗᪇᪗᭗᮷᱇᱗⁷₇⑦⑺⒎⓻❼➆➐〧㋆㍟㏦꘧ꛬ꣗꤇꧗꩗꯷7 ) [[=8=]] = [[=eight=]] => 50 ( 8٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘፰៨᠘᥎᧘᪈᪘᭘᮸᱈᱘⁸₈⑧⑻⒏⓼❽➇➑〨㋇㍠㏧꘨ꛭ꣘꤈꧘꩘꯸8 ) [[=9=]] = [[=nine=]] => 50 ( 9٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙፱៩᠙᥏᧙᪉᪙᭙᮹᱉᱙⁹₉⑨⑼⒐⓽❾➈➒〩㋈㍡㏨꘩ꛮ꣙꤉꧙꩙꯹9 ) [[=:=]] = [[=colon=]] => 2 ( :: ) [[=;=]] = [[=semicolon=]] => 3 ( ;;; ) [[=<=]] = [[=less-than-sign=]] => 3 ( <﹤< ) [[===]] = [[=equals-sign=]] => 5 ( =⁼₌﹦= ) [[=>=]] = [[=greater-than-sign=]] => 3 ( >﹥> ) [[=?=]] = [[=question-mark=]] => 2 ( ?? ) [[=@=]] = [[=commercial-at=]] => 2 ( @@ ) [[=A=]] => 86 ( AaªÀÁÂÃÄÅàáâãäåĀāĂ㥹ǍǎǞǟǠǡǺǻȀȁȂȃȦȧȺɐɑɒͣᴀᴬᵃᵄᶏᶐᶛᷓḀḁẚẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặₐÅ⒜ⒶⓐⱥⱭⱯⱰAa ) [[=B=]] => 29 ( BbƀƁƂƃƄƅɃɓʙᴃᴮᴯᵇᵬᶀḂḃḄḅḆḇℬ⒝ⒷⓑBb ) [[=C=]] => 40 ( CcÇçĆćĈĉĊċČčƆƇƈȻȼɔɕʗͨᴄᴐᵓᶗᶜᶝᷗḈḉℂ℃ℭ⒞ⒸⓒꜾꜿCc ) [[=D=]] => 44 ( DdÐðĎďĐđƊƋƌƍɗʤͩᴅᴆᴰᵈᵭᶁᶑᶞᷘᷙḊḋḌḍḎḏḐḑḒḓⅅⅆ⒟ⒹⓓꝹꝺDd ) [[=E=]] => 82 ( EeÈÉÊËèéêëĒēĔĕĖėĘęĚěƎƏǝȄȅȆȇȨȩɆɇɘəɚͤᴇᴱᴲᵉᵊᶒᶕḔḕḖḗḘḙḚḛḜḝẸẹẺẻẼẽẾếỀềỂểỄễỆệₑₔ℮ℯℰ⅀ⅇ⒠ⒺⓔⱸⱻEe ) [[=F=]] => 22 ( FfƑƒᵮᶂᶠḞḟ℉ℱℲⅎ⒡ⒻⓕꜰꝻꝼꟻFf ) [[=G=]] => 45 ( GgĜĝĞğĠġĢģƓƔǤǥǦǧǴǵɠɡɢɣɤʛˠᴳᵍᵷᶃᶢᷚᷛḠḡℊ⅁⒢ⒼⓖꝾꝿꞠꞡGg ) [[=H=]] => 41 ( HhĤĥĦħȞȟɥɦʜʰʱͪᴴᶣḢḣḤḥḦḧḨḩḪḫẖₕℋℌℍℎℏ⒣ⒽⓗⱧⱨꞍHh ) [[=I=]] => 61 ( IiÌÍÎÏìíîïĨĩĪīĬĭĮįİıƖƗǏǐȈȉȊȋɨɩɪͥᴉᴵᵎᵢᵻᵼᶖᶤᶥᶦᶧḬḭḮḯỈỉỊịⁱℐℑⅈ⒤ⒾⓘꟾIi ) [[=J=]] => 23 ( JjĴĵǰȷɈɉɟʄʝʲᴊᴶᶡᶨⅉ⒥ⒿⓙⱼJj ) [[=K=]] => 38 ( KkĶķĸƘƙǨǩʞᴋᴷᵏᶄᷜḰḱḲḳḴḵₖK⒦ⓀⓚⱩⱪꝀꝁꝂꝃꝄꝅꞢꞣKk ) [[=L=]] => 56 ( LlĹĺĻļĽľĿŀŁłƚƛȽɫɬɭɮʟˡᴌᴸᶅᶩᶪᶫᷝᷞḶḷḸḹḺḻḼḽₗℒℓ⅂⅃⒧ⓁⓛⱠⱡⱢꝆꝇꝈꝉꞀꞁLl ) [[=M=]] => 33 ( MmƜɯɰɱͫᴍᴟᴹᵐᵚᵯᶆᶬᶭᷟḾḿṀṁṂṃₘℳ⒨ⓂⓜⱮꝳꟽMm ) [[=N=]] => 47 ( NnÑñŃńŅņŇňʼnƝƞǸǹȠɲɳɴᴎᴺᴻᵰᶇᶮᶯᶰᷠᷡṄṅṆṇṈṉṊṋⁿₙℕ⒩ⓃⓝꞤꞥNn ) [[=O=]] => 106 ( OoºÒÓÔÕÖØòóôõöøŌōŎŏŐőƟƠơƢƣǑǒǪǫǬǭǾǿȌȍȎȏȪȫȬȭȮȯȰȱɵɶɷͦᴏᴑᴒᴓᴕᴖᴗᴼᵒᵔᵕᶱṌṍṎṏṐṑṒṓỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợₒℴ⒪ⓄⓞⱺꝊꝋꝌꝍOo ) [[=P=]] => 33 ( PpƤƥɸᴘᴾᵖᵱᵽᶈᶲṔṕṖṗₚ℘ℙ⒫ⓅⓟⱣⱷꝐꝑꝒꝓꝔꝕꟼPp ) [[=Q=]] => 16 ( QqɊɋʠℚ℺⒬ⓆⓠꝖꝗꝘꝙQq ) [[=R=]] => 64 ( RrŔŕŖŗŘřƦȐȑȒȓɌɍɹɺɻɼɽɾɿʀʁʳʴʵʶͬᴙᴚᴿᵣᵲᵳᶉᷢᷣṘṙṚṛṜṝṞṟℛℜℝ⒭ⓇⓡⱤⱹꝚꝛꝜꝝꝵꝶꞂꞃRr ) [[=S=]] => 47 ( SsŚśŜŝŞşŠšƧƨƩƪȘșȿʂʃʅʆˢᵴᶊᶋᶘᶳᶴᷤṠṡṢṣṤṥṦṧṨṩₛ⒮ⓈⓢⱾꜱSs ) [[=T=]] => 46 ( TtŢţŤťƫƬƭƮȚțȶȾʇʈʧʨͭᴛᵀᵗᵵᶵᶿṪṫṬṭṮṯṰṱẗₜ⒯ⓉⓣⱦꜨꜩꝷꞆꞇTt ) [[=U=]] => 82 ( UuÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųƯưƱǓǔǕǖǗǘǙǚǛǜȔȕȖȗɄʉʊͧᴜᵁᵘᵤᵾᵿᶙᶶᶷᶸṲṳṴṵṶṷṸṹṺṻỤụỦủỨứỪừỬửỮữỰự⒰ⓊⓤUu ) [[=V=]] => 29 ( VvƲɅʋʌͮᴠᵛᵥᶌᶹᶺṼṽṾṿỼỽ⒱ⓋⓥⱱⱴⱽꝞꝟVv ) [[=W=]] => 28 ( WwŴŵƿǷʍʷᴡᵂẀẁẂẃẄẅẆẇẈẉẘ⒲ⓌⓦⱲⱳWw ) [[=X=]] => 15 ( XxˣͯᶍẊẋẌẍₓ⒳ⓍⓧXx ) [[=Y=]] => 36 ( YyÝýÿŶŷŸƳƴȲȳɎɏʎʏʸẎẏẙỲỳỴỵỶỷỸỹỾỿ⅄⒴ⓎⓨYy ) [[=Z=]] => 41 ( ZzŹźŻżŽžƵƶȤȥɀʐʑᴢᵶᶎᶻᶼᶽᷦẐẑẒẓẔẕℤ℥ℨ⒵ⓏⓩⱫⱬⱿꝢꝣZz ) [[=[=]] = [[=left-square-bracket=]] => 2 ( [[ ) [[=\=]] = [[=backslash=]] => 2 ( \\ ) [[=]=]] = [[=right-square-bracket=]] => 2 ( ]] ) [[=^=]] = [[=circumflex=]] => 3 ( ^ˆ^ ) [[=_=]] = [[=underscore=]] => 2 ( __ ) [[=`=]] = [[=grave-accent=]] => 4 ( `ˋ`` ) [[={=]] = [[=left-curly-bracket=]] => 2 ( {{ ) [[=|=]] = [[=vertical-line=]] => 2 ( || ) [[=}=]] = [[=right-curly-bracket=]] => 2 ( }} ) [[=~=]] = [[=tilde=]] => 2 ( ~~ ) [[==]] = [[=DEL=]] => 1 (  ) [[=Œ=]] => 2 ( Œœ ) [[=¢=]] => 3 ( ¢《¢ ) [[=£=]] => 3 ( £︽£ ) [[=¤=]] => 2 ( ¤》 ) [[=¥=]] => 3 ( ¥︾¥ ) [[=¦=]] => 2 ( ¦¦ ) [[=¬=]] => 2 ( ¬¬ ) [[=¯=]] => 2 ( ¯ ̄ ) [[=´=]] => 2 ( ´´ ) [[=·=]] => 2 ( ·· ) [[=¼=]] => 4 ( ¼୲൳꠰ ) [[=½=]] => 6 ( ½୳൴༪⳽꠱ ) [[=¾=]] => 4 ( ¾୴൵꠲ ) [[=Þ=]] => 6 ( ÞþꝤꝥꝦꝧ )

    Some double-letter characters give some equivalences which allow you to get the right single char to use, instead of the two trivial letters :

    [[=AE=]] = [[=Ae=]] = [[=ae=]] => 11 ( ÆæǢǣǼǽᴁᴂᴭᵆᷔ ) [[=CH=]] = [[=Ch=]] = [[=ch=]] => 0 ( ? ) [[=DZ=]] = [[=Dz=]] = [[=dz=]] => 6 ( DŽDždžDZDzdz ) [[=LJ=]] = [[=Lj=]] = [[=lj=]] => 3 ( LJLjlj ) [[=LL=]] = [[=Ll=]] = [[=ll=]] => 2 ( Ỻỻ ) [[=NJ=]] = [[=Nj=]] = [[=nj=]] => 3 ( NJNjnj ) [[=SS=]] = [[=Ss=]] = [[=ss=]] => 2 ( ßẞ )

    However, the use of these di-graph characters are quite delicate ! Let’s consider these 7 di-graph collating elements, below, with various cases :

    [[.AE.]] [[.Ae.]] [[.ae.]] ( European Ligature ) [[.CH.]] [[.Ch.]] [[.ch.]] ( Spanish ) [[.DZ.]] [[.Dz.]] [[.dz.]] ( Hungarian, Polish, Slovakian, Serbo-Croatian ) [[.LJ.]] [[.Lj.]] [[.lj.]] ( Serbo-Croatian ) [[.LL.]] [[.Ll.]] [[.ll.]] ( Spanish ) [[.NJ.]] [[.Nj.]] [[.nj.]] ( Serbo-Croatian ) [[.SS.]] [[.Ss.]] [[.ss.]] ( German )

    As we know that :

    LJ 01C7 LATIN CAPITAL LETTER LJ Lj 01C8 LATIN CAPITAL LETTER L WITH SMALL LETTER J lj 01C9 LATIN SMALL LETTER LJ DZ 01F1 LATIN CAPITAL LETTER DZ Dz 01F2 LATIN CAPITAL LETTER D WITH SMALL LETTER Z dz 01F3 LATIN SMALL LETTER DZ

    If we apply the regex [[.dz.]-[.lj.][=dz=][=lj=]] against the text bcddzʣefghiijjklljljmn, pasted in a new tab, Columns++ would find 12 matches :

    dz dz e f g h i j k l lj lj

    To sum up, @coises, the key points, of your third experimental version, are :

    A major regex engine, inplemented in UTF-32, which correctly handle all the Unicode characters, from \x{0} to \x{0010FFFF}, and correctly manage all the Unicode character classes \p{Xy} or [[:Xy:]]

    Additional features as \i, \m, \o and \y and their complements

    The \X regex feature ( \M\m* ) correctly works for characters OVER the BMP

    The invalid UTF-8 characters may be kept, replaced or deleted ( FIND \i+, REPLACE ABC $1 XYZ )

    The NUL character can be placed in replacement ( FIND ABC\x00XYZ, REPLACE \x0--$0--\x{00} )

    Correct handle of case replacements, even in case of accentuated characters ( FIND (?-s). REPLACE \U$0 )

    The \K feature ALSO works in a step-by-step replacement with the Replace button ( FIND ^.{20}\K(.+), REPLACE --\1-- )

    To end, @coises, do you think it’s worth testing some regex examples with possible replacements ? I could test some tricky regexes to check the robustness of your final UTF-32 version., if necessary ?

    Best Regards,

    guy038

  • 1 Votes
    15 Posts
    773 Views
    Mark OlsonM

    @4SHAKEN
    In the future you should wrap your code snippets in ``` blocks.

    if foo: blah = -3 return bar() # notice syntax highlighting, indentation preserved else: return zut()
  • [New Plugin] NppOpenAI

    41
    8 Votes
    41 Posts
    24k Views
    AlexandrA

    deepseek For NppOpenAI.ini

    [API]
    secret_key=xxx
    model=deepseek-chat
    temperature=0.7
    max_tokens=0
    top_p=0.8
    frequency_penalty=0
    presence_penalty=0
    api_url=https://api.deepseek.com/beta
    [PLUGIN]
    keep_question=1
    total_tokens_used=22374
    is_chat=0
    chat_limit=10

  • 2 Votes
    1 Posts
    28 Views
    No one has replied
  • 1 Votes
    17 Posts
    308 Views
    CoisesC

    @Alan-Kilborn said in Correct event / 'trigger when' to determine which tab is active after NPP start?:

    Two points:

    What is the true definition of NPPN_READY? Ready for what? Should notifications received before NPPN_READY not be acted upon, or buffered by the plugin until NPPN_READY is received, and then acted upon?

    I don’t think there is a “true” definition other than the code itself. In general, NPPN_READY is a place to do things you only want to do once, but after “most” of the Notepad++ environment is set up — for example, the menus are already built, the tool bars are set up (I think NPPN_TBMODIFICATION comes before NPPN_READY; and you noted that NPPN_SNAPSHOTDIRTYFILELOADED comes before NPPN_READY), I believe dockable panels are up —but the message loop hasn’t yet started and user interaction hasn’t yet become possible.

    Looking over my own plugin, I recall that I ignore NPPN_BUFFERACTIVATED messages before NPPN_READY, but I did need to call my buffer activated process during NPPN_READY, because an NPPN_BUFFERACTIVATED message didn’t reliably come afterward.

    I can work with N++ the way it is, but I’m a scripter, and if PythonScript isn’t forwarding me notifications before it itself receives NPPN_READY, because someone judged that that’s what NPPN_READY means, then I can explore that via a PythonScript “issue”.

    If plugins were never supposed to process messages before NPPN_READY, Notepad++ wouldn’t send them. I have no idea if PythonScript has its reasons for ignoring all messages before NPPN_READY — there might be one-time setup that it does in NPPN_READY that leaves it unable to function earlier — but there is no general expectation that plugins should do that.

  • Populate "Find in Files" - Result Window

    14
    1 Votes
    14 Posts
    181 Views
    PeterJonesP

    … and there’s 2 of my 3 guesses shot down. So that means Don is going to accept the issue/PR without hassle, right? that way, I’m 3/3?!

  • Getting Markdown headers in the function list panel

    2
    0 Votes
    2 Posts
    73 Views
    PeterJonesP

    @Bill-M said in Getting Markdown headers in the function list panel:

    I installed this under my functionlist folder for notepad++

    Did you also update your overrideMap.xml to point to that file? or did you just put your XML in that folder? https://npp-user-manual.org/docs/config-files/#function-list describes

    And when you do, make sure that you have the userDefinedLangName attribute in the new tag in overrideMap.xml match the exact name of the UDL. For example, the pre-installed Markdown UDL that ship with Notepad++ are named Markdown (preinstalled) and Markdown (preinstalled dark mode). If you set userDefinedLangName="Markdown", it would not properly associate with either of the actual UDL that ship with Notepad++.

    For my UDL header list,

    <!-- Other parser definitions here -->

    That’s surprising, and might also be causing you a problem. Since v7.9.1 in 2020, the old functionList.xml was split into separate files in the functionList\ directory; each XML file in that directory should only have one <parser>.

    For example, in my %AppData%\Notepad++\functionList\ directory, I have a file called udl_markdown.xml which looks like,

    <?xml version="1.0" encoding="UTF-8"?> <!-- ==========================================================================\ | | To learn how to make your own language parser, please check the following | link: | https://npp-user-manual.org/docs/function-list/ | \=========================================================================== --> <NotepadPlus> <functionList> <parser displayName="Markdown (preinstalled)" id="Markdown (preinstalled)" commentExpr=""> <function mainExpr="(?x-s)(^\h*\K[#]+\h*(.*?)$|^(.*)(?=[\r\n]+^([-=])\4{2,}\s*$))"/> </parser> </functionList> </NotepadPlus>

    and then in my override map, alongside the example UDL overrides that ship with the default, I added

    <association id= "udl_markdown.xml" userDefinedLangName="Markdown (preinstalled)"/>

    After saving those files, and restarting Notepad++, I successfully have FunctionList show me the # header lines (as well as header lines that have a line of plain text followed by a line of 3 or more --- or ===, as that’s an alternative header nomenclature in some markdown variants) – I’ve been successfully using that for years now.

    commentExpr="(#+)"

    Oh, that might be another gotcha. When the function list parser is looking, if it matches the comment expression, things found within that comment will not be searched for function names. So by saying that #+ is your comment, the FunctionList parser will ignore anything that’s one or more # characters. This means it will probably not ever be able to match your #{1,6} in your function’s mainExpr… I would highly recommend using commentExpr="" rather than giving it a value.

    If I update my <assocation ...> to point to the new definition, and modify your definition to be

    <?xml version="1.0" encoding="UTF-8"?> <NotepadPlus> <functionList> <!-- Markdown headers: Match any line starting with 1-6 "#" characters --> <parser id="md_headers" displayName="Markdown (preinstalled)" ext="md" commentExpr=""> <function mainExpr="(?-s)^[ \t]*(#{1,6}[ \t].+)$"> <functionName> <nameExpr expr="(#{1,6}[ \t].+)" /> </functionName> </function> </parser> </functionList> </NotepadPlus>

    … then it works for me.

    So, to sum up the things I’ve seen:

    you must set an <association ...> tag in your overrideMap.xml, making sure that userDefinedLangName’s value is the exact name of your UDL (probably Markdown (preinstalled) or Markdown (preinstalled dark mode)) and that id is the exact name of your file in the functionList\ directory you should only have one <parser> per functionList\_____.xml file if you define commentExpr, then the parser will not look for function names (or in your case, markdown headers), so make sure you don’t set that to something that interferes with recognizing your headers (I would recommend commentExpr="" , because you don’t need the parser to ignore anything)
  • Adding TCL to functionlist panel

    2
    0 Votes
    2 Posts
    62 Views
    PeterJonesP

    @Bill-M ,

    A Perl script to create a powershell script to create and copy an XML file? That seems a bit indirect. If you’re going to invoke the perl interpreter, why not have your Perl code write the XML to the right location directly? And if you don’t know how to accomplish the same thing in Perl (which it definitely can do), why not just share the powershell script directly instead of “dynamically” generating it using static strings in Perl?

    But that’s neither here nor there, so nevermind.

    Could somebody at notepad++ please add this by default to notepad++:

    The script is obviously not going to be added to Notepad++, nor anything that behaves like that script. If you wanted to take the XML that’s generated by your nested script and have that functionList XML added to the Notepad++ distribution by default, the User Manual has an entire section on how to "Contribute your new or enhanced parser rule to the Notepad++ codebase. So follow those instructions if you want Notepad++ to ship with your TCL functionList definition.

  • Some more options for search & replace dialog

    9
    0 Votes
    9 Posts
    336 Views
    CoisesC

    @Mark-Olson said in Some more options for search & replace dialog:

    I assume that the text portion of the StyledTextFull buffer is UTF8-encoded (if you discard the style bytes), right?

    Not necessarily. I looked at the Scintilla code a bit; there are, internally, two buffers, one containing the text and one containing the style bytes. While there is an API to access the text buffer directly (which I use), there is nothing I can find that does the same for the style bytes. Instead, SCI_GETSTYLEDTEXTFULL steps through both buffers simultaneously, copying first the text byte and then the style byte to the output buffer supplied in the call. (Unless I have misread the code — which is possible, since I didn’t spend a lot of time looking at it — though the documentation for SCI_GETSTYLEDTEXTFULL says it interleaves text characters and style bytes, it actually interleaves text bytes and style bytes.)

    The text could be ANSI or UTF-8 — you have to check SCI_GETCODEPAGE, which in Notepad++ will be either zero (system default code page, aka “ANSI”) or CP_UTF8.

    I had temporarily forgotten that you won’t be working in C++. I doubt that it is practical (maybe not even possible) to write a Boost::Regex iterator in “managed” code. It would probably make more sense to reverse what Scintilla does and split the returned value into a text buffer and a style buffer. Then you could scan the style bytes to determine what ranges to search, and either use whatever regex facilities are available in C# to scan the text, or just ignore the text bytes and use Scintilla find and replace to scan the ranges you identified from the style buffer.

    Given the way Scintilla stores styles (as bytes that correspond one-for-one with the text — unlike indicators, which the documentation says “are stored in a format similar to run length encoding which is efficient in both speed and storage for sparse information”), there is probably no way much faster than scanning byte for byte — it’s just a trade-off between speed (getting it all with one Scintilla call) and memory (getting it byte by byte, so you don’t have to make large copies).

  • Avoid "Document changed outside, reload?" message box

    3
    1 Votes
    3 Posts
    121 Views
    mkupperM

    @Henrik-Haftmann, when you do Ctrl+S from within Notepad++ are you always or nearly always then immediately getting a file-modified pop-up, This may well be something we can look into.

    I had thought that when you do Ctrl+S that Notepad++ writes the file to disk and it then immediately gets the file’s mtime and size from the disk to use as a baseline for the file-modified logic. If your file system is then changing the mtime to better match someone’s granularity standard then can that behavior be changed? How do applications know when the file system is done with fiddling with the mtime?

    Your proposal about comparing the file content means that Notepad++ would need to first make a copy of the file the instant someone starts making changes to the file. Notepad++ probably would start making the copy the moment you open the file. We need a copy of the original file to do the comparison you proposed.

    Computing a hash would have less overhead

    If it were my problem to deal with and I was forced to deal with a file system that keeps fiddling with the mtimes then I would set it up so that I use Notepad++ with local on-disk copies of files and I’d have a background application that synchronizes the local disk files to the external file system. That background application would only change the local disk mtime if and only if the content of the file on the external file system is modified. Basically, I would make my machine part of the AFS network but it would hide the part about that mtimes change.

  • Undo preserving file's mtime

    2
    0 Votes
    2 Posts
    77 Views
    PeterJonesP

    @Henrik-Haftmann ,

    moderator aside:

    Does this “thought” really need a separate discussion from your other two topics? All three of your topics are, to my mind, about essentially the same thing – the mtime/ctime of a file, and how Notepad++ interacts with it (both in deciding whether document-has-been-changed and in how Notepad++ sets one or both of those times). If they are really all related, please keep everything in one of the existing topics, instead of creating a new topic for each thought. It makes it really hard to follow, and hides the fact that other people have replied to other of your thoughts, so eliminates or obfuscates context.

    Let me know which of the three you want as the “parent” conversation, and I can merge them all into one, unless you really believe they are completely distinct conversations which don’t rely on each other for context.

  • Preserve creation file date&time (ctime)

    3
    0 Votes
    3 Posts
    76 Views
    xomxX

    @Henrik-Haftmann

    I tried on my network NAS (webdav), created date/time did not change when I opened, updated & saved an old file using N++:

    npp-NAS-webdav-created-not-changed.png

  • 0 Votes
    6 Posts
    262 Views
    Mojtaba RezaeianM

    Hello Peter

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    So is your account the account named “Administrator”, or is it a normal user account that has administrator privileges? Because my Windows account is a normal user with Admin privileges. The two might not behave the same, depending on circumstances.

    No my account name is user, but with administrator privilages.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    I am curious exactly what steps you took to “update” Notepad++ if it installed a version that’s 2 years old

    Looking at Settings > Preferences > MISC, is the ☐ Enable Notepad++ auto-updater checkmarked or not?

    Thats because I forgot that I disabled auto updates for this reason and I did not expect its more than two years from that time now, but auto updates was enabled at first and selcted template changing was happening after updates so I disabled auto update and after disabling that option I remember notepad++ many times asked me for updating at begining of program and I remember I updated it manually (by accepting that update message) for a few times after disabling update but I decided to accept updates less often specially because of fear of loosing some options and requiring to set them again as like as selecting my prefered theme; and yes Auto update is disabled in my prefrences now, but this background loss was happend recently for a few time, and once exactly when I opened a ticked I thought my auto update option is on and it happend because of update but now I conclude that there must be somethingelse happening separate from updating of program which causes the templates reset too. but I can assure you I haven’t cleared my %appsdata% or restoring or cleaning windows manually and it must be very rare to automatically this happens in my system because I do not install such softwares to clean files or system for me and I do most of the things manually if I see a problem.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    When you updated to v8.4.8, which of the following happened?

    Notepad++ popped up a dialog telling that an update was available, and that update was v8.4.8

    oh yes recenly this happend and I ignored update I think this template change happens even if I ignore it !! I’m not sure about this but I can tell you for next time if such message come up and I ignore to see what happens.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    You went to Notepad++'s ? menu and chose Update Notepad++, and it downloaded and installed v8.4.8

    no I did not updated this way recently

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    You already had a copy of npp.8.4.8.Installer.x64.exe in your downloads directory, so you just ran that one

    No

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    You went to https://notepad-plus-plus.org/downloads/ , and instead of going to the first entry on that page, which would be v8.7.5, you instead scrolled way down on the page to “Download Notepad++ v8.4.8”

    No
    No
    No

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    You went to some other website other than notepad-plus-plus.org or github.com and downloaded Notepad++ v8.4.8 installer from there

    No because notepad++ have an update option in application and its easier than all.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    the version before that one would have been v8.7.4 from earlier in Dec 2024.

    Yess you giving me clues that the template reset is not depending my selection to update or not it always reset my template options after this update warning and make me think the program was automatically updated (Because I trust this app I do not care very much if it update now or later and some time I think I selected yes but in real I was selecting no because of fear of loosing options again and I was focusing to continue reading text file)

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    This still boggles my mind

    It was a suprise for me too, I really didn’t knew I havn’t updated this app for such long time (mostly because of template reset which was my logical address to conclude application is updated again so I must do select template again)

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    L:\Programs\Notepad\notepad++.exe

    Its correct! in my system “L:” means Large volume drive and I always create big L: partition on my partitionings, keep static large files and medias including small applications and every other things which not depends on harddisk speed and OS and can run on any computers and on slow and old hard disks, which are much cheaper and larger than new M.2 and fast volumes. The L: also is very unique letter and helps me to never loose application addresses and file locations after system change. I just change the old volume drive letter on my hard disk to L: which is rarely happens to be occupid on different systems so its kind of portable. Also V: is a similar unique drive letter for me which is always my chosen Vistual drive just for not mistaking with other drives for example DVD/CD drive or connected portable ones. And my windows drive is mostly C: or D:.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    As I said above, when you are a normal user who happens to have Admin power, you don’t have to run Notepad++ “As Administrator” – I almost never do, except when I need to edit a file in the c:\windows or c:\program files hierarchies. (Which is very rare, for me.) I believe that not using “As Administrator” is less likely to give you problems like what you’re having.

    Oh peter, You know a lot!! This is my case too… I’ll tell you why I did this. I sometime code in AHK(autohotkey) so I managed to setup notepad++ to open/edit some files and codes with just pressing a hotkey! saying more clear I have a large AHK file manually written to manage custom hotkeys on my windows and I open/edit many files even itself with its own hotkeys too. For acheiving this I need to run notepad++ from another application(Autohotkey.exe) which would be the parent for notepad++ on that moment and this caused to limit my access to edit some system files from hotkeys. For example when I want to add a line of code to windows system files (like “hosts” file) it gave me error of restricted user so I managed to do something to run notepad++ as adminstrator.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    That’s fine. I frequently run with a true portable. And, in fact, at work, I often used a portable copy but set my file associations and paths so that Windows could associate files with that portable, during a period when my employer made it a hassle to update Notepad++ when it was in C:\Program Files. (They eventually relented, so I went back to a normal installation.)

    I do not prefer this because after uninstall/reinstall I need to do my customizations windows and its apps relations to notepad++ again and they are too many, and I even can not remember all things I did after these years. For example now I can not remember what I did to give notepad++ administrator privilages when it is started from another app, I just searched google and used some tricks guys used and suggested to do this.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    Yes. That is Notepad++'s default behavior. But when you ran the installer, it did ask you whether you wanted to use AppData or not. You are the one who agreed to let it install there.

    So I can reinstall it again and choose right option. I think I can handle it now.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    I disagree vehemently with that statement. I’ve been using the same AppData directories on this computer through its original Windows 10 and all the Win10 updates, through the Windows 11 and all the updates there, and it has correctly maintained those settings. And the %AppData%\Notepad++ setting that I put in on Win10 were the ones I copied over from my previous computer, and probably from the computer before that. My AppData literally has a legacy on the order of a decade. If you think of a decade as being “temporary”, I am impressed with your longevity.

    I really respect your decition and opinion, I can not say anything other than thank you for your helpful messages guiding me a lot.

    @PeterJones said in Selected theme (in style configurator) resets back to default after every program update!:

    From step 4 on, all of Notepad++'s settings will be stored in L:\Programs\Notepad` instead of in the AppData hierarchy

    Now I ran to step 4 and downloaded latest install version after that but I could not find “AppData” checkbox in step after choosing “L:\Programs\Notepad” (and it was “c:\program files\notepad++” by default) so I stopped. Isn’t it better to copy and replace all files from zipped protable version to “L:\Programs\Notepad”??

  • New (incomplete) LSP client plugin

    59
    4 Votes
    59 Posts
    7k Views
    EkopalypseE

    @mpheath

    Thank you very much - and disabling it again in my init routine seems to solve the current problem, but I’m not sure if there isn’t an underlying issue here. I mean, why does this only happen when multiple documents are used in a single window? I will do some tests in the next few days.

  • Message box with specific icon

    4
    0 Votes
    4 Posts
    109 Views
  • My plugin's toolbar sometime looses it's trigger to be drawn

    1
    0 Votes
    1 Posts
    58 Views
    No one has replied
  • 3 new themes

    4
    5 Votes
    4 Posts
    306 Views
    benelaciB

    The themes have been uploaded to the n++ theme repo at GitHub. Thank you @PeterJones.

    One setback: The “Tangara” theme depends on some fonts being installed (because of the use of 4 different font weights), and the repo hosts single theme files, so I can’t supply the fonts there. (I don’t think there’s ever been a font-dependent theme in history.) So I created a “Tangara (Font-free version)” theme, that’s the one being uploaded there. While it functions as a theme, it looks much poorer than the Original that’s linked on this page.

  • Rust Syntax Highlighting

    8
    1 Votes
    8 Posts
    220 Views
    PeterJonesP

    Moderator Note: this was taking over the LSP discussion, which would make it harder for people in the future to use the LSP Topic for LSP-focused discussion. I moved this portion of the discussion to a separate Topic, so that it can stay focused on syntax highlighting.

    The first two posts needed to be merged into one, because somehow the original fork swapped the order of the two posts, which made this topic confusing.