• Login
Community
  • Login

How to disable duplicate line?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 5 Posters 316 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    jabcreations
    last edited by Jan 24, 2025, 6:42 PM

    Occasionally there is an error in my code because somehow I’m duplicating a line without realizing it. I’ve gone looking through the Settings menu 🡺 Shortcut Mapper… and used the filter to look for the word duplicate and found nothing. I’ve also searched here on the forums, Duck Duck Go and Google and they all give me non-related results. I have version 8.7.5 installed.

    M 2 Replies Last reply Jan 24, 2025, 7:35 PM Reply Quote 0
    • M
      Mark Olson
      last edited by Mark Olson Jan 24, 2025, 7:03 PM Jan 24, 2025, 6:57 PM

      From the main menu, Edit->Line Operations->Remove Consecutive Duplicate Lines and Edit->Line Operations->Remove Duplicate Lines. Documentation here.

      FWIW, these commands may not do what you want, because they will delete ALL duplicate lines, and you may well have lines that are supposed to be duplicated (for example, close curly braces denoting the end of a code block). If you wanted to find duplicate lines, that is a job for regular expressions.

      J 1 Reply Last reply Jan 24, 2025, 9:04 PM Reply Quote 1
      • M
        mkupper @jabcreations
        last edited by Jan 24, 2025, 7:35 PM

        @jabcreations Do you mean the Ctrl+D keyboard shortcut which normally maps to Edit / Line Operations / Duplicate Current Line?

        It’s in the shortcut mapper in the Scintilla commands tab and is SCI_SELECTIONDUPLICATE

        When filtering is used in the shortcut mapper it only shows you matches in the current tab. If you were seeking something such as the the word duplicate then you need to flip though the tabs, one at a time, within the shortcut mapper.

        Apparently, because it’s a Scintilla shortcut, the Ctrl-D shortcut does not show as a hint when you look at Edit / Line operations in the menus. It also does not show up in the shortcut mapper when you look in the main menu section. That seems like a bug to me but hopefully someone else will chime in with an explanation of the logic behind that.

        J 1 Reply Last reply Jan 24, 2025, 9:06 PM Reply Quote 2
        • J
          jabcreations @Mark Olson
          last edited by Jan 24, 2025, 9:04 PM

          @Mark-Olson No.

          The very title of this thread is how to disable duplicate lines not remove duplicate lines. I was exceptionally clear about disabling the keyboard shortcut.

          1 Reply Last reply Reply Quote 0
          • J
            jabcreations @mkupper
            last edited by Jan 24, 2025, 9:06 PM

            @mkupper

            I searched each tab one-at-a-time originally as you suggested in reply.

            The SCI_SELECTIONDUPLICATE setting does exist and none of the keyboard options are set/checked however it clearly was still happening.

            A 1 Reply Last reply Jan 25, 2025, 1:11 AM Reply Quote 0
            • G
              guy038
              last edited by guy038 Jan 24, 2025, 9:20 PM Jan 24, 2025, 9:19 PM

              Hello, @jabcreations, @mark-olson, @mkupper and All,

              • You must first run Settings > Shortcut Mapper... >

              • Then, select the Scintilla Command tab

              • And, finally, filter, for example, by the word selection

              a1ec021d-6143-4949-b2a1-022f38ce649c-image.png

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 1
              • A
                Alan Kilborn @jabcreations
                last edited by Jan 25, 2025, 1:11 AM

                @jabcreations

                Can you post your Debug Info here?

                J 1 Reply Last reply Feb 6, 2025, 3:13 AM Reply Quote 1
                • M
                  mkupper @jabcreations
                  last edited by mkupper Jan 25, 2025, 10:05 PM Jan 25, 2025, 10:05 PM

                  @jabcreations Besides the debug info that @Alan-Kilborn asked for I’m wondering about a couple of things:

                  By “disable duplicate line?” are you asking how to disable or remove the keyboard shortcut for duplicating lines or are you asking about how to make Edit / Line Operations / Duplicate Current Line disappear from the menu structure?

                  I assume that since it’s happening accidentally that you are asking about finding and getting rid of the keyboard shortcut.

                  What happens when you do Ctrl+D which is the default keyboard sequence mapped to duplicate line?

                  • Specifically, open any file in Notepad++.

                  • Make sure the icon in the left side of the tab for the current file is normal and not the red that happens when there are unsaved changes.

                  • Do Ctrl+D

                  • If the icon did not change to red then we know that Ctrl+D is mapped to do something that does not make changes to the file and that we still don’t know why you are seeing duplicated lines at times. Don’t bother with the steps below but instead, let us know that Ctrl+D seemed to do nothing at all.

                  • If the tab icon changed red then it’s a clue that Ctrl+D made some change to the file and we now need to figure out what happened.

                  • Did Ctrl+D duplicate the current line or did it seem to do nothing? If you are working with a 100% blank file it may be hard to detect line duplication and so I’d type some stuff and then do a Ctrl+D again to see if the stuff is duplicated.

                  • Did Ctrl+D turn the icon red but seemed to do nothing even though you did Ctrl+D on a line with stuff on it? I would enable View / Show Symbol / Show Control Characters & Unicode EOL. If that was turned off then you are probably now looking at the letters EOT in white with a black background. That means the Ctrl+D is not mapped to anything and that you are adding an EOT character to the file each time you type Ctrl+D.

                  None of this will tell us exactly why lines are getting duplicated but will hopefully point the way to discovering why.

                  J 1 Reply Last reply Feb 6, 2025, 3:15 AM Reply Quote 1
                  • J
                    jabcreations @Alan Kilborn
                    last edited by Feb 6, 2025, 3:13 AM

                    @Alan-Kilborn

                    Notepad++ v8.7.5 (64-bit)
                    Build time : Dec 21 2024 - 05:13:03
                    Path : C:\MEDIA\OFFICE\Notepad++\notepad++.exe
                    Command Line : “D:\My Documents\Desktop\Tasks\Hack Attack Stuff\Attack Log.txt”
                    Admin mode : ON
                    Local Conf mode : OFF
                    Cloud Config : OFF
                    Periodic Backup : ON
                    Placeholders : OFF
                    DirectWrite : OFF
                    Multi-instance Mode : monoInst
                    File Status Auto-Detection : cdEnabledNew (for current file/tab only)
                    Dark Mode : OFF
                    OS Name : Windows 10 Pro (64-bit)
                    OS Version : 22H2
                    OS Build : 19045.3930
                    Current ANSI codepage : 1252
                    Plugins :
                    DSpellCheck (1.5)
                    mimeTools (3.1)
                    NppConverter (4.6)
                    NppExport (0.4)
                    _CustomizeToolbar (5.3)

                    1 Reply Last reply Reply Quote 0
                    • J
                      jabcreations @mkupper
                      last edited by jabcreations Feb 6, 2025, 3:16 AM Feb 6, 2025, 3:15 AM

                      @mkupper So I’m explicitly pressing Control+D and it’s no longer duplicating lines. This tab got buried though in the time since I do not recall having to remove a duplicated line. So the earlier mentioned directions seem to have worked. Thanks!

                      @guy038 Thanks Guy, that worked!

                      1 Reply Last reply Reply Quote 1
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors