• 0 Votes
    7 Posts
    358 Views

    @dail nailed it, and @Nick-Brown was very close (but slightly incomplete). Thanks, both of you.

    If I do this in PythonScript:

    editor.indicSetStyle(31, 16) editor.indicSetOutlineAlpha(31, editor.indicGetAlpha(31))

    Then I get the effect I’m after:

    0504a455-746f-48eb-9a80-00d66b6661ae-image.png

    Note that 31 is the indicator number for red-marking, and 16 is the value for INDIC_FULLBOX.

  • 0 Votes
    6 Posts
    438 Views

    @arpan-kumar ,

    Well, if you don’t need spell check turned on while editing XML files, you can go to Plugins > DSpellCheck > Settings, and change the “File Types” section to “Check only NOT those:” and *.xml as the text entry, as shown in my screenshot:

    8d61bf2e-5c7a-4ff2-b4f8-32c3b6ed6214-image.png

    When I do that (and APPLY or OK), it stops spell checking the XML files. I don’t know if that will be sufficient for you. (I created a 2MB XML file, and even with DSpellCheck doing spell check and finding misspelled words, I couldn’t get it to hang when folding/unfolding the various levels. So I cannot replicate your problem to know whether turning off spell checker for XML is sufficient.)

  • UDL - using keywords with spaces

    Dec 22, 2021, 10:02 AM
    0 Votes
    2 Posts
    614 Views

    @pierre-de-la-verre

    Can you give me an example?

    677c53b9-78b9-437a-9963-5ada0efd83d4-image.png

  • 0 Votes
    8 Posts
    899 Views

    Additional helpful information for combining search criteria is found HERE.

  • What is BUFFERENCODING.COOKIE ??

    Oct 12, 2020, 2:37 PM
    0 Votes
    10 Posts
    1k Views

    @alan-kilborn said in What is BUFFERENCODING.COOKIE ??:

    How is one to tell the difference, in Pythonscript, if the current file’s encoding is UTF-8 without BOM, or for example, ISO-8859-1 ?

    @peterjones said in What is BUFFERENCODING.COOKIE ??:

    I thought there would be a way to read back the character set, distinct from the GETBUFFERENCODING message… but I cannot find a message that does that. Barring that, I thought that the scintilla object might have that info somewhere, but I cannot find it there, either. …maybe @Ekopalypse has insight on this one.

    @ekopalypse said in What is BUFFERENCODING.COOKIE ??:

    Sorry, but I have no idea.

    So…it’s a bit cheesy, but one can read the status bar field that shows the encoding type to get this information (as its text string).

    We’ve discussed in this forum how to get the status bar data before using a PythonScript, but I’ve revamped my code for doing it so I’ll post the whole thing here.

    Here’s NotepadGetStatusBar.py with a demo at the end to show the current file’s encoding:

    # -*- coding: utf-8 -*- from __future__ import print_function from Npp import * import ctypes from ctypes.wintypes import BOOL, HWND, WPARAM, LPARAM, UINT class NGSB(object): # implements a "getStatusBar" function (complement to notepad.setStatusBar()) def __init__(self): self.SendMessageW = ctypes.windll.user32.SendMessageW LRESULT = LPARAM self.SendMessageW.restype = LRESULT self.SendMessageW.argtypes = [ HWND, UINT, WPARAM, LPARAM ] self.create_unicode_buffer = ctypes.create_unicode_buffer self.curr_class_256 = self.create_unicode_buffer(256) self.STATUSBAR_HANDLE = None self._determine_statusbar_handle() assert self.STATUSBAR_HANDLE def get_statusbar_by_section(self, statusbar_item_number): # statusbar_item_number can be integer 0 thru 5 or one of: # STATUSBARSECTION.DOCTYPE # STATUSBARSECTION.DOCSIZE # STATUSBARSECTION.CURPOS # STATUSBARSECTION.EOFFORMAT # STATUSBARSECTION.UNICODETYPE # STATUSBARSECTION.TYPINGMODE return self._get_statusbar_section(statusbar_item_number) def get_statusbar_as_tuple(self): section_list = [ STATUSBARSECTION.DOCTYPE, STATUSBARSECTION.DOCSIZE, STATUSBARSECTION.CURPOS, STATUSBARSECTION.EOFFORMAT, STATUSBARSECTION.UNICODETYPE, STATUSBARSECTION.TYPINGMODE, ] return tuple(list(map(lambda x: self._get_statusbar_section(x), section_list))) def _determine_statusbar_handle(self): WNDENUMPROC = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM) FindWindowW = ctypes.windll.user32.FindWindowW FindWindowExW = ctypes.windll.user32.FindWindowExW EnumChildWindows = ctypes.windll.user32.EnumChildWindows GetClassNameW = ctypes.windll.user32.GetClassNameW self.STATUSBAR_HANDLE = None def enum_callback_fn(hwnd, lparam): GetClassNameW(hwnd, self.curr_class_256, 256) if self.curr_class_256.value.lower() == "msctls_statusbar32": self.STATUSBAR_HANDLE = hwnd return False # stop the enumeration return True # continue the enumeration npp_hwnd = FindWindowW(u"Notepad++", None) #print('npp_hwnd:', npp_hwnd) EnumChildWindows(npp_hwnd, WNDENUMPROC(enum_callback_fn), 0) #print('self.STATUSBAR_HANDLE:', self.STATUSBAR_HANDLE) def _get_statusbar_section(self, statusbar_item_number): assert statusbar_item_number <= 5 WM_USER = 0x400 SB_GETTEXTLENGTHW = WM_USER + 12 SB_GETTEXTW = WM_USER + 13 SBT_OWNERDRAW = 0x1000 retcode = self.SendMessageW(self.STATUSBAR_HANDLE, SB_GETTEXTLENGTHW, statusbar_item_number, 0) length = retcode & 0xFFFF type = (retcode >> 16) & 0xFFFF assert (type != SBT_OWNERDRAW) text_buffer = self.create_unicode_buffer(length) retcode = self.SendMessageW(self.STATUSBAR_HANDLE, SB_GETTEXTW, statusbar_item_number, ctypes.addressof(text_buffer)) retval = '{}'.format(text_buffer[:length]) return retval if __name__ == '__main__': print(NGSB().get_statusbar_by_section(STATUSBARSECTION.UNICODETYPE))

    Running the script will print the current file’s encoding (from statusbar information) to the Pythonscript console window.

  • Search, Use Result to Add Code

    Dec 17, 2021, 5:34 PM
    0 Votes
    10 Posts
    526 Views

    @richard-howard said in Search, Use Result to Add Code:

    So, after your ‘encouraging me’ to do a little research before just asking for the answer, I found something that works.

    Awesome. You can only get better by taking such initiative.

  • 0 Votes
    7 Posts
    2k Views

    @simon-kravis These settings fixed the problem
    3371f9d6-3fbb-46d5-b1d7-897a9d53133a-image.png

  • 0 Votes
    14 Posts
    1k Views

    @terry-r Thanks Terry. It is already ticked. I don’t know why it wasn’t notifying me of updates and I never deliberately disabled it. Not sure why that happened. Just now that I think about it, it used to asked for updates, but not in some time. I’ve manually done it now anyway.

    Will need to go and rewrite a second file it’s wiped on me now :(

  • replacement

    Dec 18, 2021, 5:41 AM
    0 Votes
    3 Posts
    226 Views

    @alan-kilborn said in replacement:

    ${1}3000

    thank you

  • regex replace performance regression

    Dec 1, 2021, 11:47 AM
    2 Votes
    15 Posts
    1k Views

    Hi, @cmeriaux, @peterjones, @alan-kilborn, @arkadiuszmichalski and All,

    So, I"m going on testing some examples of text, dealing with replacements, bookmarks and replacement modifiers ! Note that I did not consider the Admin case, rather identical !

    First, I used the @sasumner’s file data8279.txt ( 300,000 lines ) and I performed two types of text :

    A global replacement of (?-s)^.*NotepadPP.*\R with Nothing, with the Wrap around option ticked ( First table, below )

    A mark operation of the string NotepadPP, with the Bookmark line and Wrap around option ticked, but not the Match case one, followed with a Search > Bookmark > Remove Bookmarked Lines operation ( Second table, below )

    203,236 occurrences were deleted or were marked then deleted !

    •===============•=============•==========•=================• | Archi- | Version | User Mode | | | |----------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==========•=================• | Win XP x32 | 7.9.2 | 65.0 s | -/- | •===============•=============•==========•=================• | Win 10 x32 | 7.9.2 | 47.6 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 7.9.2 | 37.5 s | | •===============•=============•==========•=================• | Win 10 x32 | 7.9.5 | 47.4 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 7.9.5 | 37.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.0 | 86.2 s | | •---------------•-------------•----------• 1.22 | | Win 10 x64 | 8.0 | 70.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.5 | 47.6 s | | •---------------•-------------•----------• 1.27 | | Win 10 x64 | 8.1.5 | 37.5 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.9.2 | 47.5 s | | •---------------•-------------•----------• 1.28 | | Win 10 x64 | 8.1.9.2 | 37.2 s | | •===============•=============•==========•=================• •===============•=============•====================================• | Archi- | Version | User Mode | | | |------------------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==================•=================• | Win XP x32 | 7.9.2 | 10.0 s + 64.2 s | -/- | •===============•=============•==================•=================• | Win 10 x32 | 7.9.2 | 4.9 s + 49.1 s | | •---------------•-------------•------------------• 1.36 | | Win 10 x64 | 7.9.2 | 2.1 s + 37.5 s | | •===============•=============•==================•=================• | Win 10 x32 | 7.9.5 | 4.8 s + 49.1 s | | •---------------•-------------•------------------• 1.35 | | Win 10 x64 | 7.9.5 | 2.3 s + 37.6 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.0 | 20.0 s + 49.1 s | | •---------------•-------------•------------------• 1.31 | | Win 10 x64 | 8.0 | 14.8 s + 37.8 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.1.5 | 4.8 s + 49.3 s | | •---------------•-------------•------------------• 1.35 | | Win 10 x64 | 8.1.5 | 2.3 s + 37.7 s | | •===============•=============•==================•=================• | Win 10 x32 | 8.1.9.2 | 4.8 s + 49.2 s | | •---------------•-------------•------------------• 1.37 | | Win 10 x64 | 8.1.9.2 | 2.1 s + 37.4 s | | •===============•=============•==================•=================•

    In the second table, I decomposed the total time in two parts :

    Time to bookmark the lines

    Time to delete these lines

    I summarized the two values before calculating the ratio x32/x64

    Interpretation of the results :

    If xe except the special case of the v8.0 version, the results are very similar, for the two tables :

    In the first case, the more complicated regex (?-s)^.*NotepadPP.*\R decrease a bit the ratio between the x32 and x64 versions

    In the second case, both the mark operation and the deletion of lines have an impact, but the ratio between the x32 and x64 versions is a bit better

    Note that, regarding the v8.0 version, in the second table, the performance regression comes from the bad results of the mark operation only !

    I performed a last test, using the same Search and Replace regexes than in my initial issue :

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9636

    So the regex S/R :

    SEARCH \w

    REPLACE \U$0

    I, then, created a file containing 1,000 lines ( every odd ones ) with the French text :

    C’est là, près de la forêt, dans un gîte, où régnait un grand capharnaüm, que l’aïeul ôta sa flûte et son bâton de son canoë.

    And I added 1,000 English lines ( every even ones ) :

    Here is a example of text, containing the complete French set of accentuated characters, traditionally used.

    After replacement, 184,000 occurrences have been modified :

    •===============•=============•==========•=================• | Archi- | Version | User Mode | | | |----------•-----------------| | tecture | Notepad++ | Time | Ratio x32/x64 | •===============•=============•==========•=================• | Win XP x32 | 7.9.2 | 18.7 s | -/- | •===============•=============•==========•=================• | Win 10 x32 | 7.9.2 | 10.5 s | | •---------------•-------------•----------• 2.56 | | Win 10 x64 | 7.9.2 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 7.9.5 | 10.3 s | | •---------------•-------------•----------• 2.51 | | Win 10 x64 | 7.9.5 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.0 | 38.5 s | | •---------------•-------------•----------• 1.41 | | Win 10 x64 | 8.0 | 27.4 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.5 | 10.4 s | | •---------------•-------------•----------• 2.54 | | Win 10 x64 | 8.1.5 | 4.1 s | | •===============•=============•==========•=================• | Win 10 x32 | 8.1.9.2 | 10.4 s | | •---------------•-------------•----------• 2.54 | | Win 10 x64 | 8.1.9.2 | 4.1 s | | •===============•=============•==========•=================•

    Interpretation of the results :

    Again, if we except the special case of the v8.0 version :

    The results, whatever the version, are quite similar, for each case ( x32 and x64 )

    The ratio x32/x64 is similar to the one of my previous post ( ~ 2.52 ) !

    Best Regards,

    guy038

  • Regex Search With Quotations

    Dec 17, 2021, 8:31 PM
    0 Votes
    7 Posts
    3k Views

    @peterjones thanks for all your help!

    is there a marked as Solved for this forum?

  • Sorting columns numerically

    Dec 17, 2021, 10:31 PM
    0 Votes
    3 Posts
    406 Views

    @astrosofista said in Sorting columns numerically:

    Sort Lines as Integers Ascending

    Thanks a lot, works flawlessly!

  • Big borders around edit space

    Dec 17, 2021, 7:33 PM
    0 Votes
    2 Posts
    225 Views
  • Indenting multiple empty lines

    Dec 17, 2021, 2:22 PM
    0 Votes
    2 Posts
    389 Views

    @danz4c ,

    That’s the way it’s designed.

    If you want to get empty lines indented as well, use column select (alt+drag) on the zeroth column, then hit TAB.

  • 0 Votes
    2 Posts
    335 Views
  • black boxes on all files I open

    Dec 15, 2021, 4:06 PM
    0 Votes
    4 Posts
    1k Views

    @patrick-donovan said in black boxes on all files I open:

    Not a very techy guy

    I think that’s going to have to improve dramatically for you to get very far. :-)

  • 0 Votes
    3 Posts
    245 Views

    @neil-schipper thanks.

    WORKS:

    Regex Search: https://website\.com/en\w{1,}

  • 0 Votes
    3 Posts
    715 Views

    Bookmarks are saved as part of the “session”.
    If you close a file, it gets removed from the session, and when reopened, it looks like a new file to the session (thus no bookmarks).

    There’s a demo PythonScript HERE that could be “rounded out” to pseudo-provide a load/save extension for bookmarks.

    For me, and I presume most users, the capability in Notepad++ currently is enough.

  • Replace before

    Dec 14, 2021, 2:37 PM
    0 Votes
    5 Posts
    988 Views

    @peterjones First of all, I’m sorry for my incompetence to provide neccessary data - I mean it. I wrote my response in a hurry and wrongly supposed that you didn’t catch the link to my previous post (sorry for that also) and thought that info in that post is enough.
    None of this is your problem and I donť want to make any excuses for this behaivour…just for clarification.

    And BIG THANKS that you spent your time with replying despite everything above! Your guess was correct and provided solution does exactly what I need.

    So sorry again and thank you also. Next time, if I’ll need some advice in the future, I’ll try to specify my needs better and provide test data in the first place.

  • "Compare" adds an empty line

    Dec 14, 2021, 9:21 AM
    0 Votes
    3 Posts
    607 Views

    @mrde50ae said in "Compare" adds an empty line:

    Compare plugin 1.5.6.2,

    I’m not even sure where you got that version.
    The current repo, https://github.com/pnedev/compare-plugin/releases, shows v2.0.0 and v2.0.1.

    The older repo, under the previous developer, https://github.com/jsleroy/compare-plugin/tags, has v1.5.4, v1.5.5, and v2.0.0

    Please note : Notepad++ v7.7 from 2019 included a major upgrade to “Scintilla”, the underlying code for the text editor panes correction: to the API that plugins use to communicate with the Notepad++ application; that update meant that some plugins had to update their code to be compatible with those changes. “Compare v2.0.0 for Notepad++ 7.7” was the release of the plugin for Notepad++ v7.7 and newer; no version of Compare plugin released before that special v2.0.0-release are expected to work with Notepad++ v7.7 or newer.

    So if any version of Compare Plugin prior to that special v2.0.0 work at all with your Notepad++ 7.9.1, it’s by chance, not by design. And really, you should be using the newest v2.0.1 for the best compatibility with Notepad++.