• Strange Notepad++ file recovery

    5
    0 Votes
    5 Posts
    157 Views
    xomxX

    @Notepadder said in Strange Notepad++ file recovery:

    How can I access the files in this folder from a more recent restore point as with first crash?

    If there is also a more recent Windows OS Restore Point but you selected an older one somehow (with older N++ backup folder state) during your effort to revive your PC, you can try to extract newer N++ files by ShadowExplorer.

  • DSpellCheck not underlining misspelled words

    9
    0 Votes
    9 Posts
    166 Views
    Wally WilsonW

    @PeterJones

    Hi Everyone,

    I decided to drop back and punt. I cannot get hung up on this. I have other problems, and too much to do.

    I uninstalled the latest version, then downloaded the previous version (8.8.2), installed it, and installed DSpellCheck again. It is working. The underlining is not as prominent as I would like (even after adjusting the size to max), but it will have to do.

    I want to thank everyone who replied. Unfortunately, I do not have enough points to upvote anyone — sorry.

  • When network goes away - 2 pop-ups.

    4
    0 Votes
    4 Posts
    71 Views
    PeterJonesP

    I thought someone had suggested combining it to a single dialog, but there was some deep technical reason it was infeasible

    I looked through old issues (opened and closed): the closest I could find was the Isse#12079, where the loading of the current session would prompt N times if there were N network files missing. There was quite a lot of back-and-forth (hundreds of comments), but eventually, they were able to make it work, and get a YesToAll/NoToAll message added to the dialog when multiple files from the session were not available.

    Since it was feasible in that situation, I am hoping it’s also feasible here. Thus, I created Issue #16908 to see if the “Keep non existing file” dialog (when the network goes down) and the “Reload” dialog (when the network comes back) can add the YesToAll/NoToAll buttons. I don’t know whether it’s really feasible, or if it will ever be implemented, but the request has at least been made. Those who want this feature can go to that issue and upvote and/or watch for whether or not it gets implemented.

  • Sorting text with numbers

    4
    0 Votes
    4 Posts
    131 Views
    guy038G

    Hello, @michael-gomez, @coises, @thomas-knoefel and All,

    As @coises said, you could achieve your goal with the buit-in regular expression engine of Notpead++ !

    So, from your INPUT text :

    Warsongs rolls 206 Tykee rolls 206 Shadowhunter rolls 798 Ravencauthon rolls 229 Omgwtflolroflgg rolls 479 Nephlite rolls 576 Groverton rolls 943 Blodhgram rolls 829 Azria rolls 675 Antonioklaus rolls 720

    Using the following regex S/R :

    FIND (?-s)^.+?(\d+)

    REPLACE \1 $0!

    => You should get this temporary text :

    206 Warsongs rolls 206! 206 Tykee rolls 206! 798 Shadowhunter rolls 798! 229 Ravencauthon rolls 229! 479 Omgwtflolroflgg rolls 479! 576 Nephlite rolls 576! 943 Groverton rolls 943! 829 Blodhgram rolls 829! 675 Azria rolls 675! 720 Antonioklaus rolls 720!

    Then using the menu command :

    Edit > Line operations > Sort Lines Lexicographically Descending ( Should be better sorted than using the Sort Lines As Integers Descending ! )

    You would be left with that temporary text :

    943 Groverton rolls 943! 829 Blodhgram rolls 829! 798 Shadowhunter rolls 798! 720 Antonioklaus rolls 720! 675 Azria rolls 675! 576 Nephlite rolls 576! 479 Omgwtflolroflgg rolls 479! 229 Ravencauthon rolls 229! 206 Warsongs rolls 206! 206 Tykee rolls 206!

    And, finally, with the last regex S/R, below :

    FIND ^\d+\x20

    REPLACE Leave EMPTY

    Here is you expected OUTPUT text :

    Groverton rolls 943! Blodhgram rolls 829! Shadowhunter rolls 798! Antonioklaus rolls 720! Azria rolls 675! Nephlite rolls 576! Omgwtflolroflgg rolls 479! Ravencauthon rolls 229! Warsongs rolls 206! Tykee rolls 206!

    But, indeed, as @coises mentionned it, the two records with the same integer part 206 are inverted !

    Best Regards,

    guy038

  • Missing New Notepad++ Icon in v8.83

    6
    0 Votes
    6 Posts
    143 Views
    Daniel N 0D

    Thank you both!

  • 0 Votes
    2 Posts
    104 Views
    PeterJonesP

    @yeger-eren ,

    My answer is not “AI” specific.

    Maybe syntax highlighting tweaks,

    Notepad++ syntax highlighting is already pretty good; I’m not sure there is anything that needs to be “tweaked” in that regard when looking at code that you don’t create.

    auto-format tools,

    Notepad++ does not have built-in per-language code cleanup (“auto-format”, indentation fix, etc), because very few languages have One Right Way to format – and those that think they do actually have multiple factions who do things slightly differently, anyway. Notepad++ would never be able to get enough options to make everyone happy for all 90+ of the built-in programming languages that it has syntax highlighting for, let alone the uncountable number of possible UDLs that might exist.

    That said, there are plenty of language-specific plugins for Notepad++: if you’re generating XML, then XML Tools will help you format it; if you’re working with JSON, then JsonTools or JSON Viewer would be helpful; etc. And generically, @Michael-Vincent shares an example script for the NppExec plugin that is able to run an external “pretty print” utility for multiple languages depending on file extension in this post: his script does it for C, HTML, Perl, and Python, but it shows the pattern, so if you were getting code for another language, you could definitely call any external “pretty print” for whatever language you are using.

    Also, @Ekopalypse has the NppLspClient plugin, which will allow you to connect to an LSP Server for your language – and the tips page shows examples of how to configure it for various languages. Some LSP servers will respond to the Plugins > NppLspClient > Format Document or Format Selected Text commands by formatting according to the server’s settings – but not all do.

    regex replacements, or clever macros that make the process smoother?

    Every regex (or regex/editing macro) is specific to a very limited transformation; coming up with a generic one for something as indefinite as “fixes AI-generated code” is impossible. About the closest we come is our FAQ: Generic regex formulas, which lists a few different template regex, that you can use as a starting space for doing common tasks that we’ve seen requested year after year – though none of them are specific to “AI code craziness”.

  • Opening Files

    3
    0 Votes
    3 Posts
    158 Views
    Alan KilbornA

    Here’s my script entry, which does exactly this:

    open additional ffiles to the left of the files that are already open?

    I call the script MoveJustOpenedTabToExtremeLeft.py and instructions for use appear in the comments in the source code.

    # -*- coding: utf-8 -*- from __future__ import print_function # Python2 vestige! ######################################### # # MoveJustOpenedTabToExtremeLeft (MJOTTEL) # ######################################### # note: # This script was developed and tested under Python3 64-bit on unicode (non-ANSI) encoded data. # It may work as-is using Python2 and/or ANSI-encoded data and/or 32-bits, but that would be incidental. # references: # https://community.notepad-plus-plus.org/topic/27054/opening-files # for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript #------------------------------------------------------------------------------- # ensure this file is not executed directly: assert __name__ != '__main__', 'Cannot run this script directly; for testing, could execute this at console >>> prompt: from MoveJustOpenedTabToExtremeLeft import MOVE_JUST_OPENED_TAB_TO_EXTREME_LEFT' # to execute, use this in (e.g.) user startup.py: # from MoveJustOpenedTabToExtremeLeft import MOVE_JUST_OPENED_TAB_TO_EXTREME_LEFT # another execution option would be to copy and then paste that line into the PythonScript console >>> box # note: if running via startup.py, need to make sure that "Initialisation" for "Python Script Configuration" is set to "ATSTARTUP" and not "LAZY". #------------------------------------------------------------------------------- from Npp import * import threading #------------------------------------------------------------------------------- class MJOTTEL(object): def __init__(self): notepad.callback(self.fileopened_callback, [NOTIFICATION.FILEOPENED]) def fileopened_callback(self, args): #print('FILEOPENED:', args) IDM_VIEW_GOTO_START = 10005 threading.Timer(0.05, lambda : notepad.menuCommand(IDM_VIEW_GOTO_START)).start() #------------------------------------------------------------------------------- MOVE_JUST_OPENED_TAB_TO_EXTREME_LEFT = MJOTTEL()

    Notes:

    the script is rather simple-minded: it works for the simple case of opening 1 file at a time. If you attempt to open 2+ at the same time (e.g. drag and drop 2+ files from Explorer into Notepad++, use File > Open and specify 2+ files, etc.), the script causes only 1 of the files to move. If this is a big limitation for functionality, I could look into how to successfully achieve it.

    the threading stuff seems like it wouldn’t be necessary, but it is. Probably what happens (I didn’t verify) is that the file-opened notification message comes before Notepad++ is entirely done with everything it does to open a file. Delaying (via the threading call) moving the tab allows control to return to Notepad++ to let it finish doing its thing, before the script moves the tab.

  • 0 Votes
    3 Posts
    118 Views
    Terry RT

    @Tall-Navy-Guy said in Backup Files for New, Unsaved Tabs Are Deleted When Tab Is Closed — Bug?:

    Actual Result
    The backup created for the unsaved tab is immediately deleted when the tab is closed — there is no way to recover the text.

    Why This Matters
    Users (myself included) rely on the periodic-backup feature as a safety net for unsaved work. Accidentally closing an unsaved tab—or closing all tabs—should not silently discard those backups; other editors retain them until the user explicitly deletes the file or disables backups.

    You really need to understand what the backup is designed to do. There is a FAQ section and in there is this post which explains in detail what it does.

    You say you rely on this process “as a safety net” yet what you really seem to say is that this will be the “one and only” copy of the data you create. I am actually concerned to learn that you are relying on some process which clearly you misunderstand for saving what seems to be critical data.

    I believe you should get a message when closing the new 1 tab (not the whole application) asking if you want to keep it (see image in @Lycan-Thrope post), so in reality the application does NOT silently discard the backup, it asks you, it seems you confirm you don’t want the data since you are asking this question. The only “silent” process will be if you close Notepad++ without first closing any tabs. When you start Notepad++ later, all tabs should remain with their content intact.

    For your idea to work you would continue to rack up endless “backup” files, all with the same starting name new 1... and have very little idea which file contains which data you want.

    If you were to search this forum you will find it littered with unhappy users who like you misunderstood the process, relied on it for their only copy, only to find that inevitably the process eventually failed them, often due to external factors outside of Notepad++'s control.

    Please read the FAQ post and I strongly suggest changing the way you use Notepad++.

    Terry

  • subnets, search/find and regular expression, txt2xml

    2
    0 Votes
    2 Posts
    97 Views
    PeterJonesP

    @vasstr said in subnets, search/find and regular expression, txt2xml:

    search/find and regular expression?

    Yep.

    FIND WHAT = ^(\d+\.\d+\.\d+\.\d+)/(\d+\.\d+\.\d+\.\d+)
    REPLACE WITH = <IPHost transactionid="">\r\n <Name>n$1</Name>\r\n <Description>subnet</Description>\r\n <IPFamily>IPv4</IPFamily>\r\n <HostType>Network</HostType>\r\n <IPAddress>$1</IPAddress>\r\n <Subnet>$2</Subnet>\r\n</IPHost>
    SEARCH MODE = Regular Expression
    REPLACE ALL

    Notes:

    ^ makes sure the match must start at the beginning of a line each \d+\.\d+\.\d+\.\d+ match four dot-separated integers The parens around those put them in two groups The $1 and $2 in the replacement refer to the values of group1 and group2, respectively the \r\n in the replacement are the standard windows CRLF end-of-line sequence, so that your replacement can go over multiple lines.

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions Formatting Forum Posts Notepad++ Online User Manual: Searching/Regex FAQ: Where to find other regular expressions (regex) documentation
  • Regexp multiline text replace when care about line delimiters

    4
    0 Votes
    4 Posts
    211 Views
    I HayI

    @guy038 @Coises

    Thank you both of you, you’ve both given me more to learn which is great. I had wondered after posting about getting rid of the newlines and replacing them with an unused character (though I might have hit some line limits with that somewhere), but I’m pleased to find it can be done without that. I didn’t know about the reverse lines option and would never have thought of using it for regexp purposes - good to know! - if the world is too hard as it is, turn it upside down lol.
    Thanks again both of you :-)

  • 0 Votes
    5 Posts
    178 Views
    PeterJonesP

    @Coises said in I go to Style Configurator set a new font size Using Global Styles, save and nothing happens:

    if someone set a value in Global Override before it was moved … They’re still changing the first entry in the list.

    If they did, and it moved for them, they would have had to delete stylers.xml and let a new one be generated in the new order (or manually re-ordered), because stylers.xml doesn’t get overwritten to the new order when you upgrade from a version before the re-order to a version after the re-order. (Hence, my Config Updater plugin, to apply those kinds of fixes.)

    So, except in the unlikely event that they deleted their stylers.xml and let it be re-generated, then all that remains is that either it was in the old order and probably still is in the old order (but their understanding has improved, and they are now correctly looking at the Default Style), or it was in the new order and had all the modern warnings in the GUI and they still checkmarked the override. I find the still-in-old-order the most likely scenario, but that’s just my estimate. (Thus, I disagree with your conclusion that “They’re still changing the first entry in the list”, as it seems unlikely to me that they deleted/regenerated stylers.xml, because that doesn’t seem a natural behavior of any normal user, to me.)

    My point in linking to the manual is that it’s all explained in there, and explains how to fix the stylers.xml to move Global Override to the end, even if it’s not at the end, so that you never accidentally use the Global Override.

  • Installation Bug?

    5
    1 Votes
    5 Posts
    281 Views
    mpheathM

    @xomx

    Thanks for the confirmation. Issue has been posted at Github #16896 .

  • Notepad ++ Plugin Geneator

    3
    0 Votes
    3 Posts
    99 Views
    Mark OlsonM

    @ISSUE-BADGE

    If your plugin concept is very simple, you might find it easier to write a PythonScript script rather than writing a full-blown plugin.

    If you need to write a full plugin and you’re used to working with garbage-collected languages like Python/Java/JavaScript, I’d recommend starting with NppCSharpPluginPack, which is a C# plugin template that I actively maintain.

  • Drag-and-drop not working in editor

    3
    0 Votes
    3 Posts
    89 Views
    CoisesC

    @DanielTheGreatAu said in Drag-and-drop not working in editor:

    a hidden setting somewhere that reverts Notepad++ to ‘normal’ Windows behaviour

    Settings | Preferences… | Editing 2 | Multi-Editing: uncheck Enable Multi-Editing to restore normal Ctrl+drag behavior.

    Shift key down, then drag on a selection, as far as I know, has never moved the selection in Notepad++ — it just changes the selection. You don’t need the Shift key to move a selection.

  • UDL highlight words between 2 keyword

    2
    0 Votes
    2 Posts
    95 Views
    PeterJonesP

    @taigama_coder said in UDL highlight words between 2 keyword:

    How can I use UDL to fromat it?

    That is beyond the capability of UDL: it’s designed for simple keyword and operator highlighting, and what you are asking would require a custom lexer…

    Normally, I would suggest the EnhanceAnyLexer plugin, which allows adding foreground coloring based on regular expressions… but since you are asking to highlight the whitespace, and whitespace by definition is not using the foreground color, I don’t think it’s features would help you.

  • easy way to move a file tab in the open file list

    2
    0 Votes
    2 Posts
    72 Views
    mathlete2M

    @Arne-Everhard it sounds like you’re referring to the functionality of the Move Tab Forward and Move Tab Backward options in the View > Tab menu. If so, both have default shortcuts, but they can be modified in the Main Menu tab of the shortcut mapper.

    Note: I actually had a difficult time finding those particular options in my own window at first; you may need to filter by “tab” to see these particular options right away.

  • Toolbar icons with 2560x1440 display

    9
    0 Votes
    9 Posts
    2k Views
    PeterJonesP

    After this conversation, I worked briefly on a workaround. I took the 16x16 standard-icon BMP files from the N++ source code, converted them to ICO format, then on all the files, I used an image program to upscale from 16x16 to 32x32, and make .ico files that have both 16x16 and 32x32 resolution files. The 32x32 are admittedly ugly (because they are just enlarged versions of the 16x16), but it’s at least a starting place, and will give the ability to have icons that are based on the standard icon set, but being able to use them in large-icon mode.

    Assuming a standard installation of Notepad++ (using %AppData% config directory), to use these dual-resolution ICO files:

    Go to %AppData%\Notepad++\ in Windows Explorer Create a directory toolbarIcons and a subdirectory toolbarIcons\StandardDualResolution Download the .ico files in https://github.com/pryrt/nppStuff/tree/main/StandardIconUpscaling/GIMP DualResolution 32x32 16x16 and unzip into toolbarIcons\StandardDualResolution\ update: added zipfile for easy download Rename toolbarButtonsConf_example.xml to toolbarButtonsConf.xml Edit that file, and near the end, change the line from <ToolBarIcons icoFolderName="" /> to <ToolBarIcons icoFolderName="StandardDualResolution" /> Save the toolbarButtonsConf.xml exit Notepad++

    The next time you run Notepad++, it should be using the custom versions of the standard icons. If you select Settings > Preferences > Toolbar and choose one of the “large” choices, it should use the custom icons in large (32x32).

    5ef248da-6716-4e80-a474-4147eb20d515-image.png

    This is obviously not ideal. But since there hasn’t been any official or publically-available 32x32 “originals” of those icons in 14+ years, that I can find, it’s the best thing I can think of for now. Someone with more image editing skill – or more AI skill – might be able to generate better 32x32 versions from the original 16x16 BMP files in the source code and create better-looking versions as ICO files. But until such happens, this might be a usable workaround.

  • Notetab++ novice questions

    3
    0 Votes
    3 Posts
    374 Views
    PeterJonesP

    A few months ago, I said,

    I don’t know of anyone who has done that and made them public.

    After this conversation, I worked briefly on a workaround. I took the 16x16 standard-icon BMP files from the N++ source code, converted them to ICO format, then on all the files, I used an image program to upscale from 16x16 to 32x32, and make .ico files that have both 16x16 and 32x32 resolution files. The 32x32 are admittedly ugly (because they are just enlarged versions of the 16x16), but it’s at least a starting place, and will give the ability to have icons that are based on the standard icon set, but being able to use them in large-icon mode.

    Assuming a standard installation of Notepad++ (using %AppData% config directory), to use these dual-resolution ICO files:

    Go to %AppData%\Notepad++\ in Windows Explorer Create a directory toolbarIcons and a subdirectory toolbarIcons\StandardDualResolution Download the .ico files in https://github.com/pryrt/nppStuff/tree/main/StandardIconUpscaling/GIMP DualResolution 32x32 16x16 and unzip into toolbarIcons\StandardDualResolution\ update: added zipfile for easy download Rename toolbarButtonsConf_example.xml to toolbarButtonsConf.xml Edit that file, and near the end, change the line from <ToolBarIcons icoFolderName="" /> to <ToolBarIcons icoFolderName="StandardDualResolution" /> Save the toolbarButtonsConf.xml exit Notepad++

    The next time you run Notepad++, it should be using the custom versions of the standard icons. If you select Settings > Preferences > Toolbar and choose one of the “large” choices, it should use the custom icons in large (32x32).

    5ef248da-6716-4e80-a474-4147eb20d515-image.png

    This is obviously not ideal. But since there hasn’t been any official or publically-available 32x32 “originals” of those icons in 14+ years, that I can find, it’s the best thing I can think of for now. Someone with more image editing skill – or more AI skill – might be able to generate better 32x32 versions from the original 16x16 BMP files in the source code and create better-looking versions as ICO files. But until such happens, this might be a usable workaround.

  • 0 Votes
    2 Posts
    103 Views
    Mark OlsonM

    @PATRICK-MULOT

    This is probably a job for regular expressions, but it depends to some extent on the specifics of your task.

    If you have a text file where every line is a word that you need to search for, you need to do a scripting solution. This kind of question has been asked many times before on the forum and I’m too lazy to look up which posts it was answered in, but a PythonScript script that would accomplish this would probably be as follows:

    Open the file with the words you’re searching for (hereafter WORD_FILE) Open the PythonScript console Paste in the command words = [x + ' ' for x in editor.getText().splitlines()] then hit Enter. Open the file that you want to search in (hereafter TARGET_FILE) Paste in the command lines = [line for line in editor.getText().splitlines() if any(line.startswith(word) for word in words)] then hit Enter Open a new file. Paste in the command editor.setText('\r\n'.join(lines)) and hit Enter Your new file will contain only the lines in TARGET_FILE that started with one of the words in WORD_FILE followed by a literal space character

    If you want to find lines that start with "fam " or "blah " (as in “fam” or “blah” followed by a literal space character), you can do that by:

    Use Search->Find... from the Notepad++ main menu (Ctrl+F with default keybindings) to open the Find form. Set Search Mode to Regular expression. Set Find what: to (?-i)^(?:fam|blah)\x20.* This regular expression has these basic parts: (?-i), ^, (?:fam|blah), \x20, and .* The (?-i) says that this is a case-sensitive search (so it would exclude lines starting with FAM for example) The ^ means that we only search at the start of a line The (?:fam|blah) matches fam or blah The \x20 is a different representation of a normal space character, which I sometimes use in regular expressions to make it more readable The .* matches the rest of the line (. is any non-newline character and * means match 0 or more of the preceding pattern) Hit the Find All in Current Document button. A form will pop up at the bottom of the Notepad++ window showing all the lines that matched.
  • 0 Votes
    5 Posts
    181 Views
    Robert Or Janet DiebelR

    @guy038 Thanx much for your help