microsoft / vscode-serial-monitor

Serial Monitor that allows for reading and writing to serial ports. Official issue tracking repository for Microsoft's Serial Monitor VS Code extension.
MIT License
59 stars 8 forks source link

Add option for implicit line feed/carriage return #185

Open andrewteta opened 5 months ago

andrewteta commented 5 months ago

Type: Feature Request

I'd like to have the option to display text with an implicit line feed '\n' for every carriage return '\r' or an implicit carriage return for every line feed. This is a feature in PuTTY that allows the terminal to display properly if a protocol only terminates with one or the other character.

image

gcampbell-msft commented 5 months ago

@andrewteta Thanks for the request!

I'll mark this as an enhancement and place it on the backlog. In the meantime, could you provide a screenshot of what this looks like in action so I can fully understand the request?

andrewteta commented 4 months ago

Here's an example for two input strings: "aabc\r" and "1234\r". The device returns a string terminated with "\r", in this case: "error\r".

VSCode Serial Monitor:

image

PuTTY with "Implicit LF in every CR" enabled:

image

In VSCode, the strings end up next to each other because there is no line feed ('\n') in the response. In PuTTY, the terminal is adding a '\n' after each received '\r' to properly display strings with '\r' delimiters on separate lines.

Now that I'm typing this out, I suppose the same thing could be accomplished by adding an expected line terminator for received strings. The options, CR, LF, and CRLF could be used to optionally display received chars on new lines. I'm not sure but a None option might make sense there too.

One more example that suggests the extension is just ignoring '\r' and '\n':

When the device emits "error\rtest\r" the extension displays: image