Add a 'wait-for-mapped' option
--wait-for-mapped command line and configuration option. When used, defer spawning the client application until the window has been mapped.
This ensures the client application sees the final window size immediately.
I.e. this is a workaround for buggy applications that don't use
@craigbarnes I don't have any code pointers, if that's what you're asking for. I was perhaps expressing myself somewhat sloppy; my guess is applications that exhibit sizing issuing (like described in #723) are racy, and request the initial size before registering their
SIGWINCH handler. But it's just a guess.
Others purposely ignores some of the initial resize events, like neovim (https://github.com/neovim/neovim/issues/11330)
I don't usually start applications directly in a new terminal window, and thus I don't really notice these issues. With that said, I have seen it it neovim and top (not htop).
... my guess is applications that exhibit sizing issuing (like described in #723) are racy, and request the initial size before registering their SIGWINCH handler.
Ah yeah, that makes sense. I was trying to imagine what kind of patterns might cause/worsen the problem, but my brain was running on empty when I asked the question.
I looked at the
SIGWINCH handler in
ncmpcpp and even a quick glance shows some other issues:
- It uses the obsolete (and basically broken; in the context of POSIX)
signal()function instead of
- It uses
volatile boolinstead of
volatile sig_atomic_t, which kind of defeats the point of that approach to signal handling
I also looked at the vim signal handling code briefly, but it's harder to figure out exactly what's happening in that case, since it's such a sprawling codebase, with
Possibly relevant issues:
Oh my - I've been running into this race for years :) I encounter it with some curses-like programs such as vim and neomutt. It's gotten to the point that I have shortcuts that spawn those programs in a terminal like:
foot bash -c "sleep 0.1; exec vim Documents/TODO.txt"
A flag to do this waiting for me would be absolutely wonderful.
Deleting a branch is permanent. It CANNOT be undone. Continue?