How to make Commander accept CR+LF as line terminator

How does one make Commander accept the 2-character sequence CR+LF (0xD+0xA) as a valid line terminator?

You can change from the default (0xA) to 0xD (or any there character, with endOfLineChar(<single_hex_val>); , but NOT BOTH 0xD, 0xA. The default on a term program my users MUST use is CR+LF.

Any advice?

Shouldn't be a problem..
CR is the 'usual text line terminator (the LF is added for old style terminals that needed to be pushed to the next 'line').

If you act on the CR - you can simply drop/ignore the LF - unless you are explicitly looking for them in a CRLF pair.

Tried that (cmd.stripCR(1)) BUT.. Since it ignores the CR, it ALSO doesn't echo it back.. So the line you just entered gets wiped out.

Commander contains this code which implies that it will strip out any Returns (0x0D) or Linefeeds (0x0A) that it finds after the EOF character:

		if(inByte == EOFChar && !ports.settings.bit.dataStreamMode){
			//println("EOF Found, tidying up");
			commandState.bit.dataStreamOn = false;
			//get rid of any newlines or CRs in the stream
			while(ports.inPort->peek() == '\n' || ports.inPort->peek() == '\r') ports.inPort->read();

That implies that if you are receiving 0x0D,0x0A and you set 0x0D as the EOF character, the 0x0A will be stripped for you.

OP, remember the CR & LF in this case are line terminators.
Both of the are irrelevant to your message.

It’s unimportant what happens to them once you know the command line has ended.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.