Disaster has Struck... Please Help Me..!
I’m not an expert with Notepad++ (v. 6.7.9), but I’ve been using it for an extremely important document, and now… disaster has struck.
The LF (Line Feed) characters were appearing with increasing regularity, so I went on a quest to see if there was a way to get rid of them. I had the bad luck to come across this page:
The common solutions for my original problem are to unpress the “Show All Characters” icon – mine was not pressed – and to replace " /n" with “blank” in the Find/Replace box. None of that worked.
So in desperation, I followed the next bit of advice, which was:
In the Notepad++ menubar click Edit -> EOF Conversion -> Old Mac format to format for entire files.
When I did so, the program froze for a bit, and then the formatting for the entire document got WRECKED.
It’s like everything got shifted to the right, although this does not quite explain the situation either, because some lines are beginning the way they should be. Anyway, an example, as far as the left margin:
**, MY OWN MENTION OF ROS
A RETURNING FROM VACATION, EPISODE
FOREVER BEING PULLED … PRO
I tried un-depressing the “Word Wrap” icon, and looked through “Preferences” to see if there was something there… I’m stuck.
What do I do to get this back to normal?
Please help me…
Oh… too bad we can’t edit our posts, here. I discovered an error of mine. On that site, the instruction I followed was this:
Click Edit -> EOL Conversion -> Windows Format (This will append replace LF with CRLF)
(And not, as I’ve written above, this:
In the Notepad++ menubar click Edit -> EOF Conversion -> Old Mac format)
I have Windows 7, by the way. I have also tried (after clicking on “Undo” once the disaster struck) to save the file and re-open it… the disastrous changes were stuck. I also tried to copy the document to Wordpad (in hopes of copying back to a new document in Notepad++), but the formatting was retained.
Replace all “[\n\r]+” (without quotes) with nothing using “Regular expression” and “Wrap around” enabled. You’ll have to add back the proper newlines and spaces yourself.
Dear Cees, I am very grateful to you for reaching out to me, and I am also bowled over by your great knowledge.
What you have revealed is probably going to be the best solution. It’s an unworkable one, unfortunately, because my document is very big, and it would take three weeks of editing to get it back to what it was.
A bitter lesson that there are times Notepad++ has a mind of its own, and how important it is to save one’s document at frequent intervals… like Microsoft Word does.
I am aware Notepad++ has an Auto-Save plug-in (actually two), but I have not been able to make it work. Perhaps you (or another) will be kind enough to shed light on it for me.
I see in Plugins > AutoSave > AutoSave Options, under “Named Files,” we have (after “Ignore/do nothing”), the default setting (it’s checked) of “Overwrite existing file,” and “Save autorecover in the same directory.” It seems to me “Save autorecover in the same directory” provides the most control (because let’s say this disaster that I have to deal with takes place and the existing file is overwritten and saved. That’s no good). What do you recommend? If you think the last choice is the best, then would it be a simple matter of going to the same directory and opening that file up? (Does the file open by simply double-clicking on it?)
I’d appreciate your wisdom and advice.
Ah !. Again, the same advice : ALWAYS back-up your IMPORTANT documents, preferably, on a different media, as an external HD or a USB key !!!
In the next future, I’ll look into the native back-up possibilities of Notepad++ and the different available plugins, about back-up. Then, I’ll try to create and post a summary, on that matter.
But, in the meanwhile, if you don’t mind and if your file does not contain confidential information, could you send me this file, or part of it, to my e-mail address, below :
I’ll see if something can be done
I just hope that the size of your corrupted file is not too big, in order to be attached to your e-mail :-)
BTW, I would totally understand if you do not accept my suggestion, for any reason !
Guy038, you sound fantastic. Thank you so much for responding… and, by God, look at you offering to go the extra mile by asking for a copy of the document to really pinpoint the problem.
After I took Cees Timmerman's kind advice and wound up with the whole document in one gigantic line (as what sometimes happens with basic Notepad, which ignores all formatting once you copy and paste into it), I closed the file, thinking I would get a message to save or cancel. I did not get the message!! (Notepad++ can be so tricky.) What I needed to do, to play it safe, was to click “Undo” before closing the file, but I was so sure I would get the save/cancel box first. So the document became worthless, and I deleted it.
Naturally, this document was critical so I would not have deleted it if I hadn’t taken prior steps. My back-up program actually provided an older copy, but it was ten days old, and I could not have edited that without a stay at an insane asylum. What saved my life was this page, which gave the bright idea that right-clicking on the file gave a “restore previous versions” option… so I have salvaged a version from 2 days before the disaster. That entailed only a few hours of editing.
Regardless, I am fascinated that you actually had hopes to return the corrupted file back to normal. You must be a genius.
While trying to get to the bottom of the problem, I ran into much advice suggesting variations of /n & /r placed into the “Find and Replace” box, but nothing made a dent. It was only Cees Timmerman’s “[\n\r]+” combination that produced an effect.
I’m not expecting a Notepad++ primer here, but now I’ve become curious… what does \n and \r MEAN? (Maybe in one sentence, to give a rough idea…)
I see when I’m typing in Notepad++ now, what is happening sometimes is that the LF (Line Feed) characters appear for an instant, and disappear. That’s much better than sticking around, but I can see the program will keep offering its crazy idiosyncracies.
The important issue now, if you are still of the mind to carry forth with your kind offer, is to shed light on the “Autosave” plug-ins. When I first started working with Notepad++, these Autosave plug-ins (at that time, I had installed both) did not do anything. After my disaster, I installed the first one, and I would like information on the question(s) I raised in my prior post. In addition to any other good advice, of course. (I see, Guy038, you were of the mind to provide even more of a lesson on this topic… and I hope you will do so. Others, as well.)
Great to hear you had a recent backup, Jeff! “Replace in Files” auto-saves after the replace. “Replace All” should not. I know some other editors keep a filename.txt.bak which you can open with Notepad++.
It’s also weird that View, Show Symbol, Show End of Line seems to be linked to a keyboard shortcut. Are you using crazy plugins or a buggy version of Notepad++? \n is the escape code for a linefeed character, and \r the same for a carriage return. Before the 1990s, big computers running Unix used \n to separate lines, the small personal Macintosh computers used \r, and Bill Gates thought it would be a good idea to use both (\r\n) so text files created on Windows would display correctly on all other computers.
Here’s a nice intro to regular expressions: http://codular.com/regex
So nice to hear from you, thank you so much, Cees! I appreciated the /n & /r explanation. (As well as the link. Pfffft! I would need to spend a good chunk of time to try and understand what they were talking about.)
But it sounds like /n is what would be resorted to when the Line Feed characters appear on their own. (By the way, I was a bit lost with your line, “View, Show Symbol, Show End of Line seems to be linked to a keyboard shortcut” in my case. Did I mention something like that?)
Last night I was working on my document and… THE DISASTER HAPPENED AGAIN!
What’s more, it wasn’t just the lines getting messed up, but a central section of the document went missing.
I quickly went to the directory of the file and made a copy of the file. (I have to be quick, because in ten minutes, assuming the “Autosave” was working, the file would be saved to the now corrupted version.) When I opened up the copy, it seemed the Autosave was working, as the changes seemed up-to-date. So I did a little minor editing, and replaced the now-corrupted original with the copy.
My Notepad++ has been working quite well, except for (as would take place in earlier times) the occasional appearances of the LF characters. (I would close, and re-open, and they would be gone.) Yet now I was drawn to your speculation that my copy might be buggy. (But why would it be buggy, if it was working fine before…)
At any rate, I’ve got v. 6.7.9. Do you think that is a bad one? As for Plug-ins, the only one I installed (and just days ago) was the primary Autosave one. The rest (Plug-in Manager, Converter, MIME Tools, NppExport, NppFTP) came with program.