From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#16475: enhancement request: remove vertical scroll bar automatically when not needed Date: Wed, 25 Oct 2017 15:25:40 -0700 Message-ID: References: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1508970383 26119 195.159.176.226 (25 Oct 2017 22:26:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 25 Oct 2017 22:26:23 +0000 (UTC) Cc: 16475@debbugs.gnu.org To: Eli Zaretskii ,Martin Rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 26 00:26:19 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 1e7U7j-0004hm-AA for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Oct 2017 00:26:08 +0200 Original-Received: from localhost ([::1]:50223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7U7p-0004KG-8a for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Oct 2017 18:26:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7U7i-0004Iw-8t for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 18:26:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7U7e-0004xd-RV for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 18:26:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7U7e-0004xG-CK for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 18:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e7U7e-0006yL-2m for bug-gnu-emacs@gnu.org; Wed, 25 Oct 2017 18:26:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default> Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Oct 2017 22:26:02 +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.150897034426775 (code B ref 16475); Wed, 25 Oct 2017 22:26:02 +0000 Original-Received: (at 16475) by debbugs.gnu.org; 25 Oct 2017 22:25:44 +0000 Original-Received: from localhost ([127.0.0.1]:33726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7U7M-0006xn-BX for submit@debbugs.gnu.org; Wed, 25 Oct 2017 18:25:44 -0400 Original-Received: from gateway22.websitewelcome.com ([192.185.47.144]:19959) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e7U7K-0006xf-BY for 16475@debbugs.gnu.org; Wed, 25 Oct 2017 18:25:42 -0400 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 800BC11C68 for <16475@debbugs.gnu.org>; Wed, 25 Oct 2017 17:25:41 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id 7U7JenpdZRtUX7U7Je18gp; Wed, 25 Oct 2017 17:25:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Y/aQyingdB8OWFZ+BFNmElmeQlYdie9592bmLwRzFnQ=; b=DESH/A5z1nvIrdKUXqEHenfXJb HLBoGywoS6dNdmUFRoFWDoReV+EpBp11iuWb0KzWBzPZDTLviB5Nd5ZgRlbK4g7UxZbcADQb4KJc8 aUdK0ELj5UvE+LL8MSnro2lyDo/98lOtvqCSYo3C4Z/IrkKUaFmAJKOTJjGPTFld2hakC9veRqPtP NqqxYkyBR9jpyG5QxyK9CZCYbXOpzsoA7ff71YqVU1HHKXVvCJA81RLUuvOdmzfWNB0jWnemgxz8R W94vfb7aaeHmizXSqAbctZzm93AisiG09SKBvauUHR3TAwYpKscLE2xR+jNSOifPr5Qz5Nc23L+nS zIQAAIaQ==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50446 helo=server.private) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1e7U7I-0034wJ-Ne; Wed, 25 Oct 2017 17:25:40 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1e7U7I-0034wJ-Ne X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.private) [45.48.239.195]:50446 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes 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:138984 Archived-At: Thank you, Eli and Martin: I have incorporated the comment of Eli about being consistent by using BEGV/ZV vs BUF_BEGV/BUF_ZV. I have created a second draft based (in part) on the comment of Martin: "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." The visibility test for the beginning/ending points can be added in future drafts. Scroll bars are not immediately removed, however, when `window_contents_visible_p` is true and this-command is a keyboard stroke. I encountered the same problem with the first draft, and that is why I looked for a means to force immediate removal of the scroll bars by using the condemn/judge combination. Subsequently using the mouse scroll wheel *does* trigger scroll bar removal. Any ideas on how to immediately remove scroll bars from the target window when `window_contents_visible_p` is true? [I have chosen the end of `redisplay_window` to perform the test because window start/end *should be* accurate at that location of the code.] ptrdiff_t bob_disregard_narrow = BUF_BEG (buffer); ptrdiff_t eob_disregard_narrow = BUF_Z (buffer); ptrdiff_t bob_respect_narrow = BUF_BEGV (buffer); ptrdiff_t eob_respect_narrow = BUF_ZV (buffer); ptrdiff_t window_start = marker_position (w->start); ptrdiff_t window_end = eob_disregard_narrow - w->window_end_pos; ptrdiff_t buffer_size = eob_disregard_narrow - bob_disregard_narrow; bool buffer_narrowed_p = (eob_respect_narrow - bob_respect_narrow != buffer_size); bool window_contents_visible_p = (bob_respect_narrow == window_start && eob_respect_narrow == window_end); finish_scroll_bars: if ((WINDOW_HAS_VERTICAL_SCROLL_BAR (w) || WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w)) && !window_contents_visible_p) { if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) /* Set the thumb's position and size. */ set_vertical_scroll_bar (w); if (WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w)) /* Set the thumb's position and size. */ set_horizontal_scroll_bar (w); /* Note that we actually used the scroll bar attached to this window, so it shouldn't be deleted at the end of redisplay. */ if (FRAME_TERMINAL (f)->redeem_scroll_bar_hook) (*FRAME_TERMINAL (f)->redeem_scroll_bar_hook) (w); } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATE: [10-25-2017 07:40:24] <25 Oct 2017 17:40:24 +0300> FROM: Eli Zaretskii > > * * * > > 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?