Extra newline after prompt ending in newline + GA

Post Reply
CurryMUD
Posts: 19
Joined: Sat Mar 26, 2016 3:53 am

Extra newline after prompt ending in newline + GA

Post by CurryMUD »

Hello,
I'm developing a MUD in which some prompts end in CRLF following by IAC GA. The intent is that the user will enter their input on the line directly below the prompt. For clients that have a dedicated input area (such as Mudlet), the hope is that the user's input will appear directly under the prompt after the user submits their input.
In Mudlet, I'm seeing an extra newline that I don't want. The user's input appears 2 lines below the prompt.
FWIW, I get the results I want in TinTin++ as well as the telnet command that comes with Mac OS X, suggesting that this is something particular to Mudlet.
Checking/unchecking "Fix unnecessary line breaks on GA servers" doesn't seem to have any affect.

Is there something I can do server-side to avoid the extra newline?

What I'm seeing in Mudlet:
Mudlet.png
What I'm seeing in TinTin++:
TinTin++.png

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Extra newline after prompt ending in newline + GA

Post by Jor'Mox »

In all likelihood, there is nothing that can be done here, since Mudlet echoes sent commands (when that option is even on) to a new line beneath whatever the current line is, as opposed to at the end of the current line (which is what you are seeing in the other clients). It isn't an extra blank line due to misinterpreting the go ahead signal, it is a real blank line that is being sent prior to that. But, a lot of people don't even have their commands echoed to the main window anyway, so it may not really be much of an issue.

Also, honestly, I would compare Mudlet to some other more modern clients, as opposed to TinTin and any command line telnet program, as the two classes of clients are built VERY differently. Every modern MUD client that I have seen has its own space to enter commands, instead of typing somewhere in the output area, so they are all likely to behave similarly to what you are seeing here.

CurryMUD
Posts: 19
Joined: Sat Mar 26, 2016 3:53 am

Re: Extra newline after prompt ending in newline + GA

Post by CurryMUD »

Mudlet echoes sent commands (when that option is even on) to a new line beneath whatever the current line is, as opposed to at the end of the current line
I'm not sure if that is the case. Here we see two prompts, one for the character's name, and the following [yes/no] prompt; each of these prompts are sent with a GA at the end but no CRLF. The user's input is shown on the same line as the prompts (which is the behavior I want in this case).
Screen Shot 2016-09-01 at 16.01.41.png
This is what led my to believe that a CRLF + GA prompt would lead to the user's input being shown on the line directly below the prompt, but this isn't the case.

If you could provide further assistance to help me understand what's going on here, it would be much appreciated.

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Extra newline after prompt ending in newline + GA

Post by Jor'Mox »

So, if you terminate the prompt with just the GA, you get the typed command immediately after the prompt (on the same line), but if you generate a new line and then send GA, you get a blank line between the prompt and the command. Okay, I guess I'm just way to used to whatever I see when I'm playing, which I may well have done something to cause to behave in that fashion a good while back.

I note, however, that when talking about a new line, you specify that you are sending both a carriage return and a line feed. I would think that if you tried sending only one or the other of those, there is a chance you might get the behavior you are looking for.

CurryMUD
Posts: 19
Joined: Sat Mar 26, 2016 3:53 am

Re: Extra newline after prompt ending in newline + GA

Post by CurryMUD »

Changing the connection handle's newline mode from CRLF to LF didn't have an effect.

My network library doesn't have an option for a CR mode, but I tried changing the newlines that I insert explicitly in code from \n (LF) to \r (CR). Unfortunately this created more problems. I believe \r is, in a pure sense, meant to move the cursor to the beginning of the line without advancing to the next line.

Maybe this will shed more light on the situation. The issue does not appear to be related to "Show the text you sent" being on. In the below screenshot, I entered "look" twice; the second time I did so after turning off "Show the text you sent". I would expect to see "The basement" displayed directly under the prompt.
Screen Shot 2016-09-01 at 16.14.11.png
Turning "Strict UNIX line endings" on/off doesn't seem to have an affect, either (tried twice: once w/ CRLF mode set server-side, again w/ LF mode set server-side).

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Extra newline after prompt ending in newline + GA

Post by Jor'Mox »

So, since there is obviously no problem with new lines in regular text, what happens if you don't send a GA at all?

Bear in mind that I just interact with MUDs from the player side of things, so take any of my ideas with a grain of salt. But, Mudlet obviously can function just fine in the absence of a GA (the MUD I play doesn't use them, for example), so leaving it off might fix your issue. And if you NEED a GA for some other clients, maybe there is a way to detect the client being used (or something similar), and enable sending a GA as needed.

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Extra newline after prompt ending in newline + GA

Post by SlySven »

BTW Sending a \r (CR) on its own is a no-no in telnet, it must be followed by a \0 (NULL) if it is not followed by a \n (LF):
In RFC854 it was wrote: The sequence "CR LF", as defined, will cause the NVT to be
positioned at the left margin of the next print line (as would,
for example, the sequence "LF CR"). However, many systems and
terminals do not treat CR and LF independently, and will have to
go to some effort to simulate their effect. (For example, some
terminals do not have a CR independent of the LF, but on such
terminals it may be possible to simulate a CR by backspacing.)
Therefore, the sequence "CR LF" must be treated as a single "new
line" character and used whenever their combined action is
intended; the sequence "CR NUL" must be used where a carriage
return alone is actually desired; and the CR character must be
avoided in other contexts. This rule gives assurance to systems
which must decide whether to perform a "new line" function or a
multiple-backspace that the TELNET stream contains a character
following a CR that will allow a rational decision.
Mind you this is a little academic in Mudlet as if there isn't a \n at the end of a line it puts it in anyhow IIRC. Which, as I have said elsewhere, is a bit awkward if the next character from the Server is a (non)-destructive backspace followed by a different character intended to animate a spinning sequence of these characters '\', '|', '/' and '-' - which one of the MUDs I have played uses!

And, if I briefly allowed to change my Mud Client hats {it is embarrassing to do it in public but anyone using the TinTin++ forums might guess a tiny connection I have there} - TinTin++ does have an option to separate the user input line from the Mud server output line - see the #split command...! :geek:

CurryMUD
Posts: 19
Joined: Sat Mar 26, 2016 3:53 am

Re: Extra newline after prompt ending in newline + GA

Post by CurryMUD »

Thank you for the technical notes. They make sense (though I admit I had to re-read the last line a few times before I got it). In any case, if one imagines CR to be like the motion of a typewriter head returning to the left side of the page (no vertical motion - that's LF), then it's clear: a CR-only "newline" doesn't make much sense, unless one is trying to do something tricky.
TinTin++ does have an option to separate the user input line from the Mud server output line - see the #split command...! :geek:
I was tempted to point this out as well. To be clear, I only brought up tt++ here to provide an illustration of the behavior I am aiming for in Mudlet. (As a MUD server dev, my goal is to provide an experience that looks the same on both clients.)

Admittedly, it's not the end of the world that Mudlet adds a single line of extra vertical space where I don't want it. I think it looks rather nice when one has turned off "Show the text you sent." But when the user's input appears two lines below the prompt, to me it looks a little jarring...

User avatar
SlySven
Posts: 1023
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Extra newline after prompt ending in newline + GA

Post by SlySven »

Yeah, control of Telnet Suboption 1 - Echo (see RFC857) confuses the hell out of me and I'm not entirely sure that Mudlet does it right - echoing login and password characters into local log files and not switching echoing off when it should - even though not echoing is the default MUST requirement for the base Network Virtual Terminal that ALL implementations must fulfil; it is complicated because the user at the local end might want what they type to show up because they are doing something locally even if the server doesn't want the keyboard output to be shown locally. I'd have to have a much firmer grip on this before I even think about messing in that area of the code-base. :o

CurryMUD
Posts: 19
Joined: Sat Mar 26, 2016 3:53 am

Re: Extra newline after prompt ending in newline + GA

Post by CurryMUD »

In case anyone is wondering, I found a scheme that I'm happy with. I entirely abandoned using GA. I also made it so that all prompts now have a CRLF newline. It looks consistent across clients.
Jor'Mox and SlySven, thanks for your help!

Post Reply