• 1 Votes
    4 Posts
    804 Views
    mkupperM

    @Ennapocryph said in session.xml is lost - overwritten by Notepad++ after crashes:

    I feel like this bug could easily be fixed. Only save the settings when there’s enough disk space available. Or first save the settings to a new file, and only overwrite the last settings when the saving was successful.

    It’s not clear that there was a “bug” much less one that can “easily be fixed.” Your disk filled up and Notepad++ has been ordered to close/exit (either by the human or the the operating system). When that happens there is not much that applications can do that won’t upset a human somewhere. The human that believes they are in charge of a particular machine needs to make some decisions about what actions they would like to do and the order of those actions.

    We could make some changes to Notepad++'s code that would increase the odds of the configuration plus session stuff being saved when the disk is both 100% full and things in the background are continuously grabbing every single available byte of disk space, and perhaps the system is in the middle of crashing or being shut down. Those change are not “easy” and can’t be guaranteed to work 100% of the time. Related to this is that some Notepad++ plugins also save configuration files.

    Keep in mind that Notepad++ will not have, and can’t have, the same rights to system access as the Microsoft Windows’ Trusted Installer subsystem. The Trusted Installer can and will lock down our systems for minutes at a time while it works. The Trusted Installer does the lockdown as it does not want external processes to sneak in and to make changes, such as filling up the disk, while the Trusted Installer does the shuffle dance related to installing or updating Windows components and their configuration. I brought up the Trusted Installer here as that’s the thing that likely filled up your disk and is busy at work at the time you were trying to exit from Notepad++. The Trusted Installer will have priority over whatever applications such as Notepad++ want to do.

    Finally, Notepad++'s design philosophy has been to be as lightweight and portable as possible. The configuration has always been stored in normal text files saved to a single folder or its sub-folders. Notepad++ does not use the Windows registry or database style transaction logs or whatever that would improve its ability to retain the settings in edge cases such as the disk is full and/or the Trusted Installer is busy.

  • 0 Votes
    16 Posts
    2k Views
    guy038G

    Hello, @ahamed-nawas-ali, @peterjones, @alan-kilborn and All,

    @ahamed-nawas-ali, I’ll use a similar search regex to the @alan-kilborn’s one !

    For example , given this INPUT text , below :

    2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 Learning Selection B. Home Webinar IDB 20214980 2021420214202216 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 Test B. Home Webinar IDB 20214980 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 Try Selection B. Home Webinar IDB 20214980 2021420214202216 Blablah OK END of story

    Open the Replace dialog ( Ctrl+H )

    Uncheck all box options

    Search (?-s)^(\d{4}-.+\t).+\R\K(?!\d{4}-|\R|\z)

    Replace $1

    If necessary, check the Wrap around option

    Select the Regular expression search mode

    Click, exclusively, on the Replace All button, several times, till the message Replace All: 0 occurrences were replaced... is displayed !

    At the end, you should get this expected OUTPUT text :

    2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 Learning 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 Selection 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 B. Home 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 Webinar 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 IDB 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 20214980 2021-09-14T21:10:55+00:00 ATX Field3 Guy Field5 2021420214202216 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 Test 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 B. Home 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 Webinar 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 IDB 2021-09-15T11:19:14+00:00 BYQ Field3 Alan Field5 20214980 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 Try 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 Selection 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 B. Home 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 Webinar 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 IDB 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 20214980 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 2021420214202216 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 Blablah 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 OK 2021-09-16T15:07:46+00:00 ATX Field3 Peter Field5 END of story

    Voila :-))

    Notes :

    As you can see, the number of columns, before the last one, is not a problem !

    From beginning of line ( ^ ), the regex looks for a line beginning with 4 digits, followed with a dash character (\d{4}- ) and anything else till the last tabulation ( .+\t ) of current line

    This search, so far, is memorized and stored as group 1

    After the last field of the line and the line-break ( .+\R ), all the matched string is discarded ( \K )

    Thus, the regex engine is now searching for a zero-length string, at beginning of the next line, but ONLY IF this next line does not begin with :

    4 digits and a dash char

    An other line-break

    The very end of current file

    When this assertion is true, it just inserts the group 1 contents at the very beginning of current line

    Best Regards

    guy038

    P.S. :

    If the condition to detect the header lines seems not restrictive enough, you may use this alternate search regex :

    Search (?-is)^(20\d\d-\d\d-\d\dT.+\t).+\R\K(?!20\d\d-\d\d-\d\dT|\R|\z)
  • Notepad++ File binary layout & display beats Vscode

    1
    2 Votes
    1 Posts
    201 Views
    No one has replied
  • Icon on the first tab is not fully displayed

    3
    0 Votes
    3 Posts
    133 Views
    EkopalypseE

    @Alan-Kilborn

    Maybe, I’m just not sure if it’s really an NPP issue or something on my end because, kinda weird, right?

  • Looking for dBASE IV (old DOS versions) UDL

    20
    2 Votes
    20 Posts
    914 Views
    Lycan ThropeL

    @James-Burke-0 ,
    Unless it has the ability to read dbf7 tables, it doesn’t read all dbf formats. Just an FYI.

  • Notepad++ v8.7 - Error Sysprep

    3
    0 Votes
    3 Posts
    626 Views
    Marcos Paulo GonçalvesM

    @PeterJones Yes, this is the same problem I’m facing. I haven’t found a solution to the problem. I’m having to use an old version of Notepad++ that didn’t have this error.

    I just commented on /issues/29 , which you sent me.

  • 7 Votes
    31 Posts
    6k Views
    sam rathodS

    @guy038
    Sorry for the inconvenience caused.

    Thanks a lot will try this. I m sure this will work.

    Regards,
    Aa

  • a newbie question about search

    16
    0 Votes
    16 Posts
    558 Views
    PeterJonesP

    @Alen-Mark ,

    Please note: this is the second time you’ve come to the forum and posted ultra-generic content that sounds vaguely on-topic: it is highly reminiscent of AI-generated phraseology.

    Please understand that posting AI-Generated content is expressly forbidden in this forum. And if your posts continue to appear as if they are – whether or not they are – you are likely to get banned. If you wish to avoid looking like (and getting banned as) AI, then I suggest you tailor your replies to the individual posts, rather than providing overly-generic responses that don’t take into account the context of the entire conversation.

  • Exploring the Power of Notepad++: Key Features for Every User

    2
    -4 Votes
    2 Posts
    841 Views
    Alan KilbornA

    This seems like a baiting post to get upvotes so that the user can then better spam the forum. PLEASE DO NOT UPVOTE THIS USER’S POST ABOVE.

  • how to swap data format of 2 diffent jsons

    5
    0 Votes
    5 Posts
    261 Views
    Mark OlsonM

    @stefano-marinoni said in how to swap data format of 2 diffent jsons:

    the result i want is another json

    Thank you for slightly clarifying your objective. However, as we have also made clear, we still do not know anything about the conversion you want to perform, beyond the fact that it is a conversion between two JSON formats. This is a Notepad++ forum, not a forum for any random programming question you might have; that would be StackOverflow. This sounds like a question you should ask there, or answer for yourself by consulting a search engine.

    If you expect this forum to be at all useful to you, you need to explain clearly what you are trying to do, rather than giving a vague description of your goal and expecting us to infer the rest.

  • quick one...

    7
    0 Votes
    7 Posts
    242 Views
    PeterJonesP

    @x-77-x said in quick one...:

    i dont understand what peter is talking about

    Sorry, given the proficiency that your original regex showed, I had hoped that you would understand my pointers.

    The FAQ gives the following formula for replacing within a zone of text on one line – it was meant as a “fill in the blank” so that you could use the formula even if you don’t understand the syntax used:

    SEARCH (?-s)(?-i:BSR|(?!\A)\G).*?\K(?-i:FR)
    REPLACE RR

    The FAQ also explained what BSR and FR meant.

    I also told you that BSR for your case was ^NAME= and that what you wanted to match was \b\w+\b (sorry, I thought I had told you that was FR, but apparently didn’t type that part), and that your replacement should be \u$0

    Thus, you should try SEARCH = (?-s)(?-i:^NAME=|(?!\A)\G).*?\K(?-i:\b\w+\b) and REPLACE = \u$0

    … At least, that worked for me given your example data.

  • Note able to delete a page, it restores back

    2
    0 Votes
    2 Posts
    234 Views
  • display degree symbol in N++

    9
    0 Votes
    9 Posts
    2k Views
    Alan KilbornA

    @William-C said in display degree symbol in N++:

    press alt and 0176 on the keyboard to insert the degree sign

    It isn’t about “inserting” it, it’s about “displaying” it, as the topic title text and previous discussion clearly shows.

  • v8.7 status bar appears cropped

    10
    1 Votes
    10 Posts
    484 Views
    LincolnFoxL

    It helped me, thank you so much.

  • Feature Request: Parallel Processing (Multithreading)

    10
    0 Votes
    10 Posts
    2k Views
    Mark OlsonM

    @Harry-Brookes said in Feature Request: Parallel Processing (Multithreading):

    I think it’s simpler when people don’t try to find reasons for things being harder than they actually are.

    People constantly insist that the single-threaded nature of most core Notepad++ APIs must just be due to sheer laziness on the part of its core devs, and those people have apparently never actually looked at the codebase and tried to understand the issues involved. Refactoring anything in NPP to use multiple threads is (by my estimate) several times more difficult than creating a multithreaded version of the same thing from the ground up.

    Notepad++ has a tremendous amount of shared global state, which could only be made compatible with multithreading through extensive use of mutexes, which would then introduce dramatic performance losses in single-threaded use cases (at best) and deadlock (at worst). By the way, have you ever tried to debug a multithreaded program without extensive use of log files? Hahahahaha, good luck.

    Find-and-replace in files seems like an embarrassingly parallel operation (or at least one that can be achieved with only one or two mutexes), but the devil is in the details, and as someone who has actually read the source code for Notepad++'s implementation, there are a lot of details there.

    EDIT: AFAICT, the simplest way to even begin to implement multithreaded find-in-files in NPP would be to use multiple Scratchtillas (NPP uses _pscratchTilla as a lightweight way to run Scintilla operations like find/replace on a file without doing any graphics rendering), and use some simple task-dividing/scheduling algorithm to decide which Scratchtilla works with which file. The scariest problem that I can think of comes when the the Scratchtilla has to report its progress back to the form that shows progress. From my limited experience (I am admittedly a noob to multithreading with GUIs), there seems to be a lot of risk of deadlock whenever multiple threads contend for a lock on a GUI element. And that’s just the tip of the iceberg.

  • 🔦 menu - how to add separators?

    11
    1 Votes
    11 Posts
    2k Views
    Alan KilbornA

    @westyles said in 🔦 menu - how to add separators?:

    it closes instantly after startup

    Well, no one ever clicks on a separator.
    Hmm, maybe accidentally…

    name=“” is better for me

    Then it doesn’t look like a separator.

  • 门这个字显示有问题

    5
    0 Votes
    5 Posts
    356 Views
    PeterJonesP

    @mkupper said in 门这个字显示有问题:

    I am wondering though what the font picking logic is.

    Black magic on the part of the OS. It’s influenced by the Direct Write setting, but it can still sometimes pick an alternate font for certain glyphs, even with DW off (as you showed).

    Unfortunately, I don’t know the behind-the-scenes stuff.

    I thought there was a discussion a few years ago, where I had some knowledge then than I do not now have [it was research done at the time, but the details are long since forgotten], but I cannot seem to find the post(s) I’m thinking about for the moment –

    update 1: ah, there it is: I was thinking about the posts dealing with “CompositeFont” – so read the discussions from that search for more…


    update 2: I searched the internet for “what characters look similar to U+95E8”, and though the first SO question I found didn’t answer what looked similar, it did show a screenshot from something else that shows that the glyph that Notepad++ displays is not unheard-of for U+95E8, even outside of Notepad++.


    update 3: per this, it looks like the alternate glyph we’re seeing might be the Japanese Kanji / Ryakuji form. Ooh, and that page also looks like U+2ED4 might give the glyph you are looking for (though I cannot comment on meaning or implication of using one Unicode codepoint vs the other.)

    The two compared in Notepad++:
    55a57ad1-009d-4955-844f-97edab8f688f-image.png


    update 4: MS Notepad has the same issue with that character:
    a154b1f8-7336-44ec-ad4e-99c31b14774d-image.png

    And looking through my C:\Windows\Fonts\GlobalMonospace.CompositeFont (see the “CompositeFont” search link, above), which lists some alternate fonts that support CJK Unified range:
    939eb42e-f487-4100-9072-161cd5a259f6-image.png
    If I change to “Microsoft YaHei” as the font for Notepad++ (or MS Notepad), I can get Notepad++ to show the glyph you expect for U+95E8:
    20b89ced-d411-4b11-91ee-8a3745e1807b-image.png
    … but it’s not a monospaced font, and every once in a while (on Notepad++ display refresh, maybe?), it seems to have to do some complicated re-drawing.

    But if you can find a monospace font with the appropriate unicode slots populated that you’re willing to have as your Notepad++ font, that might work for you.


    Caveat: I don’t deal with such characters or glyphs in my personal nor professional life; I just find myself drawn in when the unexpected happens in Notepad++, and I’m trying to be helpful, based on what I can find with some research on the internet that might shed light for me or those who bother reading my posts…

  • 2 Votes
    18 Posts
    1k Views
    PeterJonesP

    @Alan-Kilborn said in Strange behavior of the sort function, with zero-length column mode selection:

    Is Peter showing his BASIC roots here by using <>?

    100 PRINT "BASIC FOREVER" 200 GOTO 100
  • Scrollable page tabs

    9
    0 Votes
    9 Posts
    7k Views
    mkupperM

    @Ian said in Scrollable page tabs:

    Just reading this now, in 2024, about eight years after thread creation.
    Atop, there are tabs of all Notepad++ files open. I can two-finger-scroll up or down to move the tabs to the right or left, respectively. I love this feature but on my Notepad++ the scrolling sensitivity is much too light. Even the slightest scroll moves the tabs so quickly I miss any tabs in the middle, between my most recently and least currently opened files. How can I slow the scrolling speed? I do not want to change my mouse scrolling speed altogether, as the speed at which I scroll webpages and notepad pages with the two-finger-scroll method is perfectly fine. It is only in the Notepad++ app, and then only when scrolling the open file tabs at the upper part of the screen.

    From the keyboard you can use Ctrl+Tab or Ctrl+Shift+Tab which will pull up the same thing that mouse right-click + mouse wheel brings up. Keep holding the Ctrl key and release the Tab key. While holding the Ctrl key down use the up/down arrow keys to scroll through the list. Using the keyboard may gives you a more fine grained control over the scrolling through the list than the mouse wheel. The mouse wheel also works for scrolling this list while the Ctrl key is being held down.

    For more about this please see https://npp-user-manual.org/docs/user-interface/#document-switcher

    FYI - the document switcher can be disabled via Preferences / MISC. / Document Switcher / Enable. If you try either the right click plus mouse wheel thing or Ctrl+Tab and “nothing happens” then check that the document switcher is enabled in preferences.

    To fix or change the specific issue @Ian brought up with mouse wheel sensitivity when in document switcher mode we would need to go through the Notepad++'s FAQ: Feature Request or Bug Report system.

  • Every time I start notepad++, the encoding of some files will be changed

    4
    0 Votes
    4 Posts
    975 Views
    CoisesC

    @Alan-Kilborn said in Every time I start notepad++, the encoding of some files will be changed:

    @Coises said in Every time I start notepad++, the encoding of some files will be changed:

    Apply to opened ANSI files

    My recollection of what this checkbox (when checkmarked) does is:

    if a file has no content (it’s 0 bytes on disk), open it as UTF-8 if a file’s entire content is “7-bit ASCII” (no bytes with highest bit set), open it as UTF-8

    This “recollection” was found in some notes I had.

    After doing my best to follow the code, I believe you are correct. The relevant routines appear to be:

    FileManager::setLoadedBufferEncodingAndEol
    and
    Utf8_16_Read::utf8_7bits_8bits

    which appear to come into play when there is no byte order mark and the file is not HTML or XML with a detected character set specification. First, utf8_7bits_8bits decides that if a file contains a null, it’s 8-bit ANSI; if it contains only bytes from 1-127, it’s 7 bit ANSI; otherwise, if it contains only character sequences that are legal UTF-8, it’s UTF-8; otherwise, it’s 8-bit ANSI. Then setLoadedBufferEncodingAndEol uses the New Document | UTF-8 | Apply to opened ANSI files to determine whether existing files that are empty or contain 7-bit ANSI should be opened as UTF-8.

    It looks like MISC | Autodetect character encoding tries to detect ANSI codepages that are not the default (corresponding to an Encoding | Character sets submenu selection, rather than Encoding | ANSI), but I haven’t attempted to follow that all the way through. I’m not sure where that fits into the sequence of decisions and how it interacts with the Apply to opened ANSI files setting.