• ALT+mouse selection change

    6
    0 Votes
    6 Posts
    794 Views
    CoisesC

    @DotUniverse said in ALT+mouse selection change:

    Current:
    Current version

    Previous (expected):
    alt text

    There was a change in behavior when pasting into a rectangular selection (including a zero-width selection) beginning with Notepad++ version 8.6.1.

    I’m guessing that you made a rectangular selection of Item1-Item3 in the first column, copied, then made an empty selection three lines deep where you wanted to paste them, and pasted.

    Previously, Notepad++ (using default Scintilla behavior) would have filled in the virtual space between the end of existing lines and the place where you indicated to paste. Notepad++ now treats the rectangular selection the same way as it would a multiple selection, and “collapses” the virtual space.

    If the lines you paste are of different lengths (so that the rectangular selection before you copy includes virtual space), you’ll wind up with a zero-width “rectangular” selection in which the carets do not line up. Switching to another tab and back will leave you with a rectangular selection that seems barely related to anything.

    See these GitHub issues:

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

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

    for some of the oddities encountered.

    The solution for users, for now, is that if you want the familiar behavior when pasting rectangular selections, do not paste into a rectangular selection; instead, just click at the top of the column where you want to paste. This operation still works the same as it always did, which is to insert the copied selection line by line into the document at the same column as the cursor.

    Pre-8.6.1, all pasting a copied rectangular selection into a rectangular selection did was to delete the contents of the rectangular selection, then paste as if there were an empty selection (i.e., just a caret) at the top of the deleted section. It did not matter how deep the selection was; it just deleted it and then inserted the new text (which could be fewer, the same or more lines than the deleted selection). The new behavior has so many oddities — if you are used to rectangular selections — that it’s easiest just to do the delete and reposition the cursor if you need to, then paste.

  • How to define a custom language

    8
    0 Votes
    8 Posts
    2k Views
    PeterJonesP

    I would like to define a language (or script) once and then have it activated automatically when I select the matching language, to avoid highlighting files that are not needed but also avoiding having to paste the script each time.

    That’s the way it works.

    why does it change the text font?

    It doesn’t. EnhanceAnyLexer only changes foreground color.

    I once reopened the ini and, yes, it contained my additions, but it had also restored things I had deleted

    I’ve never seen that happen.

    on one occasion the file I was trying to highlight came up as modified.

    EnhanceAnyLexer just changes colors; it does nothing with the text / contents in the highlighted file, so it does not edit the file. The plugin would not cause a file to “come up as modified”.

    how and when you apply the script what do you mean by NameOfUDL? can I associate the highlighting I define with a language?

    EnhanceAnyLexer works by hooking in to the activated lexer language, whether it’s one of the built-in languages, or one of the UserDefinedLanguages (UDL).

    So to make it work:

    Define a UDL for your language. You will give it a name: my example was NameOfUDL. Set the Language of the current file to NameOfUDL under normal circumstances, you could make Notepad++ do it automatically, based on file’s extension, in the UDL definition but you’ve indicated you want to turn this on or off at will (or to change it between one of three languages), instead of having it automatic based on extension EnhanceAnyLexer > Enhance Current Language this will allow you to set up the color / regex mappings for NameOfUDL while you are initially setting them up, you might see some weird things, like sometimes highlighting and sometimes not; it behaves differently while you’re actively editing EnhanceAnyLexer.ini than it does when you’re just using it you have to save it once you are done, otherwise your changes to EnhanceAnyLexer.ini will be lost; it’s a file, just like any other you only have to do this step once per Language once it’s saved, you can close the EnhanceAnyLexer.ini . If not all the enhancements show up in the active file, and it’s got NameOfUDL as the active language, you may have to switch to a different tab and back, or close and re-open the file to get EnhanceAnyLexer to take control.

    So, if you have three separate languages that you’ll want to apply for your use-case, you will need to create three different UDLs (User Defined Languages) – I’ll call them NameOfUDL1, NameOfUDL2, and NameOfUDL3. Then you will have to Enhance Current Language once for each of those (or do it once, and copy/paste into three different sections in EnhanceAnyLexer.ini, making sure to have the correct name of each section. Then the next time you activate one of NameOfUDL1, NameOfUDL2, or NameOfUDL3 for a given file, it will apply the enhancements defined for the chosen UDL.

    Here’s an example:

    file:

    T1| otherstrings something but not T1| otherstrings here

    Excerpt from Languages menu:
    30bc249b-ffcb-431a-89b4-0a2ece7025b9-image.png

    Excerpt from EnhanceAnyLexer.ini:

    [nameofudl1] # 0x0000FF = ^T\d(?=\|) 0x00CC00 = ^T\d\K\| [nameofudl2] # 0xC0C000 = ^T\d(?=\|) 0x00CC00 = ^T\d\K\| [nameofudl3] # 0xFF00FF = ^T\d(?=\|) 0x00CC00 = ^T\d\K\|

    For this simple example, they are highlighting the same regex, but with different colors, just so you can see it is applied. All I had to do to change which EnhanceAnyLexer config was active was change the selection in the Language menu.

    Here are screenshots with four different Language menu entries selected:

    Selected Language Screenshot Normal Text 6eb6571f-6b89-4703-bb01-c07b38a5c7d1-image.png NameOfUDL1 44d2548f-3e8d-4e87-83b8-519feb8e8298-image.png NameOfUDL2 1cb8c5e2-9de5-4204-8962-20090a30c492-image.png NameOfUDL3 f3d9c7ef-f4ac-4fba-a67c-6f0b2ee3e404-image.png
  • CTRL drag copy stopped working 8.6.1

    9
    1 Votes
    9 Posts
    2k Views
    BELLJOHNB

    @Coises
    This is a real solution once for all.
    Thank you so much Coises!

  • What is Notepad++ initialization file?

    3
    0 Votes
    3 Posts
    237 Views
    XianglanAnX

    @Mark-Olson
    Thank you. The file is more complex than I repeat to set up a new setting.

  • Can't install pluggin on Linux Ubuntu

    1
    0 Votes
    1 Posts
    173 Views
    No one has replied
  • Select a bunch of lines and delete them.

    3
    0 Votes
    3 Posts
    195 Views
    LordP666L

    @Alan-Kilborn

    Thanks so much. I’m a new user to Notepad++ and I’m starting to see why people love it so much.

  • NppExport is there a shortcut to use the copy all formats to clipboard?

    3
    0 Votes
    3 Posts
    324 Views
    A

    @PeterJones absolutely perfect, thank you so much :)

  • Not displaying accented characters in INI files

    3
    0 Votes
    3 Posts
    247 Views
    S

    @PeterJones said in Not displaying accented characters in INI files:

    Use DirectWrite s

    Thanks, that solved the problem.

    (BTW, there was an error in my OP: Replace “comma” → “equal sign”.)

  • import from filezilla

    2
    0 Votes
    2 Posts
    191 Views
    PeterJonesP

    @Afik-Gilboa ,

    I assume you are talking about the NppFTP plugin for Notepad++, because Notepad++ itself knows nothing about FTP.

    The NppFTP plugin uses a different underlying library and a different set of settings than does FileZilla, so it would be doubtful that there’s much configuration that it could copy over; but currently, as far as I know, there’s no way for any such import to occur.

    If you’d like that feature, you’d have to request it from the author of that plugin in that plugin’s issue list

  • delete an empty line after a specific text

    4
    0 Votes
    4 Posts
    295 Views
    CoisesC

    @tonymattina said in delete an empty line after a specific text:

    So there is something I still do not understand.

    It is possible that you are victim of a quirk.

    Regular expressions that use \K do not work properly if you try to replace them in Notepad++ one at a time; they only work when you use Replace All.

  • 0 Votes
    2 Posts
    238 Views
    mkupperM

    @mostlyhuman Try Settings / Preferences / MISC. and turn off Enable MRU Behaviour

    MRU Behaviour causes Notepad++ to remember the order that you visited the tabs. When you close the active tab it switched to the previous tab that you had visited. When MRU Behaviour is turned off then closing the active tab switches you to the next tab to the right or of you are ion the last tab it switches you to the tab that was to the left and is now the last tab.

    See https://npp-user-manual.org/docs/preferences/#misc
    and on https://npp-user-manual.org/docs/user-interface/ search the page for MRU to see more about this.

  • 0 Votes
    6 Posts
    404 Views
    guy038G

    Hello, @fabiospark, @coises, @Peterjones, @alan-kilborn and All,

    @coises, I suppose that the second and third regex S/R can be combined in a single one. So, first, we run :

    SEARCH (?-s).+

    REPLACE $0@\r\n$0

    Then, we execute :

    SEARCH (?-s).(?=.*@)|(@)

    REPLACE ?1:\x20

    An other possibility is to use the two successive regex S/R, below, which do not need any char to identify the lines to be filled with space characters :

    SEARCH (?-s).+\R

    REPLACE $0$0

    Then :

    SEARCH (?-s)(.)|\R.+\R

    REPLACE ?1\x20:$0

    If we suppose that we, first, select the blocks of lines needing modifications, here are the corresponding macros :

    <Macro name="Duplicate lines with Spaces" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-s).+" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="$0@\r\n$0" /> <Action type="3" message="1702" wParam="0" lParam="640" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-s).(?=.*@)|(@)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="?1:\x20" /> <Action type="3" message="1702" wParam="0" lParam="640" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro>

    Or :

    <Macro name="Duplicate lines with Spaces Version 2" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-s).+\R" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="$0$0" /> <Action type="3" message="1702" wParam="0" lParam="640" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(?-s)(.)|\R.+\R" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="?1\x20:$0" /> <Action type="3" message="1702" wParam="0" lParam="640" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro>

    Best Regards,

    guy038

  • Is there a way to automatically format differently odd and even lines?

    7
    0 Votes
    7 Posts
    319 Views
    F

    @PeterJones I didn’t even think it was possible to justa copy paste an image. Thx.

    In fact I’m using an online tab&chords sharing site that apply by itself that kind of formatting understanding if it’s a line of chords or of text, but for some things it’s a pain in the neck so, after having seen what NP++ can do with specific languages I hoped that there were some possibility to get the same thing here, so I would have more control.

    Anyway, thank you to you and to everybody for the time you spent listening and replying to me.

    Thank you
    fabio.

  • How can I replace multiple words in a file

    3
    0 Votes
    3 Posts
    244 Views
    PeterJonesP

    @ramakrishna ,

    As an alternative, in this post, I shared a script for the PythonScript plugin that allows you to define a list of “translations” – as many as you want. In that example, it was translating from an English term to a foreign language equivalent. However, you could fill out the translation table in the script to do your car => bus and flight => jet conversion.

  • Simple Function list but not working

    3
    0 Votes
    3 Posts
    226 Views
    S

    Thanks for your time on this, Peter.
    I have spent more time on this than it was worth and will shelve it until I get some more free time.

  • Find and Replace between {}

    6
    0 Votes
    6 Posts
    345 Views
    Mark OlsonM

    @guy038
    Without even testing it, I agree that (?:\{|(?!\A)\G)[^}]*?\K\. will not have the scaling issues, but it does not correctly handle the edge case of {. or any other document with { followed by . without the matching } afterwards.

  • Notepad++ crash on shutting down laptop

    5
    0 Votes
    5 Posts
    436 Views
    PeterJonesP

    @Carolyn38972 said in Notepad++ crash on shutting down laptop:

    i need also answer

    Do you need an answer, or are you fishing for upvotes so that you can start spamming?

    We do not tolerate bots or spammers here in this forum.

    If you really need an answer, you will come back and reply with details of your exact situation. If you do not, you will be banned, because this is your second post that looks very much like you are fishing for upvotes by replying to posts that are many years old without putting in any details. You have 24 hours before you are banned for sure; if you do another of these posts that looks like fishing-for-upvotes, you will be banned even if 24 hours has not elapsed. If I see that you log in again between now and the 24 hour time limit, without replying with details to prove you are a human who really wants help, you will be banned.

  • Pinning or locking specific tabs?

    5
    0 Votes
    5 Posts
    1k Views
    Alan KilbornA

    @Alan-Kilborn said in Pinning or locking specific tabs?:

    possibly implement a feature request to allow plugins to set/get tab colors

    The implementation is finished and should be in Notepad++ 8.6.8.
    After that version is released, I’ll finish up and publish the script to pin tabs.

  • 0 Votes
    2 Posts
    718 Views
    PeterJonesP

    @Ephraim-Daniel ,

    Interesting. Most of the time, what people want is Edit > Line Operations > Remove Duplicate Lines … but that gets rid of the lines completely, whereas you seem to want to delete the text but keep the empty lines.

    There are other ways to do it, but if I were doing it for me, I would break it into two steps:

    indicate the lines to be emptied using ☹
    FIND WHAT = (?-s)(?:^|\G)(.+)\R\K(?=\1)
    REPLACE WITH = ☹
    SEARCH MODE = Regular Expression
    REPLACE ALL empty any lines starting with ☹:
    FIND WHAT = (?-s)^☹.*$
    REPLACE WITH = empty/nothing
    SEARCH MODE = Regular Expression
    REPLACE ALL

    This works by matching the zero-width between a pair of duplicate lines, and replacing that with a frown; then replace any lines that start with a frown with an empty line (but keep the EOL sequence). Since the “lookahead” is used in the first regex, the cursor hasn’t moved forward, so it can match the current line just after the previous replacement as the “old” and again check the next line to see if it matches.

    Or you could do it all in “one” step, as long as you are willing to hit REPLACE ALL more than once:

    FIND WHAT = (?-s)(?:^|\G)(.+)\R(^$\R)*\K\1
    REPLACE WITH = empty/nothing
    SEARCH MODE = Regular Expression
    REPLACE ALL until there are no more matches and the status line in the Replace dialog says Replace All: 0 occurrences were replaced in entire file

    This works by looking for a line, and any empty lines, followed by the same line again, matching the second occurrence of the line, and replacing it with nothing. But because this one replaced the second non-empty line with nothing, it loses the “memory” of the first line, and thus it won’t be able to match another immediate instance of that same first line. However, if you run it a few times, it will eventually catch them all.

    Both of these procedures assume that the data is in the order you suggest, where all the repeats are right in a row… if your data had 1:1 then 1:2 then 1:1 again, it would not find the second 1:1 as a duplicate.
     
    ----

    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
  • DSpellcheck

    7
    0 Votes
    7 Posts
    644 Views
    Sylvester BullittS

    @PeterJones Ok, sorry. I missed that one.

    Guess I need new glasses. Oops—I forgot: I don’t have glasses since my cataract surgery. Maybe I should have them re-install the cataracts! 8=)