Problems with different line endings

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
LonelyPixel
Posts: 12
Joined: Mon Sep 15, 2003 9:17 pm
Location: Germany

Problems with different line endings

Post by LonelyPixel »

Hello,
first, I can't find a "Bugs" forum. Then I also searched this board. And here's my problem:

I'm writing a lot of code (PHP) with Textpad. Normally, I only save files with PC line endings. But I happen to find my files with some additional empty lines when I re-open them. I'm absolutely sure, I didn't insert these lines, as I generally write quite clean styled code. When I save the file with Ctrl+S, I see it says "Unknown" line format. But it should be "PC". When I go to the Save As dialog, it displays "Leave unchanged" in this box. But it should be "PC". When I remove the spare lines and save explicitly as "PC", it works, when I re-open this file.

The error is not reproduceable, it happens every now and then. Only the lines I recently changed seem affected by this. Is there a bug in the way TP recognizes line endings? It would have to be a serious error in the program, I didn't use UNIX files for a long time now AFAIR.
User avatar
Niels H. Veldhuijzen
Posts: 15
Joined: Mon Apr 19, 2004 12:12 pm
Location: Zutphen, The Netherlands
Contact:

Post by Niels H. Veldhuijzen »

Dear all,

this looks a bit like my problem, which I did not succeed in putting through to this forum. (How do you put a message on the forum?) In some of my newly keyed n files (default file format: PC), the line ending is LF/LF, instead of CR/LF. I never spotted it before Textpad 4.7.2, although I don't know if this version is to blame. If you have any idea about what's happening, please let us know.
Yours sincerely,

Niels H. Veldhuijzen
Zutphen, The Netherlands
adh1003
Posts: 3
Joined: Thu May 20, 2004 12:32 pm

Post by adh1003 »

That's exactly what I'm seeing. Again, I've only noticed this with 4.7.2 but then, in the past I've mostly edited LF only files.

I am seeing odd line spacing in things I load back into TextPad, where CR/LF line endings seem to have been written as LF/LF by accident. The file at the time of editing was of type "PC" according to TextPad. The Save As file format is "No change". I'm using WinScite to view the line ending types in the file. Loading the "damaged" file back into TextPad shows double line spacing and a filetype that's become "Unknown" rather than "PC". Windows XP Pro, up to date patches, P4 2.8GHz no HT, 512MB RAM.

I'm presently working on a moderate sized source tree with a mixture of files with PC or Unix-style line endings. It appears that this problem has been "rotting" sources for some time and only came to light recently. It's causing us a great deal of headaches trying to fix things and get our CVS repository back into a sane state.

With no official acknowledgement of the fault - the two reports I'm replying to are from September last year and April this year, so it's been a while! - I think I'm going to be forced to drop TextPad and use another editor until a fix is made.

Is there an official place to send bug reports?
Arkham
Posts: 1
Joined: Thu May 20, 2004 11:32 pm
Location: Toronto, Ontario

Post by Arkham »

I'm having the same problem. The lines are not being terminated properly -- TextPad is apparently adding something to the file, forceing it to require conversion to DOS in UltraEdit, when it should be saving it in DOS format. It's adding extra <CR> to the <CR><LF> ending.

I have to dump TextPad now. I hate to, I love it, but work requires it.
asbury
Posts: 2
Joined: Wed May 26, 2004 5:49 pm

re: different line endings

Post by asbury »

I have the same problem with blank lines being inserted into text files that do not exist in notepad. The files themselves have been opened or saved in their lifetime on a unix machine, but the lines don't show up in notepad on a windows 2k or xp machine, only in textpad(other text editors too such as Edit Pad that I've tried--the added blank lines are there too).

Any ideas?
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

If you have been affected by this problem, please will you try this latest build of TextPad:

http://www.textpad.com/download/beta/textpad473.zip

The zip file only contains textpad.exe, so backup your original version of that file and extract the new one to the same location.

Please post your results here, so we can be sure we've fixed it.

Thanks,

Keith MacDonald
Helios Software Solutions
adh1003
Posts: 3
Joined: Thu May 20, 2004 12:32 pm

Post by adh1003 »

bbadmin wrote:Please post your results here, so we can be sure we've fixed it.
Great news - thanks for supplying a fix! :) The trouble is, I found the fault to be intermittent and hard to duplicate. On the basis of the changes made for this test version of TextPad, do you have some idea of the circumstances that should cause it to generate incorrect line endings? I could then try than on my 4.7.2 installation to confirm that it does show the issues I've seen in the past, then try 4.7.3 and see if the problem goes away.

Aside from that, only running 4.7.3 for a fairly long period of time will be able to show that the bug seems to be fixed, or at least shows up far less often.
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

do you have some idea of the circumstances that should cause it to generate incorrect line endings?
The problem can only arise if an existing line is increased in length (or a new line typed), then split between its first and second characters. After that, the first of the split lines will be terminated with two linefeeds, if the original ended with return and linefeed. Unix and Mac files are unaffected.

Keith MacDonald
Helios Software Solutions
adh1003
Posts: 3
Joined: Thu May 20, 2004 12:32 pm

Post by adh1003 »

bbadmin wrote:The problem can only arise if an existing line is increased in length (or a new line typed), then split between its first and second characters (...)
Ah. So amongst other things, suppose we want to reformat some code laid out like this:

Code: Select all

if (thing == 1)
{ do_something();
  do_something_else();
}
(which is evil ;) ) and change it to:

Code: Select all

if (thing == 1)
{
  do_something();
  do_something_else();
}
...by first inserting the extra leading space after the "{", then pressing return immediately after it to drop the 'do_something()' line down. That's the sort of thing I do from time to time (don't ask, I'm just like that, and yes, this is rather redundant example because auto-indentation would take care of this without typing the extra space normally). Yes, in TextPad 4.7.2, this causes the fault on a CR+LF terminated file. And yes, in 4.7.3 this is fixed :D (it's useful to know, too, that it only affected 'PC' format files).

Such a narrow set of actions that need to be taken to provoke the fault certainly explains why it seemed to be so intermittent.

I'll move to 4.7.3 full-time and keep an eye on line endings just in case, but it sounds like the fault is fixed - thanks again.
bgclarke
Posts: 24
Joined: Tue Oct 14, 2003 4:18 pm
Location: Ottawa, Canada

Post by bgclarke »

adh1003 wrote:That's the sort of thing I do from time to time (don't ask, I'm just like that)
You're not alone :D

I do that with C and Java code. One guy on our team uses 3 tab spaces and his Java IDE does not put a CR after the "{", so I do it for him whenever I have to update something he wrote.
qkz73
Posts: 33
Joined: Thu Jul 22, 2004 9:15 pm

Thank you, Helios

Post by qkz73 »

First off, I love TextPad. I have been using it since version 3. I was using 4.7.2 since it came out and only just upgraded to the 4.7.3 version. For a lot of the web text file types that I edit for the websites I develop (e.g., PHP, HTML, CSS, JS) this problem was driving me NUTS.

Thanks so much for fixing this linefeeds issue !!
- QKZ -
Post Reply