From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#16475: enhancement request: remove vertical scroll bar automatically when not needed Date: Wed, 25 Oct 2017 17:40:24 +0300 Message-ID: <83po9b8f53.fsf@gnu.org> References: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default> <59F04174.6090601@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1508942487 11720 195.159.176.226 (25 Oct 2017 14:41:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Oct 2017 14:41:27 +0000 (UTC) Cc: 16475@debbugs.gnu.org, esq@lawlist.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 25 16:41:18 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7Mrh-0000Sh-5K for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Oct 2017 16:41:05 +0200 Original-Received: from localhost ([::1]:48608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7Mro-0002Vx-LO for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Oct 2017 10:41:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7Mri-0002UN-Af for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 10:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7Mre-0002Hr-9h for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 10:41:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52990) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7Mre-0002HI-6T for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 10:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e7Mrd-0008QI-SM for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 10:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2017 14:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16475 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16475-submit@debbugs.gnu.org id=B16475.150894244732345 (code B ref 16475); Wed, 25 Oct 2017 14:41:01 +0000 Original-Received: (at 16475) by debbugs.gnu.org; 25 Oct 2017 14:40:47 +0000 Original-Received: from localhost ([127.0.0.1]:33437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7MrP-0008Pb-IK for submit@debbugs.gnu.org; Wed, 25 Oct 2017 10:40:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7MrO-0008PN-7t for 16475@debbugs.gnu.org; Wed, 25 Oct 2017 10:40:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7MrF-0001bd-0s for 16475@debbugs.gnu.org; Wed, 25 Oct 2017 10:40:41 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7MrE-0001bP-TW; Wed, 25 Oct 2017 10:40:36 -0400 Original-Received: from [176.228.60.248] (port=4878 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e7MrE-0007dF-B3; Wed, 25 Oct 2017 10:40:36 -0400 In-reply-to: <59F04174.6090601@gmx.at> (message from martin rudalics on Wed, 25 Oct 2017 09:47:00 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:138960 Archived-At: > Date: Wed, 25 Oct 2017 09:47:00 +0200 > From: martin rudalics > > > 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. It at least should be consistent about using BEGV/ZV vs BUF_BEGV/BUF_ZV. Either the code assumes that W displays the current buffer, or it doesn't. Also, I don't understand the need for this part: > else > { > (*FRAME_TERMINAL (f)->condemn_scroll_bars_hook) (f); > (*FRAME_TERMINAL (f)->judge_scroll_bars_hook) (f); > } We already call condemn_scroll_bars_hook at the beginning of a redisplay cycle, and call judge_scroll_bars_hook at its end. So why did you need to do it here again, for each window separately? More importantly, removing the scroll bar resizes the external dimensions of the frame, to keep the windows' dimensions unchanged (otherwise, we couldn't remove the scroll bars at the very end of the window's redisplay). You can see this in action if you toggle scroll-bar-mode on and off. So when the window shows _almost_ all the text of the buffer, the frame would annoyingly oscillate in its horizontal dimension. This could be caused, for example, by echo-area messages that resize the mini-window from time to time, or by the user adjusting the window size. By contrast, other applications I saw that remove the scroll bar when it is not needed leave the frame's dimensions alone, and instead leave more space for text display. That is much better, but doing this in Emacs would require to restructure the code that deals with the scroll bars, because we cannot change window dimensions after all the redisplay decisions were made, without requiring one more redisplay cycle. > 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. Actually, I think what happens with the removal of the horizontal scroll bar mirrors the vertical scroll bar, just in the other dimension. Namely, the frame's height is modified to leave the windows' dimensions unaltered. But again, this could easily cause annoying "oscillations" of the frame borders. So if we want to have this feature, it must be an opt-in, and I'd be interested how many people will like it.