• 0 Votes
    9 Posts
    796 Views
    Mark OlsonM

    @PeterJones said in Merge local with external changes when file is modified by another program:

    Doesn’t the existing action Diff since Last Save essentially do that already?

    I can confirm that this is in fact exactly what Diff since Last Save in ComparePlus does, making it totally unnecessary to create an NPPN_FILEBEFORERELOAD notification or do anything I suggested in my above post.

  • how to replace data in notepad++ tab with respect to other tab data?

    3
    0 Votes
    3 Posts
    209 Views
    guy038G

    Hello, @genjua-khan, @peterjones and All,

    @genjua-khan, in addition to the @peterjones’s solutions, may be the following Python script could interest you !

    The explanations, regarding the use of this script, are included in comments

    Note that the RULIC name of that script means Replace Using List In Clipboard !

    ''' Based on : https://notepad-plus-plus.org/community/post/33977 ( Scott Sumner - August 2018 ) - Given a NEW tab, containing some lines, with the FORMAT : DELIMITER<Searched_Text>DELIMITER<Replacement_Text>, PASTED in the CLIPBOARD by a 'CTRL--C' action - This script REPLACES any 'Searched_Text' ( of a 'CLIPBOARD line' ) with its CORRESPONDING 'Replacement_Text', in CURRENT file ( ACTIVE tab ) EXAMPLE : Let's suppose that the THREE lines, below, are pasted in the CLIPBOARD : !bar!foo $Test$ :Bob:Ted Then : - Any 'bar' string will be changed by 'foo' in the present ACTIVE tab - Any 'Test' string will be DELETED in the present ACTIVE tab - Any 'Bob' first name will be changed by 'Ted' in the present ACTIVE tab NOTES : - IF the 'Replacement_Text', after the DELIMITER, is ABSENT, the 'Searched_Text' is then DELETED - The DIFFERENT strings, to search for, are ALWAYS supposed to be LITERAL strings - The DELIMITER may be DIFFERENT between TWO successive lines - The list of the different SEARCHES [ and REPLACEMENTS ], with the DELIMITERS, must be PRESENT in the CLIPBOARD, RIGHT BEFORE running this script ''' import re def RULIC__main(): if not editor.canPaste(): return cp = editor.getCurrentPos() editor.setSelection(cp, cp) # cancel any ACTIVE selection(s) doc_orig_len = editor.getTextLength() editor.paste() # Paste so we can get easy access to the clipboard text cp = editor.getCurrentPos() # The POSITION has moved because of the PASTE action clipboard_lines_list = editor.getTextRange(cp - editor.getTextLength() + doc_orig_len, cp).splitlines() editor.undo() # Revert the PASTE action, but sadly, this puts it in the undo buffer...so it can be redone editor.beginUndoAction() for line in clipboard_lines_list: try: (search_text, replace_text) = line.rstrip('\n\r')[1:].split(line[0]) except (ValueError, IndexError): continue editor.replace(search_text, replace_text) # DEFAULT search is SENSITIVE to case #editor.replace(search_text, replace_text, re.I) # If an INSENSITIVE search is preferred editor.endUndoAction() RULIC__main()

    Best Regards,

    guy038

  • unexplainable message

    7
    1 Votes
    7 Posts
    358 Views
    PedroxinatorP

    Hi,
    this is only to report how I solved the problem.
    First I restored a system image from before installing Npp.
    Then I installed Npp and tested the “replace notepad” hack mentioned b Peter Jones above. The result was that it really worked very fine for me. There was only 1 small disadvantage: the kontext-menu new didn’t offer me the creation of a txt-file anymore…
    Okay, again I restored the system, and installed Npp again. And now I installed the already mentioned NotepadReplacer. Surprisingly it was (and still is!) working like a charme. It really replaces the “normal” Windows Notepad in an incredible way. Even when starting the original Windows notepad by doubleclicking the notepad.exe it starts Npp. Incredible!
    As per today’s status I only can recommend this piece of FREE software.
    That’s it.

  • Replace & add specific parts/symbols from a specific lines only

    3
    1 Votes
    3 Posts
    500 Views
    guy038G

    Hello, @flammable and All,

    First, I would advice you to fully read this interesting FAQ post below, which explains to prefer the use of a JSON parser ( instead of regexes ) for such problems :

    https://community.notepad-plus-plus.org/topic/25304/faq-parsing-and-editing-json-with-regex-is-a-bad-idea/1?lang=fr

    Oh,…, by moving to your post, I just see the @mark-olson’s reply which explains a straight solution, based on the JsonTools plugin ;-))

    However, I also succeeded to find out a regex way to do it !

    So, given your INPUT text, below, in a new tab :

    "water": { "DisplayName": "Water", "Skin": 0, "Image": "water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "healingtea.advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },

    Open the Replace dialog ( Ctrl + H )

    Untick all box options

    SEARCH (?-is)^\x20+"Image":\x20"\K

    REPLACE https://www.example\.com/example2/

    Check the Wrap around option

    Click, once, on the Replace All button ( NOT the Replace button ! )

    You should get this OUTPUT text :

    "water": { "DisplayName": "Water", "Skin": 0, "Image": "https://www.example.com/example2/water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "https://www.example.com/example2/healingtea.advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },

    Now with the following regex S/R, we’ll change any dot character, not followed by the string png", at end of line, with a dash char :

    SEARCH (?-si)(?:^\x20+"Image":\x20"https://www.example.com/example2/|(?!\A)\G).*?\K\.(?!png",$)

    REPLACE -

    Just follow, exactly, the same other points of the previous S/R !

    You should get your expected OUTPUT text :

    "water": { "DisplayName": "Water", "Skin": 0, "Image": "https://www.example.com/example2/water.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 5000, "SellPrice": 0, "Currency": "eco" }, "healingtea.advanced": { "DisplayName": "default", "Skin": 0, "Image": "https://www.example.com/example2/healingtea-advanced.png", "DefaultAmount": 1, "BlockAmountChange": false, "BuyPrice": 500, "SellPrice": 0, "Currency": "eco" },

    BR

    guy038

  • Change or specify plugins directory or folder location

    5
    0 Votes
    5 Posts
    6k Views
    PeterJonesP

    @rsonnier-cfs ,

    If NPP used %appdata% for the dll

    FYI: Feature requests cannot be processed here. We can only give our opinions or other feedback on a given request, but making a request here will not put it into the feature-request queue for the developers to look at. Our FAQ explains this.

    If NPP used %appdata% for the dll

    Prior to v7.6 (in 2018), plugins used to go in the %AppData%\Notepad++\plugins\ directory.

    However, there were a lot of (valid) security complaints, and Notepad++ would have been essentially blocked from being installed in many corporate environments because it read executable code from the user-writeable %AppData% hierarchy. The developer didn’t want much of the corporate world to lose access to Notepad++, so in v7.6.3, Notepad++'s plugin interface was finalized to only allow plugins in the plugins\ directory off of the executable’s directory.

    Given the security implications (and the massive loss of userbase if the developer ever enabled running DLL code from %AppData%\ again), I doubt any such feature request would ever be implemented (even as an option: if there is an option to configure Notepad++ to run DLL code from an insecure location, then the security hole exists, and the large userbase would be cut off from being able to use Notepad++). So, even if you were to ask for the feature in the right place, I would give it close to 0% chance of being implemented.

    If you want a workaround, you could unzip a separate portable-zipped copy for each user into whatever directory structure you wanted, and then they’d each run out of that copy, and it would use the <portabledir>\Notepad++\plugins\ hierarchy for installing plugins, and thus there would be no conflict.

    I am unable to easily copy the latest (v6.24.10) dll in the folder since the .dll is always in use by several users; that is unless I ask everyone to close NPP

    The reason you cited is equally applicable to saying that Notepad++ itself cannot be updated while any users are using it. Unless you never update Notepad++ (which has security and performance and feature implications), then whatever window you use for updating Notepad++ could also be used for updating the plugins.

    I highly encourage you to regularly update Notepad++.

    If you want to get into the specifics on why SQLinForm is locking up when you try to make configuration changes, that is something that maybe someone in this forum could help you with. (I don’t have any experience with that plugin, but can give some generic statements.)

    Plugins should have their configuration files in %AppData%\Notepad++\plugins\Config\ hierarchy, so just editing the configuration shouldn’t cause it to crash. Having multiple people using the DLL simultaneously shouldn’t change that (because they are presumably each executing it in a separate process), so I don’t see how any “lock” on the DLL file itself could in any way cause the instability you described. Unless SQLinForm plugin doesn’t use standard config file location and is trying to have some common config instead of per-user config, I don’t know how the location would affect things (and if they are doing that, your proposed change to the DLL location wouldn’t change their coding of a central config file, so wouldn’t help if that were the culprit.)

    However, if there is a bug in an older copy of SQLinForm in general, which has nothing to do with DLL location, then you would necessarily need to do the upgrade to get it to work, regardless of whether the DLL is in a central location.

    At this point, any possible fix will require making the users exit out of Notepad++ for some amount of time simultaneously: if the Notepad++ executable were changed to allow DLLs in the AppData (no matter how unlikely it actually is), they would have to exit so you could update the .exe; if you wanted to make a bunch of portable copies, on for each user, they’d have to stop using the centrally-installed exe and switch to their own portable exe; and if you just do an upgrade of the DLL now, they will have to stop.

    Or maybe NPP is simply not supported of RD server.

    It’s not specifically designed for multiple simultaneous users in a remote-desktop environment all running separate copies of the same executable, no. Notepad++ has the multi-instance mode, but it’s more focused on allowing a single user to have multiple windows of Notepad++ open simultaneously (for those for whom the two Views in the same window aren’t sufficient or not their preferred window setup)… but multi-instance has always had some drawbacks compared to single instance… and you’ve just found a rather unique use case showing yet another such drawback.

  • changing text in a table

    2
    0 Votes
    2 Posts
    291 Views
    PeterJonesP

    @fra-Do ,

    Your question is very vague, and I am uncertain how it is specific to Notepad++.

    In general, to change text, you move the cursor and type.

    Are you asking how to do a search-and-replace? Or something else?

    ----

    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
  • Cursor not working properly

    5
    0 Votes
    5 Posts
    799 Views
    Alan KilbornA

    @Mainak-Gupta said in Cursor not working properly:

    I want to bring back the vertical option which is ‘|’

    It’s probably just as simple as pressing the Insert or INS key.
    But if it isn’t, all the information you need to “bring it back” is in Peter’s posting already.

  • Problems opening and saving files from a linux server - keeping LF EOL

    2
    0 Votes
    2 Posts
    375 Views
    PeterJonesP

    @Bob-Southwell ,

    When Notepad++ opens a file, it decides on the file’s EOL format based on the first line ending it sees: if the first line ending is CRLF, then it will choose Windows EOL format; if the first line ending it sees is LF, it will choose Unix (LF) as the EOL mode.

    Thus, if Notepad++ is opening the file in Windows EOL format, I am quite confident that the first EOL was CRLF, not just a linux LF.

    That said, I believe that WinSCP, like other FTP clients, can be configured to automatically convert line endings… so my guess is that it’s converted the line ending when it did the transfer, and that your problem has nothing to do with Notepad++ behavior. (If you don’t want WinSCP to do the conversion, look for settings to put it into “binary” mode instead of “ASCII” mode, or some such. Or set it up so it does the conversion in both directions, so that Notepad++ can edit it Windows EOL but WinSCP changes it back to Linux EOL when it sends it back to the server.)

  • Windows ten activation mishap

    2
    -1 Votes
    2 Posts
    190 Views
    Terry RT

    @Marek-St-Pierre
    Not sure what you hope posting in Notepad++ forum will do for you?

    What is actually your question and how does it relate to Notepad++?

    Terry

  • 0 Votes
    3 Posts
    387 Views
    PeterJonesP

    @Thomas-Zito said in Make find window stay focused on specific view/file (do not search other files):

    [badly formatted data]

    I used moderator power to add the code tags around your example text, so that the forum wouldn’t interpret the asterisks as italics commands, so that we could actually read your example data. Please use the </> button, and make sure you format your posts so they are readable. See Useful References (below).

    I want the find window to stay focused on my source file and nothing else.

    The Find dialog will always search the contents of the active file. If you change which file is active (by changing to the other View, or activating a different tab in the same View), it will change which file it searches through.

    Your described behavior would confuse everyone who expects the behavior of FIND searching in the active document. And if you are asking for it to always use that behavior, I would vehemently fight against it, because it would break most user’s expectations.

    If you are asking for a new option for FIND, so that you could either have it follow the active document or stick to the document that was active when you launched the FIND:

    Feature requests here will not be seen or acted upon by the developer, as our FAQ clearly explains. So, while we can give our opinions, we cannot implement such feature requests here. Adding yet another option to the FIND dialog is not likely to happen, as it’s already overly cluttered as it is. My initial guess is that tracking which file was active when FIND was launched would have a lot of unexpected side effects, and wouldn’t work the way you think it should, depending on the exact sequence of events.

    As a workaround, instead of leaving the FIND dialog open and using Find Next to navigate to each match, you could run the Find All in Current Document command to get all the results for the current file into the Search Results window. Then you can easily double-click on any match in the Search Results, and it will take you to the right location in the right file, regardless of which View or Tab you last activated.

    ----

    Useful References Please Read Before Posting FAQ: Formatting Forum Posts FAQ: Feature Request
  • Style Configurator / Theme -> (active) Tab color

    3
    0 Votes
    3 Posts
    514 Views
    J

    @PeterJones said in Style Configurator / Theme -> (active) Tab color:

    Themes are primarily about the colors inside the text-editing area, so that’s where the development focus was; the GUI elements are mostly not controlled by the theme, but by the dark-mode/light-mode.

    Thank you for the reply. Too bad I can’t share the complete theme then. I just realized that I’ll have to copy my config.xml (appdata/roaming/notepad++/) to make the theme complete.
    Well, at least I typed everything down, where and what I need to change, in case I reinstall windows.

    Thanks for thinking with me ;)

  • Function list for vbs (visual basic script)

    6
    0 Votes
    6 Posts
    484 Views
    Alan KilbornA

    @PeterJones said in Function list for vbs (visual basic script):

    We told you exactly what you needed to know four years ago…

    Sometimes we waste a lot of time trying to help people here that just “don’t get it”. :-(

  • Cannot type " [ " - left square bracket.

    8
    0 Votes
    8 Posts
    2k Views
    Alan KilbornA

    @PeterAdam said in Cannot type " [ " - left square bracket.:

    Developers, please avoid Ctrl + Alt hotkeys, or at least make a “Do not use Ctrl + Alt hotkeys” option in your text editor.

    Notepad++ is such a mature product, and so many keycombos are already taken, that IMO new features should not have a new keycombo invented and assigned for them, instead relying on end users to pick something and assign it themselves.

  • Npp with WSL UNC Path

    6
    2 Votes
    6 Posts
    359 Views
    Siddharth KaulS

    Thanks @PeterJones @xomx for responding i have subscribed to both the #9209 and #1104. Thanks for pointing me out to those existing issues.

  • Migrate languages menu from portable to portable

    2
    0 Votes
    2 Posts
    136 Views
    PeterJonesP

    @Max-Alekseyev ,

    The default lists of the languages and their default keywords are in langs.xml

    Your custom colors and user-defined keywords are in stylers.xml or your theme file.

    https://npp-user-manual.org/docs/upgrading/#upgrading-a-portable-edition

  • Colour background not saved with .txt file

    6
    0 Votes
    6 Posts
    262 Views
    xomxX

    @Richard-Darwin

    How do I persist the colour?

    You can export (but not import back to N++!) “what you see in N++” to the rich text format (or html) and continue in a WP-SW (WordPad, MS Word etc).

    npp-export-RTF.png

  • Search via Google Alt+F2 entire line not just selected text

    13
    0 Votes
    13 Posts
    461 Views
    Alan KilbornA

    @mkupper said:

    With one exception, the Notepad++ project has never had the concept of maintaining old versions.
    The exception is that while version 7 was the first 64-bit release the project continues build and and make available for download X86 or 32-bit executables

    I don’t see how offering a 32-bit release along with a 64-bit release qualifies as “maintaining old versions”. It’s merely a “choice” for the user for a specific version.

  • need help replacing multiple "answers" to these lines?

    4
    0 Votes
    4 Posts
    231 Views
    Mark OlsonM

    You might also be able to achieve this with the query

    @..stamina = 9999; @..speedModifier = 2

    in the JsonTools plugin.

    In this case a regex-based solution as described by Thomas Knoefel will work fine, but if you want more control over how you manipulate your JSON, a JSON parser like JsonTools is likely a better option.

  • How to expand workspace folder for currently open tab?

    4
    0 Votes
    4 Posts
    246 Views
    PeterJonesP

    @Thomas-Zito said in How to expand workspace folder for currently open tab?:

    That solves my problem.

    Glad it worked for you

    Is there a way to mark this as solved?

    This forum doesn’t have such marking. People reading can determine for themselves whether there is anything more worth adding to a discussion topic, whether or not it’s already been “solved” in the original poster’s mind. (Sometimes, when the original poster has been gone for years, topics are re-awakened years later and new and productive discussion occurs. having a “solved” status might discourage such productive add-ons.)

  • Direct link to download latest version

    5
    0 Votes
    5 Posts
    2k Views
    mkupperM

    @sargonphin said in Direct link to download latest version:

    … I’m scripting on Windows and any amount of scripting in MS Batch is too much in my opinion :D But we’re stuck with Windows on that one so I have to make do with what we have

    Well, you can do it all in MS Batch… I used wget to do the fetch here but using curl would get the same results.

    @echo off setlocal set XVER_XML=Notepad++.xml set "XURL=https://notepad-plus-plus.org/update/getDownloadUrl.php?version=8&param=x64" rem The have_version_xml logic is mainly to help with debugging the parsing logic rem as I did not need to re-download the version XML each time. if exist "%XVER_XML%" goto :have_version_xml wget.exe -O "%XVER_XML%" --no-check-certificate "%XURL%" if errorlevel 1 goto :handle_wget_error :have_version_xml rem We expect the entire XML blob in XLINE to look like this: rem <GUP><NeedToBeUpdated>yes</NeedToBeUpdated><Version>8.7</Version><Location>https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v8.7/npp.8.7.Installer.x64.exe</Location></GUP> for /f "usebackq delims=" %%i in ("%XVER_XML%") do set "XLINE=%%i" set "XEXPECT=<GUP><NeedToBeUpdated>yes</NeedToBeUpdated><Version>" if not defined XLINE goto :unexpected_content if "%XLINE:~0,52%" NEQ "%XEXPECT%" goto :unexpected_content set "XLINE=%XLINE:~52%" rem Copy one character at a time from XLINE to XVERSION until we hit the trailing </Version><Location> set XVERSION= set "XEXPECT=</Version><Location>" :version_loop if not defined XLINE goto :unexpected_content if "%XLINE:~0,20%" == "%XEXPECT%" goto have_version set "XVERSION=%XVERSION%%XLINE:~0,1%" set "XLINE=%XLINE:~1%" goto :version_loop :have_version echo New Notepad++ Version: %XVERSION% set "XLINE=%XLINE:~20%" rem Copy one character at a time from XLINE to XURL until we hit the </Location></GUP> set XURL= set "XEXPECT=</Location></GUP>" :url_loop if not defined XLINE goto :unexpected_content if "%XLINE%" == "%XEXPECT%" goto have_url set "XURL=%XURL%%XLINE:~0,1%" set "XLINE=%XLINE:~1%" goto :url_loop :have_url echo New Notepad++ URL: %XURL% exit /B 0 goto :eof :handle_wget_error echo. echo Error %ERRORLEVEL% from wget exit /B 1 goto :eof :unexpected_content echo. echo Error, unexpected contents. echo Have: "%XLINE%" echo Expect: "%XEXPECT%" exit /B 2 goto :eof