Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: MMedit is adding lines to a file. Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Paul_L
Guru
Guru


Joined: 03 March 2016
Location: United States
Online Status: Offline
Posts: 375
Posted: 08 August 2018 at 3:43am | IP Logged Quote Paul_L

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

Edited by Paul_L on 08 August 2018 at 3:48am



Back to Top View Paul_L's Profile Search for other posts by Paul_L
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2567
Posted: 08 August 2018 at 8:03am | IP Logged Quote TassyJim

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

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Paul_L
Guru
Guru


Joined: 03 March 2016
Location: United States
Online Status: Offline
Posts: 375
Posted: 08 August 2018 at 9:48am | IP Logged Quote Paul_L

Hi Jim,

V 3.7.5 OS Ver 10

Paul in NY
Back to Top View Paul_L's Profile Search for other posts by Paul_L
 
Paul_L
Guru
Guru


Joined: 03 March 2016
Location: United States
Online Status: Offline
Posts: 375
Posted: 08 August 2018 at 10:59am | IP Logged Quote Paul_L

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
Back to Top View Paul_L's Profile Search for other posts by Paul_L
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2567
Posted: 08 August 2018 at 3:01pm | IP Logged Quote TassyJim

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.
Quote:
PRINT #f, txt$;

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

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Paul_L
Guru
Guru


Joined: 03 March 2016
Location: United States
Online Status: Offline
Posts: 375
Posted: 08 August 2018 at 8:45pm | IP Logged Quote Paul_L

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
Back to Top View Paul_L's Profile Search for other posts by Paul_L
 
Azure
Guru
Guru
Avatar

Joined: 09 November 2017
Location: Australia
Online Status: Offline
Posts: 362
Posted: 08 August 2018 at 8:51pm | IP Logged Quote Azure

I think he was referring to an oops he did in his program source code for MMEdit
Back to Top View Azure's Profile Search for other posts by Azure
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2567
Posted: 09 August 2018 at 7:45am | IP Logged Quote TassyJim

Azure wrote:
I think he was referring to an oops he did in his program source code for MMEdit

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


__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
Paul_L
Guru
Guru


Joined: 03 March 2016
Location: United States
Online Status: Offline
Posts: 375
Posted: 10 August 2018 at 5:04am | IP Logged Quote Paul_L

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
Back to Top View Paul_L's Profile Search for other posts by Paul_L
 


If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Search the forums using Google.
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1250 seconds.
Privacy Policy     Process times : 0.02, 0, 0, 0.11