Force termsize back to valid in get_current_winsize()

get_current_winsize() is intended to be lazy. It does the following:

1. Gets the termsize from the kernel
2. Compares it against the current value
3. If changed, sets COLUMNS and LINES variables

Upon setting these variables, we notice that the termsize has changed
and invalidate the termsize. Thus we were doing this work multiple times
on every screen repaint.

Put back an old hack that just marked the termsize as valid at the end
of get_current_winsize().
This commit is contained in:
ridiculousfish 2019-05-13 14:05:42 -07:00
parent e22422c073
commit 277db64804

View file

@ -1843,6 +1843,10 @@ struct winsize get_current_winsize() {
// TODO: this may call us reentrantly through the environment dispatch mechanism. We need to
// rationalize this.
export_new_termsize(&termsize, vars);
// Hack: due to the dispatch the termsize may have just become invalid. Stomp it back to
// valid. What a mess.
*s_termsize.acquire() = termsize;
s_termsize_valid = true;
}
return termsize;
}