Skip to content

Add linenoiseResize#252

Open
adsr wants to merge 1 commit intoantirez:masterfrom
adsr:async-resize
Open

Add linenoiseResize#252
adsr wants to merge 1 commit intoantirez:masterfrom
adsr:async-resize

Conversation

@adsr
Copy link
Copy Markdown

@adsr adsr commented Apr 4, 2026

Currently if the terminal is resized in the middle of a line edit, then cols goes stale and the output is garbled.

In regular mode, the only way to detect this would be to query terminal size after every input (bad), or to install a signal handler for SIGWINCH (bigger change).

In async mode, the caller can install their own signal handler, but has no way to tell the library to refetch terminal size. This function allows the caller to do that.

To demo this, add --async-resize flag to the example program.

Also replace tabs in example.c with spaces. Previously it was mixed.

Currently if the terminal is resized in the middle of a line edit,
then `cols` goes stale and the output is garbled.

In regular mode, the only way to detect this would be to query
terminal size after every input (bad), or to install a signal handler
for `SIGWINCH` (bigger change).

In async mode, the caller can install their own signal handler, but
has no way to tell the library to refetch terminal size. This
function allows the caller to do that.

To demo this, add `--async-resize` flag to the example program.

Also replace tabs in example.c with spaces. Previously it was mixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant