Community
    • Login

    Using EOL Windows Mode, pressing enter at end of line only puts a CR with no LF

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 5 Posters 966 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.
    • Chris ZimmerC
      Chris Zimmer
      last edited by

      Like the title says. I go to the end of line and press return. NP++ is set to use Windows EOL, CRLF. Only a CR is put there without the LF. I found this problem because my compiler does not handle this case and must always have the CRLF to parse the file properly. Has anyone seen this?
      Thank you!

      Alan KilbornA mkupperM 2 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Chris Zimmer
        last edited by

        @Chris-Zimmer

        I would start by checking the Shortcut mapper (see Settings menu) for the SCI_NEWLINE command. Normally it is set to Enter and Shift+Enter but with some experimentation I found that if the Enter (without Shift) is removed, that when you press Enter when editing a Windows file you will indeed only get a CR and no LF inserted in your doc.

        1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn
          last edited by

          This is where you would look to check your setup for this:

          c7dab521-addf-4099-8043-a2e4ad5fa1b7-image.png

          Note that after I deleted Enter (without Shift) to test what would happen, I found that there was no easy way to put it back in! I was doing this in a “throwaway” version of Notepad++, so no harm no foul for me. I do recall the inability to add Enter in such a way coming up before a long time ago, so maybe some crafty searching of old postings will turn up how to achieve this (probably a manual editing of shortcuts.xml is required).

          But…@Chris-Zimmer , we need to verify if this is your problem as well before going too far down the road.

          Paul StrugnellP 1 Reply Last reply Reply Quote 2
          • Paul StrugnellP
            Paul Strugnell @Alan Kilborn
            last edited by Paul Strugnell

            I have the same problem. Originally, I was getting annoyed at the auto-complete feature inserting a predicted word when I pressed Enter, when what I wanted was a newline. So I went to the Scintilla commands page and removed the binding for the Enter key. Then four months later I discovered that all the documents I’d been editing were full of CR instead of CRLF!

            I have tried making the change in shortcuts.xml (removing the ScintillaKeys element and replacing it with an empty one <ScintillaKeys />) as suggested on other sites such as stackoverflow, but it has no effect. Is there anything else I can do to reset this? If it can be turned off by configuration, I’d be surprised if there wasn’t something I could change in a config file or the registry to revert the change. Otherwise, how is the app itself able to remember that the setting is screwed up?

            If reinstalling is the only way to resolve the issue, is it possible to do this while keeping my session? I have a lot of documents open from many different folders and would rather not have to find and open them all again.

            Thanks in advance for any help.

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Paul Strugnell
              last edited by

              @Paul-Strugnell said in Using EOL Windows Mode, pressing enter at end of line only puts a CR with no LF:

              Originally, I was getting annoyed at the auto-complete feature inserting a predicted word when I pressed Enter, when what I wanted was a newline. So I went to the Scintilla commands page and removed the binding for the Enter key.

              That was the wrong solution. Settings > Preferences > Auto-Completion has an Auto-Completion section with Insert Selection choices, where you can decide whether just Tab, just Enter, or both will choose your Auto-completion option. All you had to do was uncheckmark the box next to Enter. (That new option was added in v8.2.1, as described in the User Manual at Preferences > Auto-Completion > Auto-Completion > Insert Selection.)

              Then four months later I discovered that all the documents I’d been editing were full of CR instead of CRLF!

              Whoops.

              as suggested on other sites such as stackoverflow

              I wonder why you’d go to stackoverflow, before trying the links from Notepad++'s ? menu to the Notepad++ Online User Manual (which links to the same User Manual that I’ve linked to throughout my reply) and to the Notepad++ Community (Forum) (here). And if they were giving advice to modify a configuration file without also linking you to the User Manual, they were giving you dangerous advice – you should always read and understand a User Manual’s description of the config files before blindly following advice you read on random locations on the internet.

              I have tried making the change in shortcuts.xml (removing the ScintillaKeys element and replacing it with an empty one <ScintillaKeys />) … , but it has no effect.

              It would have, if you did things in the right order, assuming you edited the shortcuts.xml in the right location.

              In a normal installation, as described in the User Manal in the Config Files Location, a normal installation stores your active shortcuts.xml in %AppData%\Notepad++\shortcuts.xml (🛈). If you have a non-standard installation, read that section of the User Manual to figure out where your active shortcuts.xml will be. (If you edited the C:\Program Files\Notepad++\shortcuts.xml on a normal installation, then the one in %AppData% would take precedence, and you wouldn’t have noticed any change in behavior. I am guessing this is what you did.)

              To be able to edit that file , as described in Editing Configuration Files, you need to exit all instances of Notepad++, open a single instance to edit the right shortcuts.xml (as described in the last paragraph), make the change and save, then exit Notepad++ and run it again for the change to take effect.

              Specifically, if you were in the state described (where Enter doesn’t work but Shift+Enter does), with no other changes in the Scintilla commands section of the GUI, you will see

                  <ScintillaKeys>
                      <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="13" />
                  </ScintillaKeys>
              

              If you had other changes in the Shortcut Mapper, you might see more <ScintKey... entries.

              There are a few different edits you could do, to make Enter work normally again.

              1. If there were no other changes to the Scintilla commands section in the GUI, then you could return the <ScintillaKeys>... section to its default:

                    <ScintillaKeys/>
                
              2. Alternately (or if there are any other keys), just delete the <ScintKey ScintID="2329"...> entry.

                    <ScintillaKeys>
                    </ScintillaKeys>
                

                or

                    <ScintillaKeys>
                        <ScintKey ScintID="####" ... /> <!-- other non-2329 entires might be inside here -->
                    </ScintillaKeys>
                
              3. You could manually add in the extra keystroke as a NextKey inside the ScintKey:

                    <ScintillaKeys>
                        <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="13">
                            <NextKey Ctrl="no" Alt="no" Shift="no" Key="13" />
                        </ScintKey>
                    </ScintillaKeys>
                

                or if you wanted it back in the same order it originally was:

                    <ScintillaKeys>
                        <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="no" Key="13">
                            <NextKey Ctrl="no" Alt="no" Shift="yes" Key="13" />
                        </ScintKey>
                    </ScintillaKeys>
                

              Is there anything else I can do to reset this?

              I would have thought the Shortcut Mapper in the GUI could do it… but apparently, though you can remove it there, you cannot add Enter without any modifiers. Weird.

              You can add a different keystroke, like Ctrl+Shift+Enter using the shortcut mapper. Notepad++ treats Enter, without modifiers, differently.

              If it can be turned off by configuration,

              it can

              I’d be surprised if there wasn’t something I could change in a config file

              You can.

              or the registry

              Notepad++ doesn’t use the registry for storing settings.

              Otherwise, how is the app itself able to remember that the setting is screwed up?

              In the config file.

              If reinstalling is the only way to resolve the issue,

              It’s not.

              is it possible to do this while keeping my session? I have a lot of documents open from many different folders and would rather not have to find and open them all again.

              Yes, as long as you didn’t remove the session.xml from your %AppData%\Notepad++\ directory, then yes.

              And, by the way, just “reinstalling” wouldn’t have “fixed” the problem for you, because when you install Notepad++, it normally doesn’t overwrite any of the config files in %AppData%\Notepad++\, because it does its best to not delete any of your customizations; as a result, re-installing without manually deleting %AppData%\Notepad++\ first would accomplish nothing.

              PeterJonesP 1 Reply Last reply Reply Quote 3
              • PeterJonesP
                PeterJones @PeterJones
                last edited by

                @Alan-Kilborn said 5 years ago,

                after I deleted Enter (without Shift) to test what would happen, I found that there was no easy way to put it back in!

                and in my recent reply, I said,

                I would have thought the Shortcut Mapper in the GUI could do it… but apparently, though you can remove it there, you cannot add Enter without any modifiers

                In issue #4171, the Developer claimed that it was intentional to not be able to assign keystrokes to Shift+Enter and similar.

                However, given that the shortcut is in the Shortcut Mapper by default, and can be removed there, I have asked again in #15562 that the Developer consider allowing it, for the purpose of being able to undo a change that was made in the GUI. We’ll see if anything ever comes of it.

                1 Reply Last reply Reply Quote 2
                • mkupperM
                  mkupper @Chris Zimmer
                  last edited by

                  @Chris-Zimmer What’s on the right side of your Notepad++ status line? Is it Windows (CR LF) or something else?

                  npp-status-line-2.png

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @mkupper
                    last edited by PeterJones

                    @mkupper said in Using EOL Windows Mode, pressing enter at end of line only puts a CR with no LF:

                    @Chris-Zimmer What’s on the right side of your Notepad++ status line? Is it Windows (CR LF) or something else?

                    You might want to check the dates. The user you @-mentioned asked the question in January 2020. Either Alan’s reply was helpful, or they’ve moved on to something else in the 4.5 years since asking about it. :-)

                    Further, the title they assigned, “Using EOL Windows Mode, pressing enter at end of line only puts a CR with no LF” seems pretty explicit that the status bar would indicate Windows (CR LF).

                    Both the original poster and the recent re-vivifier appear to have been dealing with a known (but often forgotten) “feature” of Notepad++, that if you remove the Enter shortcut from SCI_NEWLINE, that the ENTER key just inserts the CR, regardless of the newline settings (because it’s SCI_NEWLINE, not the ENTER key itself, that handles the per-setting newline insertion).

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