Using EOL Windows Mode, pressing enter at end of line only puts a CR with no LF
-
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! -
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.
-
This is where you would look to check your setup for this:
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.
-
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.
-
@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 activeshortcuts.xml
will be. (If you edited theC:\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 butShift+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.
-
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/>
-
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>
-
You could manually add in the extra keystroke as a
NextKey
inside theScintKey
:<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++ treatsEnter
, 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. -
-
@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 modifiersIn 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.
-
@Chris-Zimmer What’s on the right side of your Notepad++ status line? Is it
Windows (CR LF)
or something else? -
@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 fromSCI_NEWLINE
, that the ENTER key just inserts the CR, regardless of the newline settings (because it’sSCI_NEWLINE
, not the ENTER key itself, that handles the per-setting newline insertion).