Add support for LNM (Line Feed/New Line Mode) #15261
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for the ANSI Line Feed/New Line mode (
LNM
), whichdetermines whether outputting a linefeed control should also trigger a
carriage return, and whether the
Return
key should generate anLF
inaddition to
CR
.Detailed Description of the Pull Request / Additional comments
In ConHost, there was already a console mode which handled the output
side of things, but I've now also added a
TerminalInput
mode thatcontrols the behavior of the
Return
key. WhenLNM
is set, both theoutput and input modes are enabled, and when reset, they're disabled.
If they're not already matching, then
LNM
has no effect, and will bereported as unknown when queried. This is the typical state for legacy
console applications, which expect a linefeed to trigger a carriage
return, but wouldn't want the
Return
key generating bothCR
+LF
.As part of this PR, I've also refactored the
ITerminalApi
interface toconsolidate what I'm now calling the "system" modes: bracketed paste,
auto wrap, and the new line feed mode. This closes another gap between
Terminal and ConHost, so both auto wrap, and line feed mode will now be
supported for conpty pass through.
Validation Steps Performed
I've added an
LNM
test that checks the escape sequence is triggeringboth of the expected mode changes, and added an additional
DECRQM
testcovering the currently implemented standard modes: the new
LNM
, andthe existing
IRM
(which wasn't previously tested). I've also extendedthe
DECRQM
private mode test to coverDECAWM
and Bracketed Paste(which we also weren't previously testing).
I've manually tested
LNM
in Vttest to confirm the keyboard is workingas expected.
Closes #15167