diff --git a/amitools/vamos/lib/dos/terminal.py b/amitools/vamos/lib/dos/terminal.py index 5c96bcc1..ca549fad 100644 --- a/amitools/vamos/lib/dos/terminal.py +++ b/amitools/vamos/lib/dos/terminal.py @@ -21,14 +21,27 @@ def close(self): def set_mode(self, cooked): # [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] + # 0 1 2 3 if termios: state = termios.tcgetattr(self.fd) - # control ECHO/ICANON/IEXTEN + + # input modes + # ICRNL: do not convert CR to NL on input for raw + flags = termios.ICRNL + if cooked: + state[0] |= flags + else: + state[0] &= ~flags + + # local modes: ECHO/ICANON/IEXTEN + # ECHO: no local echo + # ICANON/IEXTEN: no line-wise editing flags = termios.ECHO | termios.ICANON | termios.IEXTEN if cooked: state[3] |= flags else: state[3] &= ~flags + termios.tcsetattr(self.fd, termios.TCSAFLUSH, state) return True else: