• 0 Votes
    1 Posts
    22 Views
    No one has replied
  • 0 Votes
    15 Posts
    86 Views
    guy038G

    Hello, @mark-boonie, @coises, @peterjones and All,

    Oh…, I’m terribly sorry ! I ate and watched TV for a few hours, forgetting all about you !

    But, anyway, @mark-boonie, you cleverly found out the true solution !

    So, considering your INPUT text, below, pasted in a new tab :

    *Block start 00000000013FC200 00200280 00010000 00000000 00000001 00000000013FC210 00000002 CC5CDDA0 00000000 00000000 *Block end Extra stuff *Block start 00000000013FC200 00200280 00010000 00000000 00000002 00000000013FC210 00000002 CC5CDDA0 00000000 00000000 00000000013FC220 00000000 00000000 01266100 01266100 00000000013FC230 00808000 013FC2B8 00000000 00000000 *Block end *Block start 00000000013FC200 00200280 00020000 00000000 00000003 00000000013FC210 00000002 CC5CDDA0 00000000 00000000 00000000013FC220 00000000 00000000 01266100 01266100 00000000013FC230 00808000 013FC2B8 00000000 00000000 *Block end *Block start 00000000013FC200 00200280 00030000 00000000 00000004 00000000013FC210 00000002 CC5CDDA0 00000000 00000000 00000000013FC220 00000000 00000000 01266100 01266100 00000000013FC230 00808000 013FC2B8 00000000 00000000 *Block end Extra stuff *Block start 00000000013FC200 00200280 00010000 00000000 00000005 *Block end *Block start 00000000013FC200 00200280 00010000 00000000 00000006 *Block end

    Here is the final and minimum search regex which works in all cases, whatever a block or extra stuff ends your text without a final line-break :

    (?s)^\*Block start((?!\*Block start).)+?80 00010000.+?^\*Block end\R?(*SKIP)(*F)|(?-s)^.*\R?

    Of course, the \Q.....\E syntax is safer but, generally, just one or two characters must be escaped within your delimiters and/or your target string !

    You just have to remember to escape any of the 10 characters * + ? ( ) ^ $ | [ ] and the \ itself. For example, you do not need to escape your present target string at all, as it simply contains digits and space chars !

    But if your delimiters would have been [*start|string*] and [*end|string*] or your target string (0x3F5B+0x7), surrounding them with the \Q...\E would have been preferable !

    Best Regards,

    guy038

  • 1 Votes
    16 Posts
    518 Views
    PeterJonesP

    @Alan-Kilborn ,

    Okay, since I didn’t know how to hook the message loop I found this old post by you (I remembered you had done it for the alt+scrollwheel, thankfully), and I was able to use that as a basis for a two-file solution to @fml2’s request

    file 1: MsgHooker.py

    # -*- coding: utf-8 -*- # original author: @Alan-Kilborn # reference: https://community.notepad-plus-plus.org/post/100127 # modified by: @PeterJones # - updated to add the .unhook() and .__del__() methods import platform from ctypes import (WinDLL, WINFUNCTYPE) from ctypes.wintypes import (HWND, INT, LPARAM, UINT, WPARAM) user32 = WinDLL('user32') GWL_WNDPROC = -4 # used to set a new address for the window procedure LRESULT = LPARAM WndProcType = WINFUNCTYPE( LRESULT, # return type HWND, UINT, WPARAM, LPARAM # function arguments ) running_32bit = platform.architecture()[0] == '32bit' SetWindowLong = user32.SetWindowLongW if running_32bit else user32.SetWindowLongPtrW SetWindowLong.restype = WndProcType SetWindowLong.argtypes = [ HWND, INT, WndProcType ] class MH(object): def __init__(self, hwnd_to_hook_list, hook_function, # supplied hook_function must have args: hwnd, msg, wparam, lparam # and must return True/False (False means the function handled the msg) msgs_to_hook_list=None, # None means ALL msgs ): self.users_hook_fn = hook_function self.msg_list = msgs_to_hook_list if msgs_to_hook_list is not None else [] self.new_wnd_proc_hook_for_SetWindowLong = WndProcType(self._new_wnd_proc_hook) # the result of this call must be a self.xxx variable! self.orig_wnd_proc_by_hwnd_dict = {} for h in hwnd_to_hook_list: self.orig_wnd_proc_by_hwnd_dict[h] = SetWindowLong(h, GWL_WNDPROC, self.new_wnd_proc_hook_for_SetWindowLong) v = self.orig_wnd_proc_by_hwnd_dict[h] #print(f"add {h:08x} => {v}") def __del__(self): self.unhook() def unhook(self): #print(f"unhook: self:{self} => <{self.orig_wnd_proc_by_hwnd_dict}>"); mykeys = [] for h in self.orig_wnd_proc_by_hwnd_dict.keys(): orig = self.orig_wnd_proc_by_hwnd_dict[h] print(f"\tdel {h:08x} => {orig}") SetWindowLong(h, GWL_WNDPROC, orig) mykeys.append(h) for h in mykeys: del self.orig_wnd_proc_by_hwnd_dict[h] def _new_wnd_proc_hook(self, hwnd, msg, wParam, lParam): retval = True # assume that this message will go unhandled (by us) need_to_call_orig_proc = True if len(self.msg_list) == 0 or msg in self.msg_list: retval = self.users_hook_fn(hwnd, msg, wParam, lParam) if not retval: need_to_call_orig_proc = False if need_to_call_orig_proc: retval = self.orig_wnd_proc_by_hwnd_dict[hwnd](hwnd, msg, wParam, lParam) return retval

    file 2: the main script:

    # encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/27351/ Trying to implement @Coises idea for setting the wrap to exactly 80 """ from Npp import * import ctypes from ctypes import wintypes from MsgHooker import MH as MsgHook WM_SIZE = 0x0005 # Define the RECT structure to match Win32 API class RECT(ctypes.Structure): _fields_ = [ ("left", wintypes.LONG), ("top", wintypes.LONG), ("right", wintypes.LONG), ("bottom", wintypes.LONG) ] def width(self): return self.right - self.left def height(self): return self.bottom - self.top def pysc_setWrap80(ed=editor): #console.write("ed={}\n".format(ed)) WRAPCHARS = 80 # Setup the Win32 function prototype user32 = ctypes.windll.user32 user32.GetClientRect.argtypes = [wintypes.HWND, ctypes.POINTER(RECT)] user32.GetClientRect.restype = wintypes.BOOL def get_window_size(hwnd): # 2. Instantiate the RECT structure rect = RECT() # 3. Call GetClientRect passing the rect by reference if user32.GetClientRect(hwnd, ctypes.byref(rect)): # 4. Parse the results # Client coordinates: top-left is always (0,0) return rect else: raise Exception("GetClientRect failed") sz = get_window_size(ed.hwnd) #console.write("{} => {}\n".format(ed.hwnd, {"width": sz.width(), "height": sz.height()})) usableWidth = sz.width() for m in range(0, 1+ed.getMargins()): w = ed.getMarginWidthN(m) usableWidth -= w #console.write("m#{}: {} => usableWidth: {}\n".format(m, w, usableWidth)) widthWrappedChars = ed.textWidth(0,"_"*WRAPCHARS)+1 # one extra pixel to be able to show the VerticalEdge indicator line wantMargin = usableWidth - widthWrappedChars if wantMargin < 1: wantMargin = 0 #console.write("{}\n".format({"windowWidth": sz.width(), "usableWidth": usableWidth, "pixelsFor80Char": widthWrappedChars, "wantMargin": wantMargin})) ed.setMarginRight(wantMargin) ed.setMarginLeft(0) def HIWORD(value): return (value >> 16) & 0xFFFF def LOWORD(value): return value & 0xFFFF def pysc_size_callback( hwnd, msg, wParam, lParam): #console.write(f"cb(h:{hwnd}, m:{msg}, w:{wParam}, l:{lParam}) => {LOWORD(lParam)} x {HIWORD(lParam)}\n") if hwnd == editor1.hwnd: pysc_setWrap80(editor1) elif hwnd == editor2.hwnd: pysc_setWrap80(editor2) return True pysc_setWrap80(editor1) pysc_setWrap80(editor2) pysc_size_hook = MsgHook([ editor1.hwnd, editor2.hwnd ], pysc_size_callback, [WM_SIZE]) console.write("SetWrap80 registered WM_SIZE callback\n") def pysc_unsetWrap80(args=None): """ To stop pysc_unsetWrap80() """ editor1.setMarginRight(0) editor2.setMarginRight(0) global pysc_size_hook if pysc_size_hook: pysc_size_hook.unhook() del pysc_size_hook # use the following in the console (no #) to stop it from always wrapping at 80 # # pysc_unsetWrap80()

    You run the main script (or call it from startup.py) to get it to start watching for WM_SIZE, and when it gets that, it does the calcs needed to keep the wrap margin at 80 characters (+1 pixel so that the Vertical Edge line would be visible if you’ve got it on)

    Both scripts should go in the main %AppData%\Notepad++\plugins\Config\PythonScript\scripts directory (or equivalent for non-AppData setups, or you need to have added their parent directory to sys.path)

  • FAQ: February Security Announcement

    Pinned until 3/1/26, 9:17 PM Locked Security
    3
    2 Votes
    3 Posts
    348 Views
    PeterJonesP
    Clarification

    Since people still don’t seem to get it, despite all these, I will try to boil it down more.

    This was not some wide net, where they were trying to attack as many as they could. It was highly targeted, with only a very small number of targets.

    Are you a member of a high-value organization that might reasonably be targeted by a nation-state?

    If you know you are, then you need to have your IT follow the technical links from above, because they will be able to understand the “indicators of compromise”

    If you are unsure if you are a member of such a team, you probably are not. But the following can help you clarify:

    Is the team you are a part of outspoken in its criticism or opposition to one or more aggressive nation-states, especially if it’s mentioned in the announcements? Are you an individual user who is outspoken in your criticism or opposition to one or more aggressive nation-states, especially if it’s mentioned in the announcements?

    If your answer to either of those is NO, then you are not a member of a high-value organization.

    If you are not a member of a high-value organization

    The next steps are easy: run a virus/malware scanner, then install v8.9.1 from official sources, as described in How do I clean up, above.

    Short Version: Don’t Overthink This

    If you or your team is outspoken against the nation-state mentioned, or you know that your team is a high-value organization to such a nation-state, find the person on your team who is the IT security expert, and have them look for the indicators of compromise. If you are uncertain, then you almost certainly weren’t the target; but if you have an IT department, they can still look for indicators of compromise.

    Either way, the next steps are the same: run a virus/malware scanner, then manually install the newest version, and you will be safe going forward.

  • autoupdater and connection temp.sh

    Security
    37
    0 Votes
    37 Posts
    18k Views
    PeterJonesP

    @Martin-1 said in autoupdater and connection temp.sh:

    @PeterJones That is what i meant. I don’t understand what is being said in those links or what is being said above. hence the repeat of my questions.

    Then ask for clarification, rather than ask the same thing over and over.

    Besides, the https://notepad-plus-plus.org/news/clarification-security-incident/ link that @donho most recently posted seems pretty clear to me:

    Who Was Targeted?

    This was a highly selective attack by a state-sponsored group targeting specific high-value organizations. Security researchers confirmed that the vast majority of Notepad++ users were never affected - attackers filtered victims based on strategic value, not random distribution.

    For most users: Simply updating to the latest version is sufficient.

    If you are a member of a a high-value organization, then you need to find someone on your IT team who does understand all the technical details. (If you are unsure whether your organization would be considered “high value”, then it wouldn’t be.) If you are not, then you are part of the “for most users” group. And those instructions seem quite clear to me: manually update to v8.9.1.

  • Session migration

    General Discussion
    2
    0 Votes
    2 Posts
    43 Views
    PeterJonesP

    @Magic-Mugs ,

    Assuming all your open files are real files, and all in the exact same folders on old and new machine, then just copy over %AppData%\Notepad++\session.xml

    If some of your files are the unsaved new # tabs, you will also need to copy over everything in %AppData%\Notepad++\backup\

    But if you want all the same settings from your old to your new, just copy over everything from %AppData%\Notepad++\

  • 0 Votes
    2 Posts
    59 Views
    PeterJonesP

    @nikkinisly ,

    The thing truly named “Plugin Manager” was last compatible with Notepad++ in v7.5.9 from October 2019. Had you really not updated since then?

    Or are you talking about Plugins Admin? That’s the builtin replacement since v7.6 in November 2019

    And it’s still in v8.9.1:
    0e15144b-967e-42d8-a505-a19330607d00-image.png

    My guess is that you deleted gup.exe and/or other of the content in the updater folder, or the plugin list DLL. To find out:

    Exit Notepad++ Perform steps 1-3 for each of the following files List of files C:\Program Files\Notepad++\notepad++.exe C:\Program Files\Notepad++\plugins\Config\nppPluginList.dll C:\Program Files\Notepad++\updater\GUP.exe C:\Program Files\Notepad++\updater\libcurl.dll If any of those files are missing, you will need to reinstall, making sure to include the auto-updater and Plugins Admin, because all of those files are required for Plugins Admin to work Steps Right click on the file and choose Properties Look to see if it still has the Unblock checkbox If it does, checkmark it, then click Apply / OK

    here is an example of a GUP.exe that still has the mark of the web:
    9baed526-5a1a-4497-a75b-1acdc23f3b85-image.png

    After making sure the Mark of the Web is gone from all those files, then restart Notepad++, and Plugins Admin should be there.

  • 0 Votes
    5 Posts
    157 Views
    PeterJonesP

    @PeterJones said in Is There a Way to Prevent Pasted Text from Spreading Out with Rows of Spaces?:

    implementing it in PythonScript today

    Thankfully, I found an old script which did something related, which was easy to update.

    # encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/27385/ This will paste the CF_TEXT plaintext from the clipboard, but will convert any series of newline characters into a single space before doing the paste. Because this uses .insertText() instead of putting the modified text back into the clipboard and doing .paste(), it should avoid clobbering the clipboard. (based on @alan-kilborn's clipboard script here: <https://community.notepad-plus-plus.org/post/97132>) """ from Npp import * try: editor3h # third editor, hidden except NameError: editor3h = notepad.createScintilla() def get_clipboard_text_without_newlines(): retval = '' editor3h.clearAll() editor3h.paste() if editor3h.getLength() > 0: editor3h.rereplace(r'[\r\n]+', ' ') # replace all newline seqeuences with a single space retval = editor3h.getText() return retval editor.beginUndoAction() editor.insertText(editor.getCurrentPos(), get_clipboard_text_without_newlines()) editor.endUndoAction()

    This has been tested in the PythonScript 3 plugin. The PythonScript FAQ explains how to install PythonScript plugin, and how to run a script using PythonScript plugin, and even how to assign a keyboard shortcut to the script. Make sure you follow the instructions for PythonScript 3, not PythonScript 2 (as I have not tested under the older plugin syntax, though it will likely work there)

  • Notepad++ v8.9.1 Release

    Pinned Announcements
    9
    6 Votes
    9 Posts
    7k Views
    PeterJonesP

    @mpheath said in Notepad++ v8.9.1 Release:

    I am unsure what you fixed.

    @mpheath, the user had outdated themes, which didn’t have the KEY style for either Langage:INI or Language:Properties. When v8.9.1 brought in all those style entries for the INI and Properties lexers, it began properly formatting those styles rather than ignoring those styles that weren’t defined in the themes. This was the intention of the new style-updating feature: it is intended to bring all themes up-to-date, so that they can format all the styles that users have not been seeing for years (for some, it’s a decade or more of missing syntax highlighting).

    @Drift91: As with all styles, if you don’t like the formatting that is chosen by default for a given style, you are free to change it for yourself. You go to Settings > Style Configurator > Language: INI or Language: Properties, select Style: KEY and change the Italic checkbox, as shown here for INI: 4b2d19b9-b707-4bc0-a668-3b1acb7041c8-image.png

  • Strange highlighting in PHP files

    General Discussion
    3
    0 Votes
    3 Posts
    153 Views
    Nazar HotsaN

    Thank you! Problem solved.

  • 0 Votes
    2 Posts
    58 Views
    EkopalypseE

    @Jay-S

    I replied here.

  • 1 Votes
    2 Posts
    225 Views
    shane knappS

    @David-Brown i came here to let you know that my receipt had what appears to be his email address on it (which i’ve blocked out here for privacy):

    2a1a9747-0e42-4d15-80d0-eb4737ffabd4-image.png

    seems legit to me, but i can’t know for sure. :)

  • 0 Votes
    2 Posts
    183 Views
    PeterJonesP

    @Ilhan-Yumer ,

    The developer does not read most posts in this Forum. If you would like to suggest such a move to the developer, I would recommend creating a new Issue at GitHub requesting it (https://github.com/notepad-plus-plus/notepad-plus-plus/issues).

  • Chinese compromise began as early as NP++ v8.6.9

    Locked Security
    4
    0 Votes
    4 Posts
    507 Views
    PeterJonesP

    Future readers: if you want more information for the context of this discussion, See the FAQ, which has the best summary I can make, as of 2026-Feb-04; if new information is available, the FAQ will be updated. ALL followups/discussions must go in Topic: autoupdater and connection to temp.sh. This tangent is LOCKED.

  • I am very confused about the Notepad++ security issue

    Locked Security
    3
    0 Votes
    3 Posts
    181 Views
    PeterJonesP

    See the FAQ, which has the best summary I can make, as of 2026-Feb-04; if new information is available, the FAQ will be updated. ALL followups/discussions must go in Topic: autoupdater and connection to temp.sh. This tangent is LOCKED.

  • 1 Votes
    3 Posts
    174 Views
    PeterJonesP

    See the FAQ, which has the best summary I can make, as of 2026-Feb-04; if new information is available, the FAQ will be updated. ALL followups/discussions must go in Topic: autoupdater and connection to temp.sh. This tangent is LOCKED.

  • 0 Votes
    2 Posts
    94 Views
    Jan LarsenJ

    Turns out it was an issue with the GPU driver, which has now been patched.

  • 0 Votes
    11 Posts
    6k Views
    Ahmad IqbalA

    @archerarcher1 I will suggest LongPathTool to solve this error.

  • 0 Votes
    2 Posts
    84 Views
    PeterJonesP

    @Fred-Morant ,

    Regular expressions don’t work the way you expect in search-backwards mode, so it’s disabled except for advanced users.

    Advanced users can look at the user manual and figure out how to enable regexBackward4PowerUser

    https://npp-user-manual.org/docs/preferences/#preferences-for-advanced-users

  • Advices to prevent further security vulnerabilities

    Moved Security
    4
    0 Votes
    4 Posts
    443 Views
    NppenjoyrN

    BTW:

    5.1-if your home internet speed is fast enough, setup your own web server to your pc under virtualbox(in case of web server software cve’s/rce’s). I or anyone can help with that. Dont forget to hardening server for security.

    IMO, this is BAD advice. To suggest to a non-security specialist who runs this as a hobby, that he should self-host, and try to keep up on all the security hardening, is asking him to get hacked even worse than the hack that already happened. He was literally paying a host to provide such services, and the professionals failed; he has now changed providers to a host who has better security procedures.

    Believe me it’s not that hard to setup a webserver or harden it, especially while backed by a strong community. The risks are different when hosting at home between hosting remotely. The hosting firm may be offered money to hijack, or an out-of-date hosting management software had rce was waiting to be abused.