From b4b9111b33568060a1f3aa1b2560db9121c5c1ec Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 6 Jan 2020 19:26:56 +0100 Subject: [PATCH] Enable line wrap in TTY, in case was disabled previously Signed-off-by: Joachim Nilsson --- src/stty.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/stty.c b/src/stty.c index c77391b3..63e74e08 100644 --- a/src/stty.c +++ b/src/stty.c @@ -95,7 +95,7 @@ void stty(int fd, speed_t speed) tcflush(fd, TCIOFLUSH); /* Disable modem specific flags */ - term.c_cflag &= ~(0|CSTOPB|PARENB|PARODD); + term.c_cflag &= ~(0|CSTOPB|PARENB|PARODD|CBAUDEX); term.c_cflag &= ~CRTSCTS; term.c_cflag |= CLOCAL; @@ -104,7 +104,7 @@ void stty(int fd, speed_t speed) term.c_cc[VMIN] = 1; term.c_iflag = ICRNL|IXON|IXOFF; term.c_oflag = OPOST|ONLCR; - term.c_cflag |= CS8|CREAD|HUPCL|CBAUDEX; + term.c_cflag |= CS8|CREAD|HUPCL; term.c_lflag |= ICANON|ISIG|ECHO|ECHOE|ECHOK|ECHOKE; /* Reset special characters to defaults */ @@ -116,8 +116,11 @@ void stty(int fd, speed_t speed) term.c_cc[VERASE] = CERASE; tcsetattr(fd, TCSANOW, &term); - /* Restore cursor if it was hidden previously */ + /* Show cursor again, if it was hidden previously */ write(fd, "\033[?25h", 6); + + /* Enable line wrap, if disabled previously */ + write(fd, "\033[7h", 4); } /**