![]() |
Forum Index : Microcontroller and PC projects : MMedit is adding lines to a file.
Author | Message | ||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
I am using NP++ to write a program, and MMedit to format it and therefore confirm that I haven't screwed up one of the structures. The first line is a remark with the program name. ' A.BAS 8/7/2018 ============= The last line is also a remark. ' EOF ================ I write and save A.BAS in NP++. I start MMedit and it automatically reloads the newly saved A.BAS. (MMedit had A.BAS loaded the last time I shut it down.) I then hit Alt+P, then O to format, then Alt+F then S to save, then Alt+F4 to close MMedit. Windows changes the focus back to NP++ which still has the old A.BAS loaded. NP++ complains that another program has modified A.BAS so I let it reload A.BAS. NP++ now shows that A.BAS has two additional blank lines added after the old end. This happens every time. ' EOF ================ NP++ also now sometimes shows that the first line of A.BAS has been duplicated. ' A.BAS 8/7/2018 ============= ' A.BAS 8/7/2018 ============= Huh! What the ... moleijnn;lolasdf ;a; oma;omadf .... Paul in NY |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Doing some of the formatting and checking procedures when the file doesn't have a final CRLF was causing problems so some of the procedures will add a CRLF 'to be sure' I have only ever seen one blank line added. I can't think of any reason for one duplicated line being added to the start of the file. I will do some testing with NP++ What version of NP++ are you running. I am using 32bit V7.5.8 Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Hi Jim, V 3.7.5 OS Ver 10 Paul in NY |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Hi Jim, It always seems to add two CRLFs at the end resulting in two blank lines. The next time around it doesn't add any more, it's satisfied with the two. Paul in NY |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I don't know how many times I have told programmers that they need a trailing semicolon to suppress the addition of a newline in their file. Guess what I had left out. The reason for the second newline was a bit more complicated. I don't think I have broken anything else during the fix. Try this updated TKN file 2018-08-08_145646_MMedit.zip I do get very nervous about files without a newline on the last line. Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Hi Jim, The last line of my files do not normally have a trailing newline. The new .tkn no longer adds any lines after the last line even without a newline at the end. Are you saying that a trailing semicolon on the last line of the file will suppress the addition of a new line to the file, even though there is no trailing newline, like this? EOF: '=======================================================; Paul in NY |
||||
Azure![]() Guru ![]() Joined: 09/11/2017 Location: AustraliaPosts: 446 |
I think he was referring to an oops he did in his program source code for MMEdit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Correct. I made one of the silly mistakes that I should have known better about. It didn't matter normally because MMEdit does some cleaning up of the file endings when the file is opened. This hid the issue from me. Jim VK7JH MMedit |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
I'm older than you .... therefore I have made more silly mistakes in my time. I'm glad I could help uncover this one and you could shoot the bug. Paul in NY |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |