diff --git a/src/common.rs b/src/common.rs index 3936dafd0..6cf7f2946 100644 --- a/src/common.rs +++ b/src/common.rs @@ -849,8 +849,9 @@ pub fn read_unquoted_escape( let mut result_char_or_none: Option = None; let mut errored = false; - let mut in_pos = 1; // in_pos always tracks the next character to read (and therefore the number - // of characters read so far) + // in_pos always tracks the next character to read + // (and therefore the number of characters read so far) + let mut in_pos = 1; // For multibyte \X sequences. let mut byte_buff: Vec = vec![]; diff --git a/src/reader.rs b/src/reader.rs index cc7319c6d..89aff5541 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -4373,15 +4373,20 @@ fn select_completion_in_direction( /// Restore terminal settings we care about, to prevent a broken shell. fn term_fix_modes(modes: &mut libc::termios) { - modes.c_iflag &= !ICRNL; // disable mapping CR (\cM) to NL (\cJ) - modes.c_iflag &= !INLCR; // disable mapping NL (\cJ) to CR (\cM) - modes.c_lflag &= !ICANON; // turn off canonical mode - modes.c_lflag &= !ECHO; // turn off echo mode - modes.c_lflag &= !IEXTEN; // turn off handling of discard and lnext characters - modes.c_oflag |= OPOST; // turn on "implementation-defined post processing" - this often - // changes how line breaks work. - modes.c_oflag |= ONLCR; // "translate newline to carriage return-newline" - without - // you see staircase output. + // disable mapping CR (\cM) to NL (\cJ) + modes.c_iflag &= !ICRNL; + // disable mapping NL (\cJ) to CR (\cM) + modes.c_iflag &= !INLCR; + // turn off canonical mode + modes.c_lflag &= !ICANON; + // turn off echo mode + modes.c_lflag &= !ECHO; + // turn off handling of discard and lnext characters + modes.c_lflag &= !IEXTEN; + // turn on "implementation-defined post processing" - this often changes how line breaks work. + modes.c_oflag |= OPOST; + // "translate newline to carriage return-newline" - without you see staircase output. + modes.c_oflag |= ONLCR; modes.c_cc[VMIN] = 1; modes.c_cc[VTIME] = 0; diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 771e6e77a..f7f416530 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -1333,8 +1333,9 @@ fn consume_char_whitespace(&mut self, c: char) -> bool { while self.state != S_END && !consumed { match self.state { S_ALWAYS_ONE => { - consumed = true; // always consume the first character - // If it's not whitespace, only consume those from here. + // always consume the first character + // If it's not whitespace, only consume those from here. + consumed = true; if !c.is_whitespace() { self.state = S_GRAPH; } else { @@ -1344,14 +1345,16 @@ fn consume_char_whitespace(&mut self, c: char) -> bool { } S_BLANK => { if c.is_whitespace() { - consumed = true; // consumed whitespace + // consumed whitespace + consumed = true; } else { self.state = S_GRAPH; } } S_GRAPH => { if !c.is_whitespace() { - consumed = true; // consumed printable non-space + // consumed printable non-space + consumed = true; } else { self.state = S_END; }