termwiz: windows: toggle autonewline when toggling cooked/raw

Without this, `wzsh` will keep the terminal in raw mode between
line editor invocations, resulting in staggered/stairway output
for any spawned commands.
This commit is contained in:
Wez Furlong committed 2020-04-08 08:57:26 -07:00
1 parent db845db55b
commit 11c7e29b59
1 file changed
+10
+10
View File
@@ -591,6 +591,11 @@ impl WindowsTerminalWaker {
impl Terminal for WindowsTerminal {
fn set_raw_mode(&mut self) -> Result<(), Error> {
let mode = self.output_handle.get_output_mode()?;
self.output_handle
.set_output_mode(mode | DISABLE_NEWLINE_AUTO_RETURN)
.ok();
let mode = self.input_handle.get_input_mode()?;
self.input_handle.set_input_mode(
@@ -601,6 +606,11 @@ impl Terminal for WindowsTerminal {
}
fn set_cooked_mode(&mut self) -> anyhow::Result<()> {
let mode = self.output_handle.get_output_mode()?;
self.output_handle
.set_output_mode(mode & !DISABLE_NEWLINE_AUTO_RETURN)
.ok();
let mode = self.input_handle.get_input_mode()?;
self.input_handle.set_input_mode(