Text editors

T

Tim W

Notepad++ inexplicably keeps adding blank lines to my files so the text
is double and triple spaced. I am not particularly attached to the
program, so what other text editor is good for html and css under winxp?

Tim W
 
N

Neil Gould

Tim said:
Notepad++ inexplicably keeps adding blank lines to my files so the
text is double and triple spaced. I am not particularly attached to
the program, so what other text editor is good for html and css under
winxp?
I've been using TextPad for the past few years. I use it for several other
programming languages beyond HTML and CSS (Java / JScript/ PHP, ASP, VB,
etc.), and I am quite satisfied with its features and flexibility. Well
worth the price.
 
J

Jonathan N. Little

Tim said:
Notepad++ inexplicably keeps adding blank lines to my files so the text
is double and triple spaced. I am not particularly attached to the
program, so what other text editor is good for html and css under winxp?

I would assume it may be your document formatting option. Windows' \r\n
to Linux's \n becomes double-spaced since most servers are running 'nix.
"Tools > Preferences > New Document/ Default Directory" change your New
Document setting to Unix and UTF-8 might fix it.
 
B

Brian Cryer

Jonathan N. Little said:
I would assume it may be your document formatting option. Windows' \r\n to
Linux's \n becomes double-spaced since most servers are running 'nix.
"Tools > Preferences > New Document/ Default Directory" change your New
Document setting to Unix and UTF-8 might fix it.

Don't think that's an ASCII/UTF-8 thing, but a difference between Windows
and Unix. To "fit" it just ensure that when those files are copied up via
FTP that it is done in TEXT rather than BINARY mode and that will fix it.

In the OP's case, if the extra blank lines are appearing only after the file
is copied to the server then yes I think you've put your finger on the
problem. If the blank lines are appearing localy then presumably its a but
in Notepad++.
 
T

Tim W

Don't think that's an ASCII/UTF-8 thing, but a difference between
Windows and Unix. To "fit" it just ensure that when those files are
copied up via FTP that it is done in TEXT rather than BINARY mode and
that will fix it.

In the OP's case, if the extra blank lines are appearing only after the
file is copied to the server then yes I think you've put your finger on
the problem. If the blank lines are appearing localy then presumably its
a but in Notepad++.


Now I have uploaded my .php and .css files and look at them on the
server they are all on one line a mile long.

FileZilla is set to Transfer Type - Auto but has maybe done something
strange. I will try overwriting them with it set to Text.

Tim w
 
L

Lewis

In message said:
Notepad++ inexplicably keeps adding blank lines to my files so the text
is double and triple spaced. I am not particularly attached to the
program, so what other text editor is good for html and css under winxp?

I've used Notepad++ off an on for years and have never seen this. I
suspect you are messing up the line endings.
 
D

dorayme

Tim W said:
Notepad++ inexplicably keeps adding blank lines to my files so the text
is double and triple spaced. I am not particularly attached to the
program, so what other text editor is good for html and css under winxp?

If there are preferences or options, say how they are set.
 
T

Tim W

I've used Notepad++ off an on for years and have never seen this. I
suspect you are messing up the line endings.
Wot's a 'line ending'?

Does it have some special meaning? my normal understanding of "end of a
line" is not really something which could be easily messed up.

But I downloaded an alternative 'gedit' which is doing the same thing so
you are right that it isn't notepad++'s fault.

I haven't been paying enough attention to be sure exactly when the
changes occur but I have files with loads of extra linebreaks in so they
are really tall and now files with no line breaks at all so they are all
on one really long line.

This could get to be a real drag.

Tim w
 
J

Jonathan N. Little

Tim said:
Wot's a 'line ending'?

Does it have some special meaning? my normal understanding of "end of a
line" is not really something which could be easily messed up.

But I downloaded an alternative 'gedit' which is doing the same thing so
you are right that it isn't notepad++'s fault.

I haven't been paying enough attention to be sure exactly when the
changes occur but I have files with loads of extra linebreaks in so they
are really tall and now files with no line breaks at all so they are all
on one really long line.

You have not made it clear, but I am assuming that the double line
spacing you are experiencing is when you are viewing the SOURCE code and
not the final display of the webpage in the browser.

If you view a Linux text file in Windows Notepad it will look a on one
line, because Windows NEEDS two characters to signify a NEWLINE (CR+LF)
whereas Linux only uses one (LF).

Conversely a Windows text file with is two-character newline will appear
as double spaced on Linux
 
B

Ben Bacarisse

Jonathan N. Little said:
If you view a Linux text file in Windows Notepad it will look a on one
line, because Windows NEEDS two characters to signify a NEWLINE
(CR+LF) whereas Linux only uses one (LF).

Conversely a Windows text file with is two-character newline will
appear as double spaced on Linux

Not usually. Most editing software will either show you the CR as a
special character or it will decide you have Windows line endings. Most
display programs are similar (e.g. 'more' and 'less') and if you just
throw the file at a tty, the CR won't usually display as another line
separator.
 
D

dorayme

Ben Bacarisse said:
Not usually. Most editing software will either show you the CR as a
special character or it will decide you have Windows line endings. Most
display programs are similar (e.g. 'more' and 'less') and if you just
throw the file at a tty, the CR won't usually display as another line
separator.

Someone tell the OP to say what preferences/options his text editor
software has to control this. And maybe he can be advised specifically
what to do.
 
T

Tim W

Someone tell the OP to say what preferences/options his text editor
software has to control this. And maybe he can be advised specifically
what to do.

It's alright you have done. I will look.

Tim W
 
D

dorayme

Tim W said:
It's alright you have done. I will look.

In case you are not sure what to look for, my editor, for example has
the following relevant headings and options:

Editor defaults: (for appearance on your computer), includes Soft Wrap
Text (dynamic depending on your editor width) - I have this as set -
or wrap to specific width...

Text Files: Saving: all sorts of things including Default Line Break
of Mac or Unix or Dos/Window, Default Text Encoding of all sorts
including Unicode (UTF-, BOM or not...), Force New Line at End to tick
or not...

Saving your HTML and CSS files is quite important, so is setting up
your FTP and server configs for online displays.
 
B

Brian Cryer

Tim W said:
Now I have uploaded my .php and .css files and look at them on the server
they are all on one line a mile long.

This might not be wrong, but might be the other wide of the issue Jonathan
raised. If you save the html file and then open it in wordpad instead of
notepad then does the formatting look right? Wordpad will render a \n as a
newline, whereas notepad seems to ignore \n and only looks for a \r which
means that you end up seeing a single long line.
FileZilla is set to Transfer Type - Auto but has maybe done something
strange. I will try overwriting them with it set to Text.

I would expect FileZilla to be getting it right. Auto is probably what you
want (provided your html files are named with a .htm or .html file extension
and not something different).
 
W

William Gill

Notepad++ inexplicably keeps adding blank lines to my files so the text
is double and triple spaced. I am not particularly attached to the
program, so what other text editor is good for html and css under winxp?

Tim W

I'm a little late to the party, but I seem to be missing something in
your post.

You say "Notepad++ inexplicably keeps adding blank lines." When and
where are you seeing the extra lines? I use several text editors
including Notepad++, and there are basically two (somewhat related)
causes for extra lines, but clarifying what is happening needs to happen
before you can understand and correct it.

I assume you are editing the source document in NP++, and then opening
it elsewhere (destination document) to reveal the extra blank lines. So
the first question is what's the difference in document environments?

eg:
source
- NP++ (w/o extra lines)
- on your desktop
- using Windows XP
- saved in Windows format.

destination
- vi editor
- on a remote computer
- using a *nix operating system.

or

destination
- web page (html document)
- on a *nix operating system
- ???
(I think HTML would "self correct", because it wraps when needed or when
told to via tags like </p> or <br>)

Analyze the source and destination environment to determine their
differences. Then apply the tips you have been given, like the
different line endings (NP++ -> edit -> EOL conversion -> ??? format).

Most text editors read the file and display them correctly regardless
which line endings are used, they just decide if it's Windows/DOS, UNIX,
or Mac format (based on EOL). This may confuse the user, because the
editor is quietly making adjustments without the user noticing.

You should also consider the document encoding involved (UTF-8, etc.).
I have had similar experiences (extra lines) when opening in other
programs, or when cutting and pasting between documents using different
encoding.
 
T

Tim W

I'm a little late to the party, but I seem to be missing something in
your post.

You say "Notepad++ inexplicably keeps adding blank lines." When and
where are you seeing the extra lines? I use several text editors
including Notepad++, and there are basically two (somewhat related)
causes for extra lines, but clarifying what is happening needs to happen
before you can understand and correct it.

I assume you are editing the source document in NP++, and then opening
it elsewhere (destination document) to reveal the extra blank lines. So
the first question is what's the difference in document environments?

eg:
source
- NP++ (w/o extra lines)
- on your desktop
- using Windows XP
- saved in Windows format.

destination
- vi editor
- on a remote computer
- using a *nix operating system.

or

destination
- web page (html document)
- on a *nix operating system
- ???
(I think HTML would "self correct", because it wraps when needed or when
told to via tags like </p> or <br>)

Analyze the source and destination environment to determine their
differences. Then apply the tips you have been given, like the
different line endings (NP++ -> edit -> EOL conversion -> ??? format).

Most text editors read the file and display them correctly regardless
which line endings are used, they just decide if it's Windows/DOS, UNIX,
or Mac format (based on EOL). This may confuse the user, because the
editor is quietly making adjustments without the user noticing.

You should also consider the document encoding involved (UTF-8, etc.). I
have had similar experiences (extra lines) when opening in other
programs, or when cutting and pasting between documents using different
encoding.

I really appreciate the interest from you and others. I haven't been
been paying enough attention to say with any certainty where the problem
is occurring. I am editing text files with notepad++. uploading them to
a linux server. I am using a CMS which has its own text editor so I may
have made and saved small changes through the CMS 'Edit Theme' tab. I
might then ftp it back to my windows desktop to make more serious edits
where it could be opened by default in Windows Notepad and now in Gedit
which I downloaded as a possible replacement. Confusing.

Now here's a thing. I have retrieved a CSS file from the server. It has
no line breaks in it, one long line. I go through it in notepad++
hitting the return key (385 times) where I want a line break and by
going VIEW - SHOW SYMBOLS - SHOW ALL I can see CR[in a box] (Carriage
Return?) at the end of each line. I save it and open it in Windows
Notepad and it has no line breaks, the CR symbols have become unknown
ascii characters like rectangles and it's all on one line again. I would
paste some of it here but when I paste the text the rectangles become
line breaks again (in a thunderbird email) so you would see nothing odd.

At this point I notice that a previous version of my file with SHOW
SYMBOLS on has the symbols at the line end denoted by CR LF[in a box]
not just CR and this one displays perfectly well in Notepad. I then find
one of the files which has been given double spacing and look at the
symbols at the line ends: It looks like every instance of [CR] has had
[CR][LF] added to it so that each line ends in [CR][CR][LF] hence the
double spacing, but only in Notepad++ and not in Windows Notepad.

Anyway, my css file - I upload it back up to the server, open it in the
CMS editor and all 385 line breaks have disappeared. I download it back
to the desktop, open it and look for the Symbols and they are all gone.
Holey Moley! Lucky I changed the file name.

A little more investigation and your hint above and I find a command in
Notepad++ called EOL Conversion which changes the end of line symbols
from [CR] to [LF] to [CR][LF] and names them MAC, UNIX and Windows
format, which is wierd because I am getting Mac line endings and I have
never been near a MAC

Confused? So am I. I am finding it difficult to see any sense or meaning
in this episode and hard to draw any useful lesson from it. A bit like
the rest of life really and like the rest of life I will just have to
deal with the apparently random difficulties that are put in my way with
whatever whatever method comes to hand and hope I am not storing up
difficulty for the future.

I may not be around much for a few days so apologies to anyone expecting
a reply. The help I have had here ahs been really valuable and I am much
obliged to you all.

Tim w
 
D

dorayme

Tim W said:
Now here's a thing. I have retrieved a CSS file from the server. It has
no line breaks in it, one long line. I go through it in notepad++
hitting the return key (385 times)

er... Many good editors, or at least some good editors allow you to do
this in one go. Mine, for example can "hard wrap" at any number of
characters one chooses for any selected text.
 
W

William Gill

er... Many good editors, or at least some good editors allow you to do
this in one go. Mine, for example can "hard wrap" at any number of
characters one chooses for any selected text.

I'm guessing the source CSS file had cr and lf characters removed to
"compress" the file, since a semicolon is the only line end required by
CSS. NP++ has an extended find/replace capability to reformat it for
human consumption (and humanoid consumption too, dorayme).
 
D

dorayme

William Gill said:
(and humanoid consumption too, dorayme).

It is extremely rare for anyone to make provisions for us here on
earth. I seethe with indignation at male, female, disabled toilets and
no other, ditto for cars, motorbikes, bicycles but none for small
space vehicles. Luckily, in the digital world, there is much to be
thankful for, no wonder I rarely venture out.
 
W

William Gill

I'm guessing the source CSS file had cr and lf characters removed to
"compress" the file, since a semicolon is the only line end required by
CSS. NP++ has an extended find/replace capability to reformat it for
human consumption (and humanoid consumption too, dorayme).
My last reply was only half an answer to the OP, so Tim:

From what I'm seeing, your documents ultimate home is a linux server
(you didn't say, but all indications are that they are html and css
documents). So what I would do is treat them as UNIX format wherever
possible to avoid having any text editor "correcting" things along the way.

1) Set NP++: preferences > New Document/Default Directory > format=UNIX
for any new documents you create.

2) When editing existing docs (in NP++) pay attention to the status bar
to insure they are "UNIX". If not, convert them: edit > EOL conversion
UNIX format

3) try to avoid using Notepad, as it just confuses the situation, and
lacks any real option flexibility.

4) see if your CMS editor has options similar to those we just went over
in NP++. If not and it is a Win program it's a it probably uses DOS
line ends (i.e. [CR][LF]), but that's a guess.

As for your CSS files, don't waste your time manually entering [return].
The next few steps are based on much educated guesswork, so take them
with a metric ton (inflation for a grain + allowance for my guesswork)
of salt.

Your CMS editor may be seeing the ".css" file extension, and
"optimizing" the file by eliminating "unnecessary" line end characters.
Valid CSS statements must be terminated with a semicolon. Programs
that use them (i.e. browsers) don't mind the long unbroken stream you
report. Eliminating the "unnecessary" line ends saves byte space.
Unfortunately, organic lifeforms prefer to see statements on individual
lines. So:

1) Check your CMS Editor for any option that may effect this "optimizing
", or "compression". If any exist see if you can eliminate your problem
by changing them.

2) If you open a CSS file in NP++, and it is w/o line ends use the built
in find/replace to restore them:
Find what: ;
Replace with: ;\n
Search Mode Extended (\n,\r,...)

3) Optionally rename your css files to .txt (you can just append .txt
like filename.css.txt) before uploading, and change them back after. In
lieu of editor options this should fool the CMS editor into not
automatically optimizing the file.

If your problem persists, or is only partially addresses, you may have
to look at character encoding differences, but let's cross that bridge
if and when we have to.

Let me know if this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top