• Editing Persian text

    8
    0 Votes
    8 Posts
    1k Views
    Varoujan AdamianV

    @Ekopalypse Thank You

  • Help or little bug

    3
    0 Votes
    3 Posts
    186 Views
    Alan KilbornA

    @Andrea-Astolfi-0

    Long known issue; see HERE.
    Not sure it is an issue for everyone, as it doesn’t seem to affect me.

  • Don't treat parenthesis as codeblocks start/end

    2
    0 Votes
    2 Posts
    175 Views
    PeterJonesP

    @geoslake ,

    Without editing the source code and compiling your own copy of Notepad++ and the libraries it ships with, you are not able to change the logic of the built-in languages like C++. It would be a lot easier to create a User Defined Language (UDL) than it would be to modify the logic for C++.

    I would suggest trying to learn the UDL. You don’t tell us anything about your pseudo-language for your “passwords and things” (whether there are “keywords” you want to have highlighted, whether you use braces for nesting, and that sort of thing), so it’s hard to give you any hints. But the Language > User Defined Language > Define Your Language has a link to its documentation in the dialog box / panel, and that documentation is pretty newbie-friendly, IMO.

    -----
    edt: “don’t treat parentheses as codeblocks start/end” => do you mean () (which are generally called parentheses) or {} (which are often called curly braces or just braces). If you don’t want curly braces to be interpreted as blocks for indentation/folding, then the CPP lexer really isn’t the best choice for you. I really think you need to show us some example text (use the </> in the forum to mark that text as plain text), then paste in a screenshot of the text as highlighted by the lexer, and maybe explain which elements of the highlighting you like, and which you don’t. Because if all you have is a list of keywords that you want highlighted, then the UDL is dead simple: just go to the keywords tab, type those keywords, assign a color in the Style button, and maybe put a default extension for your so that a file with that extension will always use your UDL.

  • code block trigger string doesnt work when first character is ";"

    Locked
    8
    0 Votes
    8 Posts
    4k Views
    PeterJonesP

    Future Readers,

    As mentioned in a 2023 follow-on conversation:

    the “problem” was because ; was defined as the start of a comment for comment-highlighting. The UDL parser doesn’t look for Fold in code 1 or Fold in code 2 keywords for folding when they are contained in Comment lines. Instead, if ; is defined as the start-of-comment-line in the Comment & Number tab, then on the Folder & Default tab, you can define Folding in comment’s open/close pair, and that will allow a special keyword pair to work for folding using comments to start and end the folding. This is true in 2023’s v8.5.3, and this was true in 2016’s v6.9.2.

    Follow-up discussion on this should go in the follow-on conversation rather than in this ancient conversation, which is being locked.

  • 0 Votes
    11 Posts
    632 Views
    PeterJonesP

    @waskoma said in strings starting with “;” ignored when given in codeblock start/end string definition:

    so I have managed to achieve it and am REALLY happy. Gave up solving this a long long time ago (have already asked here and got answer it can not be done)

    in 2016, it looks like you both forgot to come back and follow up on the conversation, so it was never resolved; that’s not quite the same as being told it cannot be done. Under this username, you have no other posts.

    not related to this topic but can I ask more? I have hexadecimal numbers with prefixes $ or #$ and these numbers have abcdef letters in them, they are not recognised as numbers the moment it finds a non numeric character, is there a way to solve that ?

    Prefix 2 is where you put the prefix you want before hex numbers – in your case, $ #$ will allow either $ or #$ as the prefix. Extras 1 is where you put the extra characters that can be a part of a hex number – in your case A B C D E F a b c d e f (the comparison in UDL for that is case sensitive, so if you want it to match upper and lower case for hex digits, you have to include both upper and lower case)

    c31e41d9-04a9-44fe-a47b-fb7001fc4c50-image.png

    BTW: That’s in the UDL docs at https://ivan-radic.github.io/udl-documentation/ – which are linked from the UDL dialog – specifically, on the Numbers page. They give the example of how to make 0xABC work, and from there, you really should have been able to generalize that to make $ABC or #$ABC work.

    also what causes these orange vertical lines show up ? and how to style the codeblock opener closer + and line ? a million thanks :)

    As you discovered, that’s the new Change History feature (v8.4.6), as described in our FAQ.

  • Fixed Format FORTRAN Highlighting

    7
    0 Votes
    7 Posts
    836 Views
    PeterJonesP

    @Daniel-Crosby ,

    EnhanceAnyLexer does not change bold/italic/underline, so it cannot do the job. If you change the Style Configurator for the keywords to turn off bold, then the EnhanceAnyLexer color-change should be sufficient for you – though of course, that means that keywords in non-comment lines would just be colorful without any bolding.

  • Restore temp item - Please Help..

    3
    0 Votes
    3 Posts
    3k Views
    Mark OlsonM

    There’s also the %AppData%\Local\Temp\Notepad++ RECOV folder. The files in that folder will have the .dump extension. Don’t know how reliably N++ will write unsaved files to that folder, but it’s worked pretty well for me recently.

  • Open file...

    5
    0 Votes
    5 Posts
    262 Views
    CoisesC

    If you edit the properties of the shortcut you use to start Notepad++ and change “Start in:” to the folder you want, File|Open… will use that folder as default until another is established.

  • Search a number grater than

    9
    0 Votes
    9 Posts
    2k Views
    Mark OlsonM

    @Alan-Kilborn
    With your script as inspiration, I made one that has a different custom search func for each file, allows the user to set the search func with selected text, and the user can choose whether or not to bookmark lines.
    63ddf9b8-22a9-411a-8448-33a055dcf3fa-image.png

    # -*- coding: utf-8 -*- # references: # https://community.notepad-plus-plus.org/topic/24481 from Npp import * import operator import re # Too lazy to parse config files; just modify these global variables instead BOOKMARK_LINES = True class FBOLTN: def __init__(self): self.set_comparator() def set_comparator(self): comparator_regex = re.compile("([><]=?|=)(-?\d+)") sel = editor.getSelText() mtch = comparator_regex.search(sel) if mtch: # user is selecting a new comparator compstr, numstr = mtch.groups() num = int(numstr) else: if hasattr(self, 'comparator'): return # only override current comparator with valid selection # default is what the OP wanted compstr = '>=' num = 25 self.compstr = compstr self.num = num def comparator(other_num): fun = { '>': operator.gt, '<': operator.lt, '=': operator.eq, '>=': operator.ge, '<=': operator.le, }[compstr] return fun(other_num, num) self.comparator = comparator def custom_match_func(self, m): if self.stop: return i = int(m.group(0)) start, end = m.start(0), m.end(0) if self.comparator(i): editor.setSel(start, end) if BOOKMARK_LINES: notepad.menuCommand(MENUCOMMAND.SEARCH_TOGGLE_BOOKMARK) self.stop = True def search(self): self.stop = False editor.research(r'(?<!\w)-?\d+\b', self.custom_match_func, 0, editor.getCurrentPos()) if __name__ == '__main__': try: fboltns except NameError: fboltns = {} cur_fname = notepad.getCurrentFilename() if not fboltns.get(cur_fname): fboltns[cur_fname] = FBOLTN() fboltn = fboltns[cur_fname] fboltn.set_comparator() fboltn.search()
  • Appropriate command to change lines using regular expressions

    9
    1 Votes
    9 Posts
    470 Views
    J

    @guy038 I didn’t have the chance to thank you very much for your support! It worked very well!

  • Need help deleting any text between other text

    3
    0 Votes
    3 Posts
    349 Views
    ImgemaI

    Thank you!

  • Delete lines beginning with X to ending with Y

    4
    0 Votes
    4 Posts
    1k Views
    Robert OramR

    Thank you so much for your prompt help! They both work perfectly!

    Bob

  • Underlining links.

    10
    0 Votes
    10 Posts
    648 Views
    Lycan ThropeL

    @rdipardo ,
    Here’s a perfect example, of what I mean. From my Mother in law, I learned to say that backwards, Bardzo dziękuję. Been a while since the course, so I can’t challenge the translator, but that’s the point. :-)
    It’s dependent on the translation and how it’s getting done. ;)

  • Sélectionner le texte marqué / Select marked Text

    18
    0 Votes
    18 Posts
    3k Views
    Denis AdraD

    Hey hi @guy038 , I’m coming back to you

    It’s been a busy day between yesterday and today.

    Thanks for the new information. The method you propose is very interesting. Longer and a little more complicated than @Terry-R 's but in the end safer because it is true that when you finalize, there are no mistakes left. Where it can often remain with a numbering system that by dint of being cut and pasted and even sometimes unexpectedly taken in the selection that will pass to the translation, it happens that it gets mixed with the paragraphs. In the end, the time I save with the numbering system, I often lose later to detect and correct the mistakes. Note, this is entirely my fault because I could have or should have made a selection in columns.

    In order not to let your help and efforts go to waste, I used your method on the 10 or so small files I had left and it works very well. Many thanks to you!

    A huge thank you also to @Terry-R , because his method arrived quite quickly. At a time when I was more than tired of editing a 400k file by hand and wanted to give up more than once!

    Finally, thank you all for all this advice @guy038 @Terry-R @PeterJones . As I said before, I am not an expert in notepad++ at all. I’ve done a degree in computer science 15 years ago, but I’m not at all specialized in programming and I’m doing totally different things today. I found all these little tips very interesting and I’m sure they will be very useful in the future. Thanks again to both of you!

    I’ve completely finished the translation, for the rest I’ll only have to touch up the fonts and make corrections that I would have noticed in game.

  • 0 Votes
    6 Posts
    2k Views
    Mark OlsonM

    I like the solutions proposed above because they are relatively simple and to-the-point. However, regex-replaces on JSON in general get pretty hairy due to factors including but not limited to:

    how do you differentiate between a pattern in a key versus a string? how do you take into account the fact that JSON doesn’t care about the order of keys whereas regexes do? what if there are ] or } inside strings, such that the regex is fooled into thinking the JSON object ended?

    Just to illustrate how annoying regex-replaces get once you start trying to satisfy all the syntactic requirements of JSON, here’s a regex-replace I came up with to achieve this while ignoring insignificant whitespace and the order of keys and removing any trailing commas:
    find/replace (?-i),\s*{(?:[^{]*{[^}]*}\s*,\s*"model"\s*:\s*"[^"]*KeepInfo[^"]*"\s*|\s*"model"\s*:\s*"[^"]*KeepInfo[^"]*"[^{]*{[^}]*}\s*)}\s*(,)? with \1.

    JsonTools is a fine solution for this, if you’re able to use plugins.

    Because it uses a JSON parser to parse the JSON, it is insensitive to the formatting of the JSON.

    To filter JSON with the plugin, just use Alt-P-J-J (tap the keys in sequence, don’t hold them down simultaneously) to open the tree view, then enter one of the following queries into the query box and hit Ctrl+Enter, then Save query result.
    Two queries that accomplish your goals:
    @[:][not(@.model =~ `(?i)keepinfo`)] filters out objects where the model includes keepinfo ignoring case.
    @[:][not(@.model =~ KeepInfo)] filters out objects where the model includes KeepInfo in that case only.

    While I’m here, PythonScript is also an efficient solution:

    import json from Npp import editor j = json.loads(txt) filtered = [o for o in j if 'KeepInfo' in o['model']] filtered_text = json.dumps(filtered, indent=4) editor.setText(filtered_text)
  • Delete entries and unknown amount of brackets

    3
    2 Votes
    3 Posts
    170 Views
    Felix LF

    @Alan-Kilborn You’re just awesome dude, thank you very much. Works like a charm.

  • Comment on FAQ post about 8.5.3 macros

    2
    0 Votes
    2 Posts
    377 Views
    PeterJonesP

    @mkupper ,

    Ugh. Apparently, like backslash-square-brackets, HTML entities are another thing that NodeBB messes up when you edit a post, because it was right when I first posted it. Fixed. (edit: updated the forum-formatting FAQ to call out that oddity with entities, as well)

    Regarding DM: the “chat” feature speech bubble in the upper-right by your icon is the way to do private messages
    d3a7bd64-4296-4f8b-a302-820992061b17-image.png

  • Automate Notepad++ new doc creation

    8
    0 Votes
    8 Posts
    690 Views
    mkupperM

    @Chris-Johnston In reading https://www.autoitscript.com/forum/topic/210204-automate-notepad-new-doc-creation-moved/ it appears that in Notepad++ you want

    Settings / Preferences / New Document (on left sidebar) / Default language to be AutoIt.

    Notepad++ can already do that. What Notepad++ does not seem to have baked in at present is a default blank document template. It’s not clear though
    if filling in the new tab with stuff related to a generic .au3 file is useful or essential to you. Any of what people have already suggested here will do for filling in the default new-document but it’s also possible a plugin exists that can do this.

  • Sort lines but keep the hierarchy

    5
    0 Votes
    5 Posts
    388 Views
    guy038G

    Hi, @rune-egenes and All,

    Easy !

    First regex :

    SEARCH \R(?=\t)

    REPLACE Leave EMPTY

    Sort

    Second regex

    SEARCH (?=\t)

    REPLACE \r\n    or    \n if you deal with UNIX files

    BR

    guy038

  • Notepad++ upgrade issue

    2
    0 Votes
    2 Posts
    181 Views
    Terry RT

    @Abhinav-kganan said in Notepad++ upgrade issue:

    Is there any way I can retrieve it?

    You haven’t exactly provided much information. However I suspect you have been working with tabs of data that you haven’t actually saved as real files. Which if true is a shame, because if you have critical data you really do need to save it.

    How about read this post which is in the FAQ section. In there are references to the periodic backup files created if you have the right settings enabled for those “unsaved” tabs.

    Good luck. Even if you do not recover the data, please read that post entirely, understand what it is saying, and change your backup procedures so you do not suffer the same occurance in the future.

    Terry