Subject: Re: bug#16475: enhancement request: remove vertical scroll bar automatically when not needed

From: martin rudalics <[email-masked]>
Date: Wed, 25 Oct 2017 09:47:00 +0200

> Here is a first draft with a simple test (modifying xdisp.c), which
 > probably nukes more than just the selected window's scroll bars when
 > removing them, but it may be sufficient to revive this enhancement
 > request in the event anyone is interested.

Thanks for looking into this.  The test for the vertical scroll bar case
is whether the buffer beginning and its end are both visible in the
window, taking into account visibility, overlays and the like.  I'm not
sure whether

         && ZV - BEGV > BUF_Z (XBUFFER (w->contents)) - w->window_end_pos - marker_position (w->start))

can handle that.

Auto-removal of horizontal scroll bars is more complicated.  Basically,
we could remove the horizontal scroll bar when no line in the window had
to be truncated.  But then we have space to display the next buffer line
and that line could be awfully long.  So some lookahead is needed which
will consume processing time.  Obviously, we could just use the check
whether the entire buffer is visible as for the vertical case but that's
not what other applications usually do.

Also, the state of a window is usually reflected in its variables and
parameters.  The question with auto-removal of scroll bars is how we
reflect a new state in functions like ‘window-scroll-bars’ and
‘set-window-scroll-bars’.

Personally I never cared much about this auto-removal because when space
to display things is scarce, usually a buffer cannot be displayed in its
entirety and scroll bars are needed.  When space abandons I don't mind a
scroll bar being present anyway.  But since most applications usually
remove scroll bars when they are not needed we should probably conform.

Thanks again, martin