Version: 3.3.4 (using KDE KDE 3.4.3KDE 1.2) Installed from: Compiled From SourcesCompiled From Sources An additional blank line is shown in the editor after the last \n in the file. This means it can be deleted which causes warning messages on some compilers, eg aCC on HP: Error (future) 690: "...", line 22 # Nonempty source files must end with a newline that is not preceded by a backslash.
which editor are you using?
the "Embedded Advanced Text Editor"
I don't understand this report, but the handling of lines in the editor... is in the domain of the editor. Reassigning.
Which is completly correct, in other languages, it is wanted, that the last newline is removable, if you remove it in your C code, it will cause warnings, yes, but that's not a problem of the editor part. Perhaps some option could be added, to always add a newline as last char, if none there in the file. But I think that is really bloat...
Really? In which languages wouldn't you use a newline? The vim editor only omits the last newline if you are editing a binary file (or are in binary mode) - I don't see why you would want to remove it from a text file. Automatically adding a newline is probably unnecessary as no other editor I've used allows you to accidentally create a file with it missing. Just making it harder to remove it would be sufficient.
Just to throw my $0.02 in here, I think the right way *is* to always add a trailing new line, or alternatively to always make sure a trailing newline is present, e.g. if you start typing on the last line. In fact, this second idea *might* be really useful because you can always hit ctrl-end to start typing on a new line at the end of the document (but conversely, what if you wanted to start typing at the end of the last line?). Anyway, I agree with Rob that I think this is much more generically useful than "only for C/C++". Try 'cat <file>' on anything that doesn't end in a newline and then tell me that ASCII files shouldn't end with a newline regardless of language. :-) I personally don't think this is really that much more "bloat" than 'remove trailing spaces'...
If you always have a trailing newline, then showing an empty line after it at the end of the file is unecessary (and to me unintuitive). I would expect ctrl-end to start typing at the end of the last line, with an additional carriage return necessary to start a new line at the end of the file.
?confused? I'm using 2.5.5 of Kate, I'm getting warnings about missing newlines,(with g++) which is really annoying. The default should be to *always* if last char is not /n: append a /n to be diplomatic there could be a option to disable this, but the *nix standard is to always end files with a newline. From the other posts it looks like this has already been done. Is this a new bug?
There are tons of valid cases where you don't want a \n at file end, yes, even for files you cat, as it is not that cool to have newlines in commandlines you construct via cat or in PHP files, where you don't want \n at end of file sometimes, too (we had even a bug report about this in the past from a web designer developing with PHP where this was fatal...). There is no standard which says there must be a \n, even emacs doesn't do so... I am ok with an option, I agree that people using C/C++ and Co. needs this to have a more easy life, but I don't agree at all on it being default on, because that is not expected behaviour, if the user wants only one line without \n in a file, we should respect that, it's completly valid...
Reopened as per Christoph's agreement. We will (eventually :-)) add a *non-default* option to add a \n to the end of the file if it does not end with one.
This would align kate with those other "power" editors, like emacs or vim.
Please OFF by default.
Of course and as far as I can see nobody suggested otherwise...
an option, along with a document variable so it can be set for filetypes/modes :)
Is this feature available on KDE 4?
Not yet. Want to help write it? :-)
Should be implemented as option. *** This bug has been marked as a duplicate of bug 256134 ***