all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>,Martin Rudalics <rudalics@gmx.at>
Cc: 16475@debbugs.gnu.org
Subject: bug#16475: enhancement request: remove vertical scroll bar automatically when not needed
Date: Wed, 25 Oct 2017 15:25:40 -0700	[thread overview]
Message-ID: <m2k1zic1az.wl%esq@lawlist.com> (raw)
In-Reply-To: <8bfbddfb-237e-47b1-aed7-b28fc97d1f92@default>

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 <eliz@gnu.org>
> 
> * * *
> 
> 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?





  parent reply	other threads:[~2017-10-25 22:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-17  4:42 bug#16475: 24.3.50; enhancement request: remove vertical scroll bar automatically when not needed Drew Adams
2014-01-17 14:35 ` Stefan Monnier
2016-02-12  2:46 ` Keith David Bershatsky
2017-10-25  5:27 ` bug#16475: " Keith David Bershatsky
2017-10-25  7:47   ` martin rudalics
2017-10-25 14:40     ` Eli Zaretskii
2017-10-26  7:56       ` martin rudalics
2017-10-26 15:59         ` Eli Zaretskii
2017-10-27  8:25           ` martin rudalics
2017-10-27  2:44         ` Richard Stallman
2017-10-25 22:25 ` Keith David Bershatsky [this message]
2017-10-26 16:30   ` Eli Zaretskii
2017-10-26 16:03 ` Keith David Bershatsky
2017-10-26 17:07   ` Eli Zaretskii
2017-10-27  8:26     ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2k1zic1az.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=16475@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.