Ed editor confusion with how the lines are spaced out
So I'm trying to adjust to ed as an editor and so far so good. However one confusion I have is how lines have a space between each other each time I press the enter key to go to the next line. yet ex doesn't do this. Ex puts each line right above or below each other with the prompt being separated from the output rather than right below it as a blank line. If I could demonstrate what I mean I'll show how a bit of the famous ed email would be printed in ed vs ex if I pressed the enter key to go to the next line:
ed- Quote:
Quote:
|
With 'ex', after the user presses enter the prompt line is erased to start of line, overwritten with the new line of output and then the prompt is re-written below it. ed doesn't go to that trouble: it simply outputs the line and repeats the prompt without erasing, that's why they look different. It's just the way they work.
If you use the '-p' option to give ed a decent prompt it's much easier to understand what is happening. e.g. Code:
$ ed -p "ed> " /etc/hosts |
Quote:
|
Perhaps it's implementation specific. I checked gnu ed and OpenBSD ed and they both work like that. If there's a way to disable the prompt lines to get the same behavior as ex ('P' doesn't do enough) I'd be interested to know how myself*.
* not that I use ed that often these days! :) |
To redraw a line, isn't that a terminal capability?
And wasn't ed designed to not require a terminal? |
Yes, ed dates back to the days of teletypes where you couldn't physically erase to start of line in the manner that 'ex' does. It's probably still using 'cooked' input too, so I doubt there's an option to do what the OP wants. I guess he'll just have to make do with the 'p' and 'n' commands.
|
Quote:
Quote:
|
Hmm, ex is a line editor as well.
But it requires a line redraw capability that was certainly not present in the early teletypes. I think the CR character was present, but it led to overtyping - rather than overwriting. |
Quote:
|
Okay, I got my question answsered and I thank you for the help. If anyone with sufficient moderation rights wants to lock it, go ahead because I'm good now.
|
All times are GMT -5. The time now is 02:16 PM. |