Download raw body.
bin/ksh: fix emacs/vi line editor getting wrong terminal width
bin/ksh: fix emacs/vi line editor getting wrong terminal width
On Sun, Jan 11, 2026 at 12:58:46AM +0100, Kirill A. Korinsky wrote: > tech@, > > Xterm and other terminal emulators resize the pty after starting the > shell. x_init() queries terminal size at startup before the resize > occurs, so x_cols is kept at default 80 colums. > > SIGWINCH arrives but check_sigwinch() wasn't called until after command > entry. This causes the line editor thinks that screen is 80 columns, > than leads to show '<' and truncate input before reaching the actual > terminal edge for large window, and wired behaiour for small one. > > Here, I call check_sigwinch() when entering edit mode and on EINTR in > x_getc(). Callback lets emacs/vi recalculate display width and redraw. > > Thoughts? Tests? Ok? This patch is heading in the right direction but I've tested it in both X11 and the MacOS Terminal application and it still needs some tweaks. The following is the output when I resize MacOS Terminal to 64 characters wide. apple$ /usr/src/bin/ksh/ksh asd we rewr ewr qr qewrt <<<<<<<<<<<<<<< You can see that it is adding multiple chevrons, when before it didn't do that. Also, if the cursor is close to the right when you resize, the chevron disappears or is replaced by an asterisk. It's likely there is an off by one error somewhere.
bin/ksh: fix emacs/vi line editor getting wrong terminal width
bin/ksh: fix emacs/vi line editor getting wrong terminal width