When the number of text lines is less than a window height, tilde (~) lines are displayed until the bottom of the window. I want to decrease the window height just enough to display all the lines and not to show any tilde lines.
One solution is to calculate how many visible lines are required to display all. However, it is difficult because there are a lot of options to take care, such as number, wrap, foldmethod, showbreak. Other solution is to count how many tilde lines are displayed, which would be simpler.
Could you let me know how I can count the tilde lines?