Skip to content

windows: Unexpected "beep" on window resize #771

@avih

Description

@avih

Steps to reproduce:

Run less main.c and resize/maximize/restore the window (cmd.exe window or windows terminal).

Expected behavior: the content is re-rendered to fit the new window size, and nothing more.

Actual result: the content is re-rendered correctly, but additionally there's a "ding" sound - like when reaching the top/bottom of the content.

Sometimes there's also a ding when less starts - before any resize happened.

Can you reproduce it?

I've debugged it a bit, and the issue seems to be (at least in "master") that tbuf[0] here contains the byte value -3:

less/command.c

Lines 1542 to 1553 in 14e997e

/*
* Don't use cmd_char if we're starting fresh
* at the beginning of a command, because we
* don't want to echo the command until we know
* it is a multichar command. We also don't
* want erase_char/kill_char to be treated
* as line editing characters.
*/
char tbuf[2];
tbuf[0] = c;
tbuf[1] = '\0';
action = fcmd_decode(tbuf, &extra);

and action ends up as 100, which is A_INVALID, and this ends up at the default of the command switch - which does lbell.

I didn't try to analyze where this -3 value come from.

This did not always happen. I've bisected it, and the first bad commit is b3f04c3, which is between v688 and v689.

This seems to be part of the "on resize: re-render the content for the new size" changes, and indeed most earlier commits do not re-render correctly on resize.

However, few commit before it, e.g. the prior commit 6e29456 does re-render correctly on resize - and without the beep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions