• User define Language question

    3
    0 Votes
    3 Posts
    134 Views
    PeterJonesP

    @MURIM-BAUDIN said in User define Language question:

    I am assuming is possible as pre-user SHELL language manage to do it.

    To clarify, the pre-defined languages are all made with custom code compiled into the Notepad++ source; the UDL are all based on simple text-matching without any wildcard ability or any such “fancy” features. Just because something can be done in a built-in lexer doesn’t mean it can be replicated in UDL.

    For anything more complicated than simple text-matching, UDL is not sufficient. You would either need something like a lexer plugin, or have another plugin (like @Ekopalypse’s EnhanceAnyLexer, already mentioned) that could provide an alternative method of doing the highlighting.

  • 0 Votes
    7 Posts
    171 Views
    guy038G

    Hello, @dr-ramaanand, @coises and All,

    I tried to simplify the @coises search regex and I ended up with this search regex :

    (?s-i)(<(.+?)[> ].*?(?:/>|</\2>))(*SKIP)(*F)|(?-s).+\R

    So, given your INPUT text :

    <html lang="en"> <head> <meta http-equiv="Content- Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <META name="viewport" content="width=device-width, initial-scale=1" /> <h1>BOTHROPS</h1> <p style="color: black; font-family: Verdana,sans-serif; font-size: 18px; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; display: inline ! important; float: none;">BOTHROPS LANCEOLATUS uses [Both-l uses]</p> Haemor- rhages- dark Fear- of death E-mail us <h6>Remedies A- Z</h6> <ul> Some- list- here Dunking- donuts Seventytwo- houris </ul> <style type="text/css"> @media (min- width: 1281px) { .left { width: 180px; border-width:1px; border-style:solid; border-color:lightblue; padding-top:10px; } .right { width: 560px; border- width:1px; border- style:solid; border- color:lightblue; margin- top:0px; } } </style> <script type="text/javascript"> function googleTranslateElementInit() { new google.translate.TranslateElement({pageLanguage: 'en'}, 'google- translate- element'); } </script>

    This regex just matches the three consecutive lines, below :

    Haemor- rhages- dark Fear- of death E-mail us

    Note that I deliberately added an other string r-, followed with a space character, for tests !

    Thus, the following regex S/R :

    SEARCH (?s-i)(<(.+?)[> ].*?(?:/>|</\2>))(*SKIP)(*F)|(?<=\w)-(?=\x20)

    REPLACE \x20-

    Will replace, in these three lines ONLY, any string letter-, followed with a space char, with the string letter - and a space char

    Best Regards,

    guy038

  • Control characters: ESC & ^char

    5
    0 Votes
    5 Posts
    24k Views
    Simon ForsythS

    @Ken-Yiu Because this post keeps popping up as first search:
    Notepad++ has a Character Panel
    Edit > Character Panel
    The panel should pop up on the left, and you can click on the 27 ESC row, make sure you click on the correct column. This will insert the escape character at the cursor.

  • Remove data lines with same value in certain column

    11
    0 Votes
    11 Posts
    332 Views
    guy038G

    Hi, @jizhao-li, @coises, @mark-olson and All,

    Ah… OK. Thanks, @jizhao-li, for your additional pieces of information :-)

    Then, from this INPUT text, below :

    GAP 1461 311 1826 311 2191 311 2556 311 2921 311 3287 311 3652 311 4017 311 4382 311 4748 311 5113 311 5478 311 5843 311 6209 311 6574 311 6939 311 7304 311 7670 311 8035 311 8400 311 8765 311 9131 311 9496 311 9861 311 10026 311 10592 311 10957 311 11322 311 11687 311 12053 311 12418 311 12783 308 13148 308 13514 308 13789 308 END GAP 1461 303 1826 303 2191 303 2556 303 2921 303 3287 303 3652 303 4017 303 4382 303 4748 303 5113 303 5478 303 5843 303 6209 303 6574 303 6939 303 7304 303 7670 303 8035 303 8400 303 8765 303 9131 303 9496 303 9861 303 10026 303 10592 303 10957 303 11322 303 11687 303 12053 303 12418 303 12783 303 13148 303 13514 303 13789 303 END GAP 1461 327.5 1826 327.5 2191 327.5 2556 327.5 2921 327.5 3287 327.5 3652 327.5 4017 327.5 4382 327.5 4748 327.5 5113 327.5 5478 327.5 5843 327.5 6209 327.5 6574 327.5 6939 327.5 7304 327.5 7670 327.5 8035 327.5 8400 327.5 8765 327.5 9131 327.5 9496 327.5 9861 327.5 10026 327.5 10592 327.5 10957 327.5 11322 327.5 11687 327.5 12053 327.5 12418 327.5 12783 327.5 13148 327.5 13514 327.5 13789 327.5 END GAP 1461 302 1826 302 2191 299 2556 299 2921 299 3287 299 3652 299 4017 299 4382 299 4748 299 5113 299 5478 299 5843 299 6209 302 6574 302 6939 302 7304 302 7670 302 8035 302 8400 302 8765 302 9131 302 9496 302 9861 302 10026 302 10592 302 10957 302 11322 302 11687 302 12053 302 12418 302 12783 302 13148 302 13514 302 13789 302 END

    The following regex S/R should do the work nicely :

    SEARCH (?-is)^(GAP\R)(\d+ (\d+(?:\.\d+)?)\R)+?(?=\d+ (?!\3$))

    REPLACE \1\2

    And here is your expected OUTPUT text :

    GAP 12418 311 12783 308 13148 308 13514 308 13789 308 END GAP 1461 303 1826 303 2191 303 2556 303 2921 303 3287 303 3652 303 4017 303 4382 303 4748 303 5113 303 5478 303 5843 303 6209 303 6574 303 6939 303 7304 303 7670 303 8035 303 8400 303 8765 303 9131 303 9496 303 9861 303 10026 303 10592 303 10957 303 11322 303 11687 303 12053 303 12418 303 12783 303 13148 303 13514 303 13789 303 END GAP 1461 327.5 1826 327.5 2191 327.5 2556 327.5 2921 327.5 3287 327.5 3652 327.5 4017 327.5 4382 327.5 4748 327.5 5113 327.5 5478 327.5 5843 327.5 6209 327.5 6574 327.5 6939 327.5 7304 327.5 7670 327.5 8035 327.5 8400 327.5 8765 327.5 9131 327.5 9496 327.5 9861 327.5 10026 327.5 10592 327.5 10957 327.5 11322 327.5 11687 327.5 12053 327.5 12418 327.5 12783 327.5 13148 327.5 13514 327.5 13789 327.5 END GAP 1826 302 2191 299 2556 299 2921 299 3287 299 3652 299 4017 299 4382 299 4748 299 5113 299 5478 299 5843 299 6209 302 6574 302 6939 302 7304 302 7670 302 8035 302 8400 302 8765 302 9131 302 9496 302 9861 302 10026 302 10592 302 10957 302 11322 302 11687 302 12053 302 12418 302 12783 302 13148 302 13514 302 13789 302 END

    Some other tests, all OK ! On the left the INPUT text and on the right the OUTPUT text :

    GAP 4017 123 4382 123 GAP 4748 123 5478 123 5113 123 5843 456 5478 123 6209 456 5843 456 => 6574 456 6209 456 6939 456 6574 456 7304 456 6939 456 END 7304 456 END GAP 4017 123 4382 123 GAP 4748 123 5478 123 5113 123 5843 456.789 5478 123 6209 456.789 5843 456.789 => 6574 456.789 6209 456.789 6939 456.789 6574 456.789 7304 456.789 6939 456.789 END 7304 456.789 END GAP 4017 123 4382 123 GAP 4748 123 5478 123 5113 123 5843 123.789 5478 123 6209 123.789 5843 123.789 => 6574 123.789 6209 123.789 6939 123.789 6574 123.789 7304 123.789 6939 123.789 END 7304 123.789 END GAP 4017 123.012 4382 123.012 GAP 4748 123.012 5478 123.012 5113 123.012 5843 456 5478 123.012 => 6209 456 5843 456 6574 456 6209 456 6939 456 6574 456 7304 456 6939 456 END 7304 456 END GAP 4017 123.012 4382 123.012 GAP 4748 123.012 5478 123.012 5113 123.012 5843 123 5478 123.012 => 6209 123 5843 123 6574 123 6209 123 6939 123 6574 123 7304 123 6939 123 END 7304 123 END GAP 4017 123.012 4382 123.012 GAP 4748 123.012 5478 123.012 5113 123.012 5843 456.789 5478 123.012 6209 456.789 5843 456.789 => 6574 456.789 6209 456.789 6939 456.789 6574 456.789 7304 456.789 6939 456.789 END 7304 456.789 END GAP 4017 123 GAP 4382 123 4748 123 4748 123 5113 456 5113 456 5478 456 5478 456 5843 456 5843 456 => 6209 456 6209 456 6574 123 6574 123 6939 123 6939 123 7304 123 7304 123 END END GAP 4017 123.012 GAP 4382 123.012 4748 123.012 4748 123.012 5113 456.789 5113 456.789 5478 456.789 5478 456.789 5843 456.789 5843 456.789 => 6209 456.789 6209 456.789 6574 123.012 6574 123.012 6939 123.012 6939 123.012 7304 123.012 7304 123.012 END END

    Note that your file will be unchanged if you redo the search-replacement !!

    Best Regards,

    guy038

  • How to replace only one period or dot and skip the others ?

    9
    -1 Votes
    9 Posts
    297 Views
    dr ramaanandD

    @guy038 I was trying to skip finding/matching the dots and periods (full stops) that I understood were necessary and find the rest.
    I finally found just two or three unnecessary ones out of a folder containing 300+files using this Regular expression:-

    (<link[\S\s]*?<\/h1>)(*SKIP)(*F)|(<div style="margin-bottom:-15px;width: 100%;background-color:#EBF4FB;">[\S\s]*?<div class="left">)(*SKIP)(*F)|(<!--[\S\s}*?\-->)(*SKIP)(*F)|(<[\S\s]*?>)(*SKIP)(*F)|(Note:[\S\s]*?<\/span>)(*SKIP)(*F)|(\.\s*\w)(*SKIP)(*F)|(<ul[^<>]*+>[\S\s]*?</ul>)(*SKIP)(*F)|(<style[^<>]*+>[\S\s]*?</style>)(*SKIP)(*F)|(for\s*any\s*questions\/\s*treatment\s*\.)(*SKIP)(*F)|(Efficacy\s*studies\s*\.)(*SKIP)(*F)|(All\s*rights\s*reserved\s*\.)(*SKIP)(*F)|(a\.m\.)(*SKIP)(*F)|(p\.m\.)(*SKIP)(*F)|(\.\s*\[)(*SKIP)(*F)|(\.\s*\()(*SKIP)(*F)|(\]\.)(*SKIP)(*F)|(etc\.)(*SKIP)(*F)|(C\.V\.S\.)(*SKIP)(*F)|(C\.V\.A\.)(*SKIP)(*F)|(C\.N\.S\.)(*SKIP)(*F)|(G\.I\.T\.)(*SKIP)(*F)|(\.\])(*SKIP)(*F)|(\.\))(*SKIP)(*F)|(B\.P\.)(*SKIP)(*F)|(\.\s*&lt;)(*SKIP)(*F)|(\.\s*&gt;)(*SKIP)(*F)|(\.\s*')(*SKIP)(*F)|(\.\s*&quot;\w)(*SKIP)(*F)|(\.,\s*\w)(*SKIP)(*F)|(\.\s*")(*SKIP)(*F)|(M\.D\.)(*SKIP)(*F)|(R\.S\.)(*SKIP)(*F)|(identity\.)(*SKIP)(*F)|\.

    Thanks a lot guys! Please keep helping people who ask questions here, I don’t know who else will. Thanks again!

  • UDL token cannot be both folding indicator and operator/delimiter.

    8
    0 Votes
    8 Posts
    319 Views
    Lycan ThropeL

    @HalfOffHell said in UDL token cannot be both folding indicator and operator/delimiter.:

    If you don’t know any workarounds, can you point me to where in the source code the coloring/folding/UDL happens? You seem like a well-informed person.

    Thanks, but I’m not that guy…I just spent a year and half wrestling with the different parts to come up with my own UDL package leaning heavily on the more expert users here.

    I’m not sure if you’re working backwards from the normal process, as most people create the color highlighting UDL, first, using the rules of the UDL 2.1 language to implement their chosen language, and then enhance color processing with the EnhanceAnyLexer plugin that the UDL didn’t. Then they implement the FunctionList functionality or the Autocomplete functionality to get a somewhat more complete IDE type environment.

    You sound like you started with EnhanceAnyLexer and are now trying to force the UDL to work with those things. Like I always say, more complexity leads to more problems. I still don’t understand why you need that multi-faceted use out of a single keyword or keyword/pair. Are you actually doing a language or just experimenting with the capabilities of doing something short of writing a plugin or submitting changes to the Notepad++ base code?

    The UDL is a part of the source code of Notepad++, and is located on NPP’s GitHub Repository. Any changes except for your own use, would have to be submitted to the developer for approval of inclusion to the base code.

    In addition, Notepad++ uses the Scintilla/Lexilla libraries for the editor’s capabilities.

    @HalfOffHell said in UDL token cannot be both folding indicator and operator/delimiter.:

    I don’t see why or how operators and delimiters would interfere with folding, they are just for color I think?

    They do because they are being searched differently. To use the open keyword as an Operator, it has to go into Operator 2, which uses a backward searching capability, and the Delimiters and Code Folding uses the Forward search.

    You should read more of the manual, and the UDL 2.1 spec layed out in both the Online User Manual and the Ivan Radic documentation, and try to see how everything works together as is.

    I don’t think the system as is, is going to work the way you want. You might need to employ using the PythonScript capabilty, or writing your own parser as a plugin. All of these are going to involve becoming familiar with the capabilities and functions of the Scintilla libraries and there are much more knowledgeable individuals here that can help you further, if you start posting actual information rather than just screenshots and vague statements about what you’re doing.

    Edit: I just noted that your screenshot states it’s a C++ UDL, so my guess is, that you’re trying to further expand C++, which is beyond my ability to help, as originally I tried using the C++ FunctionList as an example for mine and went quickly down a rabbit hole, just barely able to get out before I lost my mind. :-)

  • 0 Votes
    2 Posts
    109 Views
    PeterJonesP

    @lkbuaa said in Notepad++ doesn't display some characaters well like ㊤ ㊦:

    I am not sure what the root cause is

    Notepad++ itself is not restricted from showing glyphs for those characters:

    f157a7da-5c5d-4fcd-b3ba-37a617be421a-image.png

    Either your font doesn’t support it, or you need to try to toggle your setting for the Settings > Preferences > MISC > Use DirectWrite and restart Notepad++

  • Few Questions about selection, copy & masked paste

    14
    0 Votes
    14 Posts
    430 Views
    Dean-CorsoD

    Hello @Terry-R,

    thanks again for that new detailed info’s about RegEx. I was testing a little around and now I see what you mean about that selection thing I would like to do. So it means I just can do it with a RegEx pattern only without any manually mouse move / key buttons. I also did notice that the entire pattern / data I do paste in the search mask gets also saved like that if I record a macro. So before I thought it would be just save every single key press or combo only. That’s a good news for me. Now it’s working to make the selection between 2 markers and do anything with it.

    @Alan-Kilborn
    What do you mean? Just wanna know and find out answers to the question I have you know.

  • 0 Votes
    24 Posts
    30k Views
    Eugene TenenbaumE

    @Alan-Kilborn,
    Since when making Notepad++ resistant to file saving failures does not add value to it? Since when making products less prone to failure by any legal means possible is not adding value to them? Since when an employee who does one thing cannot do another, easier one? Is it beneath the dignity of a software developer?

    Do you subscribe to the famous line from “Oliver Twist”: “Please, sir, I want some more”? We do not live in the 1830s of Charles Dickens anymore. I found a solution and generously shared it with all. Do you want more charity from me? Didn’t I do enough already?

    Good luck with starting thinking, like businessmen aiming at perfecting their products, esp. by easy contacting someone to contribute to that in his own interest and not doing it by themselves. Too much?
    –Eugene

  • Comments in function list

    9
    0 Votes
    9 Posts
    465 Views
    PeterJonesP

    @Demetrio-Foti said in Comments in function list:

    I’d like just to know if the fix is planned in the very next releases or not

    It is not planned, no. The bug has been known about for at least 7 years, so if it’s been around that long, it’s not likely to get fixed in the near future.

  • Replace-All can only replace up to 2046 characters long

    6
    0 Votes
    6 Posts
    242 Views
    Jim HarrisJ

    As @mkupper said, anchors and regular expressions are the magic spells that I use to untangle lines - or even files, (like blobs of downloaded bank data) - that are hopelessly mangled together.

    Depending on how mangled the data is, it may take several tries - with a number of mistakes - before you get things the way you want them.

    It can be a process and don’t forget to make periodic backup saves in case you have to “undo” a search-and-replace.

    In my case I use Notepad++ to untangle downloaded bank data for tax purposes and, (depending on the size of the file and how mangled it is), it can take days to complete.

    Be patient. Print out a regular expression cheat-sheet if you need one. (I did) And don’t give up even if it seems like you’re going backwards.

  • posting help

    5
    0 Votes
    5 Posts
    187 Views
    Alan KilbornA

    @Bob-Smith said in posting help:

    so I could share pictures

    If you’re trying to share screenshots illustrating your Notepad++ problem, just copy them to the clipboard and paste directly into your posting.

  • NON utf-8

    6
    0 Votes
    6 Posts
    346 Views
    CoisesC

    @dr-ramaanand said in NON utf-8:

    I have the same problem. How to make those Chinese and other characters readable again like before?

    Based on the original poster’s comment, I don’t think it is the same problem. The original poster apparently wanted to identify characters that wouldn’t save properly in non-Unicode files so he could remove or replace them. My solution is only partial (it doesn’t take into account what non-ASCII characters are available in his default code page, and therefore perhaps would not need to be removed), but we’ll have to wait to see if he responds to know if he needs more ideas.

    I recommend you post this as a new question, as it appears to be different from the problem under discussion here. In any case, we will need more information. Since you write “like before,” part of that information should be what changed between “before” and “now.” Please be sure to include the information from ? | Debug Info… | Copy debug info to clipboard when you post.

  • 0 Votes
    33 Posts
    13k Views
    Maria BenichM

    @Maria-Benich Thank you! It worked perfect!

  • UI hangs when doing a large search-in-files

    3
    2 Votes
    3 Posts
    398 Views
    Alan KilbornA

    @James-John-McGuire

    Maybe give an example of the search you’re attempting.
    Probably only knowing the circumstances better can others offer advice on how to possibly improve things for you.

  • How to find out what txt files were open in the last session?

    10
    0 Votes
    10 Posts
    1k Views
    Richard HydrickR

    First, open the Sessions.xml within the below folder and it will show you all the files that were open. In my case it was just before my computer crashed as I just recovered from a failed TPM on my computer but the drive was still good.
    (*C:\Users\Username\AppData\Roaming\Notepad++*)

    If you can gain access to your old drive copy the folder backup and move to your new instance of Notepad++ copying to the same file location above, then select all documents within and open with Notepad++ and you will have all your saved and unsaved notes.

    Hope this helps.
    Richard

  • Smart Highlight not working

    11
    0 Votes
    11 Posts
    454 Views
    Lycan ThropeL

    @Ekopalypse ,
    Bingo, we have a winner. I have no idea why that color was selected as the same background, or…it was by default and then when I changed my background color to what it is now, the conflict occurred. I never noticed it, but I’ve changed it to a cyan, and it does show up now.

    Thanks for that catch.

    Thanks to all for their suggestions, and maybe the OP can now check his settings to solve his problem.

    OP, might have the same problem. If you notice, the first with has different coloring than the others, I suspect the result of the current selection color choice being melded with the SmartHighlighting background color.

    871HighlightFix.PNG

  • Odd (?) caret placement with auto-indent

    18
    3 Votes
    18 Posts
    510 Views
    CoisesC

    @Alan-Kilborn said in Odd (?) caret placement with auto-indent:

    In theory I would turn basic auto-indent on for “normal” text files, to get the benefits of a “fix” for such files. However, for Python and C++ files, I want/need advanced auto-indent. But, I can’t do this (again, it’s global: basic OR advanced).

    The code for Auto-indent: Advanced splits into three cases: C-like languages, Python and everything else; everything else uses the same code as Basic. The same change I proposed for Basic could be made there.

    The reason I separated the two cases is that what I propose doing to Basic is simple and straightforward. I want to ignore the configured indent settings and just duplicate the indentation of the previous line. I was able, with reasonable confidence, to devise a commit which I believe implements that without causing side-effects.

    The code for Advanced (except when it falls back to Basic) is far more complex, and of course it can’t ignore the indentation settings. The reason I didn’t suggest applying my change for Basic to Advanced when it falls back to Basic is that Advanced doesn’t just copy the existing indentation, it recomputes it, whether it is changing or not, according to the indentation settings (tabs or spaces). I thought it might be bizarre to have Auto-indent: Advanced sometimes change the indentation style to match the configuration and sometimes not.

    I suggested something as to how Auto-indent: Advanced could be changed to fix the specific problem you mentioned, but I did not give an example commit, because I have not yet been successful at creating one. So far, for each attempt I’ve made I’ve quickly found some unwanted side-effect.

    Part of the difficulty, also, is that after some experimentation with the unmodified version, there are some corner cases for which I do not follow the logic of the current behavior (or if some of that might be unintended). Example:
    void func() { return; }
    Start with that in language C++. The results of placing the caret after { and pressing Enter, then placing the caret after ; and pressing Enter are not the same as the results of placing the caret after ; and pressing Enter, then placing the caret after { and pressing Enter. In the latter order, the blank in “; }” is not absorbed; however, if you start with the line indented one level and do the same thing, the blank is absorbed. Either way, the caret winds up at the beginning of the line, as per your initial complaint.

  • Shortcut or menu path to "Rotate to right/left"

    18
    1 Votes
    18 Posts
    3k Views
    deleeleeD

    @Ekopalypse said in Shortcut or menu path to "Rotate to right/left":

    @deleelee

    UPDATED VERSION

    from ctypes import wintypes, WinDLL from Npp import notepad class ViewRotator(): def __init__(self): self.LOWORD_LEFT = 2000 self.LOWORD_RIGHT = 2001 self.WM_COMMAND = 0x111 self.toggle_rotating_direction = False self.npp_hwnd = WinDLL("user32").FindWindowW(u'Notepad++', None) self.splitter_hwnd = WinDLL("user32").FindWindowExW(self.npp_hwnd, None, u'splitterContainer', None) self.send = WinDLL("user32").SendMessageW self.send.argtypes = [wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM] self.send.restype = wintypes.LPARAM # LRESULT def rotate(self): if not notepad.isSingleView(): if self.toggle_rotating_direction: self.send(self.splitter_hwnd, self.WM_COMMAND, self.LOWORD_RIGHT, 0) else: self.send(self.splitter_hwnd, self.WM_COMMAND, self.LOWORD_LEFT, 0) self.toggle_rotating_direction = not self.toggle_rotating_direction if not hasattr(notepad, "rotateSplitView"): notepad.rotateSplitView = ViewRotator().rotate notepad.rotateSplitView()

    Wowsers!!! That is perfect. Thank you so much.

  • ChatGPT failed to help me replace....

    3
    0 Votes
    3 Posts
    153 Views
    Pulamea PulataP

    @Coises I found the solution before my post was even allowed by the moderation team , I make websites my client is an official partner of x website and is allowed to sell their products , and is way faster to scrape them and import them than ask them for the exported products since the sites are made in different platforms