• Non-Standard Behavior of Save-As Dialog

    6
    1 Votes
    6 Posts
    909 Views
    EkopalypseE

    @HillbillyDNA

    :-) LOL and you are responsible making me laugh - so we both are lucky :-)
    Btw. Fat, is that this what my wife calls rescue rings and looking at me? :-D

  • add a prefix to a each string in a column

    4
    0 Votes
    4 Posts
    3k Views
    guy038G

    Hi, @yascha-badenhop, and All,

    OK, I get the problem ! I’ll try to describe my different steps in order to reach the right solution. If you’re in a hurry, just skip this section ;-))

    Firstly, I tried to imagine the way to access to the 15th column, with the | separator

    A column is composed of some standard characters, different from |, followed with the | separator which can be regex-translated as [^|\r\n]+\|. Indeed [^|\r\n] represents any char different from | and from any EOL character, repeated many times ( + ) and followed with a literal pipe character \| ( must be escaped because it’s a meta-regex character )

    To get the 15th column we need to count the first 14 columns, from beginning of line, so the regex ^(?:[^|\r\n]+\|){14}. Note that I’m using a non-capturing group (?:........) group as we do not care about the contents of these different columns and we don’t need to store them, for further recall !

    Then we place the \K regex feature which resets the regex engine search and locate the working position right after the | separator of the 14th column

    Secondly, I considered the contents of the 15th column :

    Seemingly, it contents several words, each of them preceded with a space char ( from your second post, we learn that these may be either R10 , C10, vdr10 or xtal10 ) However, I preferred to suppose that the first word of the 15th column could directly follow the | separator.

    So, for the moment, the search regex is ^(?:[^|\r\n]+\|){14}\K\x20*\w+, as \x20* stands for any range of space chars, even none and \w+ a non-null list of word characters. But, as we must insert the A_ string between the possible blank character(s) and the subsequent word, I enclosed them between parentheses, which define two groups 1 and 2 ( as, you remember, the very first group is a non-capturing one ) giving the regex ^(?:[^|\r\n]+\|){14}\K(\x20*)(\w+)

    Thirdly, I thought about the way of matching the second and subsequent words of the 15th column :

    I first thought about to add an alternative ( | ) to the search regex and search for an other word, preceded with space character(s), also enclosed for parentheses as we need the contents for replacement => the regex ^(?:[^|\r\n]+\|){14}\K(\x20*)(\w+)|(\x20+)(\w+). However, this does not work as, when the present working location, of the regex engine, is after the 15th column, and that your text contains other columns, the second alternative, of the search regex, would match any subsequent words ! Not what we want, obviously !

    The solution is to use the \G feature which needs that the next regex match begins at the exact location where the previous match ends. So, when all the blocks “space(s) + word” ( \x20+\w+ ) of the 15th column will be matched, the process will stop. Indeed, the first word of the 16th column is not closed to the last word of the 15th column because of the | separator and breaks the \G condition !

    Finally a solution for the search regex could be :

    SEARCH ^(?:[^|\r\n]+\|){14}\K(\x20*)(\w+)|\G(\x20+)(\w+)

    Fourthly, I built the replacement regex :

    Note that groups 1 and 2 store the first space character(s) and word characters of the 15th column

    Groups 3 and 4 store the second and subsequent space character(s) and word characters of the 15th column

    So, the use conditional replacement (?#........) is needed and gives the replacement regex (?2\1A_\2)(?4\3A_\4). This means that :

    If group 2 exists, we rewrite the space(s) characters first ( \1), followed with the string A_, and, finally, the word characters ( \2 )

    If group 4 exists, we rewrite the space(s) characters first ( \3), followed with the string A_, and, finally, the word characters ( \4 )

    After a while I realized that these two cases are mutually exclusive. And, as a non defined group n, noted \n in replacement, is supposed to be an empty group, with the Boost regex engine, I finally got the final replacement regex : \1\3A_\2\4

    So, @yascha-badenhop, the final regex S/R, to solve your problem, is :

    SEARCH ^(?:[^|\r\n]+\|){14}\K(\x20*)(\w+)|\G(\x20+)(\w+)

    REPLACE \1\3A_\2\4

    To test it, I considered the 2 colums sample text,  R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10|, with various ranges of space chars before the words. this range is then repeated 9 times, giving 18 columns, in totality :

    R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10|

    Now :

    Open the Replace dialog ( Ctrl + H )

    Type in the regex ^(?:[^|\r\n]+\|){14}\K(\x20*)(\w+)|\G(\x20+)(\w+), in the Find what: zone

    Type in the regex \1\3A_\2\4 in the Replace with: zone

    Preferably, tick the Wrap around option

    Choose the Regular expression search mode

    Click once on the Replace All button, exclusively ( Because of the \K syntax, you must not use the Replace button ! )

    You should get your expected text :

    R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10| A_R10 A_C10 A_vdr10 A_xtal10|xtal10 vdr10 C10 R10| R10 C10 vdr10 xtal10|xtal10 vdr10 C10 R10|

    If you want to be more restrictive and match the exact words, that you spoke of in your second post, we just have to change the regex \w+ into the non-capturing group,followed with 10, so (?:xtal|vdr|R|C)10, giving the final regex S/R :

    SEARCH ^(?:[^|\r\n]+\|){14}\K(\x20*)((?:xtal|vdr|R|C)10)|\G(\x20+)((?:xtal|vdr|R|C)10)

    REPLACE \1\3A_\2\4

    This second solution is even better, as it prevents a second unwanted execution of the regex S/R, leading, for instance, to a 15th column like | A_A_IC10 A_A_IC9

    Best Regards,

    guy038

  • 0 Votes
    1 Posts
    315 Views
    No one has replied
  • 1 Votes
    5 Posts
    2k Views
    Scott WilksS

    That is much better, wish I had known that sooner! Thank you for the examples!

  • Block-Commands:

    5
    2 Votes
    5 Posts
    8k Views
    Nic H. MuellerN

    Thanks for your help.

  • can't use thinkpad keyboard trackpoint

    5
    0 Votes
    5 Posts
    948 Views
    damian XUD

    @Ekopalypse Actually I had a laptop ThinkPad R61 which run well with n++, win7 pro, so …
    but it’s very kind of you, considering.

  • How do I replace characters in the middle of a string?

    Locked
    2
    0 Votes
    2 Posts
    709 Views
    Adam YikA

    Solved, realized how the brackets work, the solution is this: [_].*?[.]. Sorry!

  • Bug? Default code-page forgotten

    Locked
    3
    0 Votes
    3 Posts
    709 Views
    andrecool-68A

    @Michał-Łętowski
    Test the revised temporary version:
    https://notepad-plus-plus.org/temp/cyrillacPb/
    Release soon)))

  • 1 Votes
    17 Posts
    4k Views
    niente0N

    Same here, my ASP scripts aren’t highlighted anymore since v7.7.
    I can confirm it works with Notepad++ 7.6.6, I downgraded until bug is fixed.

  • When changing encodings . . .

    Locked
    7
    0 Votes
    7 Posts
    951 Views
    Brigham NarinsB

    @Meta-Chuh said:

    @Brigham-Narins

    yes, you are absolutely correct.

    i retested this with files with longer lines, and can reproduce this now, if word wrap is enabled, but not always.
    and it seems to depend on where the cursor is placed within the document, as well as the position where it scrolls to, seems to depend on the current size of the editor window.

    Exactly

    i’ve also tested the same on the scintilla demo editor scite 4.1.5 and it behaves the same, when using word wrap, a similar viewing size and the same document.

    Interesting

    i didn’t have time though, to look if anyone has already posted this behaviour at the scintilla feature request or issue tracker, and i don’t know if this is something that would be worked on if filed.

    many thanks and best regards.

    Well, thanks for your help. I really appreciate it.

  • File>Open always presents an unchangeable full screen

    3
    1 Votes
    3 Posts
    1k Views
    aaeneasA

    That seems to have fixed it. It looks like the only problem may have been my need for a lesson on how to use Windows. Many thanks!!!

  • Type German umlauts easily

    4
    0 Votes
    4 Posts
    2k Views
    Memo RandomM

    If you need a variety of accented characters, you could insert an ASCII chart in a new file, then copy/paste the needed characters.

    To do this, install the TextFX Character plugin. Then, from the TextFX menu heading, go to Tools -> Insert ASCII Chart or Character. You may need to change the encoding (via “Encoding” menu) to ANSI to have the characters display correctly.

  • 4 Votes
    12 Posts
    9k Views
    PeterJonesP

    @ArTruong said:

    Please help me how to open folder as Workspace when use folder path as parameter in command line?

    As of right now, AFAICT, that feature doesn’t exist yet. Sorry. (Notice the phrasing on the option you picked: “… on folder dropping” – since the command line is not “folder dropping”, the option doesn’t influence command-line opening.)

    Issue #4253 was submitted last year, and someone even made pull request #5100 to add a command-line option, but that hasn’t been incorporated into the main codebase. You might want to go add upvotes to those. (I just upvoted those.)

  • Auto-recovery of saved and unsaved files not working

    Locked
    7
    0 Votes
    7 Posts
    2k Views
    pnedevP

    @Mike-Collins said:

    My version is V7.6.6 (32 bit)

    Ou, I came to the impression that you started having these issues after updating to Notepad++ v7.7.
    Then my assumption is wrong.
    Anyway, it is worth trying without any plugins, just in case.

    BR

  • Forum: why not allow editing and posting in less than 20 minutes

    Locked
    2
    0 Votes
    2 Posts
    488 Views
    Meta ChuhM

    @Memo-Random

    many thanks for your questions.

    Why can’t we edit posts that we created?

    we don’t want to break any context once it is written.
    the goal is to never write anything you will regret, as it will remain posted for “eternity”.
    if it happens to you one day, you might be able to look at it again after a few years with one eye embarrassed, and the other eye smiling, just like we do 😉

    What if we need to correct something?

    the goal for us is, to get better re-reading our own posts, before hitting submit.
    there’s never any hurry.

    Why do we have to wait 1200 seconds before posting another message?

    because highly frequented, large scale forums, like ours, get spammed a lot, so all new members will have this restriction.
    without this feature, we would have to spend weeks cleaning up bot postings.
    but if you stay around and gather reputation by helping others, you will not have this limit anymore.

    many thanks for your understanding and best regards.

  • Bookmarks not saving

    17
    0 Votes
    17 Posts
    3k Views
    Memo RandomM

    Correction: the above numbers were “length” counts, not line counts. There may be some correspondence between file size and losing bookmarks, but it isn’t a straightforward cause-and-effect.

  • How To Delete Specific String In Macro Recorder

    Locked
    6
    1 Votes
    6 Posts
    1k Views
    Alan KilbornA

    @Anthony-Jocius

    Amazing…

    Check out this link and the things it links to in order to really understand the magic. :)

  • N++v7.7 Misspelled words not underlined/highlighted

    14
    0 Votes
    14 Posts
    3k Views
    PredelnikP

    I’ve released the version with the fix for N++ 7.7
    https://github.com/Predelnik/DSpellCheck/releases/tag/v1.4.13

  • Find and Add To Selection In 7.7

    37
    0 Votes
    37 Posts
    10k Views
    AndreCunhaA

    Besides enabling Multi-Editing (as explained by @Alan-Kilborn in his comment), I just had to call the functions directly, just like Scintilla documentation specifies:

    SCI_MULTIPLESELECTADDNEXT adds the next occurrence of the main selection within the target to the set of selections as main. If the current selection is empty then select word around caret.

    SCI_MULTIPLESELECTADDEACH is similar to SCI_MULTIPLESELECTADDNEXT but adds multiple occurrences instead of just one.

    For me, it was unnecessary to call SCI_TARGETWHOLEDOCUMENT, so, for selecting all instances of the word at once, you could just call SCI_MULTIPLESELECTADDNEXT followed by SCI_MULTIPLESELECTADDEACH:

    // selects all instances of the selected word (or the word around the caret) sci_sendmsg 2688 // SCI_MULTIPLESELECTADDNEXT sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH

    …which has the same effect of simply calling SCI_MULTIPLESELECTADDEACH twice:

    // selects all instances of the selected word (or the word around the caret) sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH

    Or, instead of blindly calling it twice, you could check if something is already selected with SCI_GETSELECTIONEMPTY (as used on other comments) and then call it only once:

    // selects all instances of the selected word (or the word around the caret) sci_sendmsg SCI_GETSELECTIONEMPTY if $(MSG_RESULT) == 1 then sci_sendmsg 2688 // SCI_MULTIPLESELECTADDNEXT endif sci_sendmsg 2689 // SCI_MULTIPLESELECTADDEACH

    PS: It would be really nice to have both commands (SCI_MULTIPLESELECTADDNEXT and SCI_MULTIPLESELECTADDEACH) available for hotkeys in “Settings” > “Shortcut Mapper” > “Scintilla commands”.

  • tab navigation enhancement

    Locked
    8
    0 Votes
    8 Posts
    1k Views
    Smart Cat Collar ProjectS

    It’s really an enhancement ! Thanks for the precisions, too.