Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Feature request 16475.
/* *************************************************************************** */
/* BEGIN Feature Request # 16475: Automatically add/remove scroll bars. */
finish_scroll_bars:
;
// 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);
if (!window_contents_visible_p)
w->vertical_scroll_bar_type = Qright;
if (!window_contents_visible_p
&& (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
|| WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w)))
{
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);
}
else if (!MINI_WINDOW_P (w)
&& !NILP (w->vertical_scroll_bar_type))
{
w->vertical_scroll_bar_type = Qnil;
clear_glyph_matrix (w->desired_matrix);
SET_FRAME_GARBAGED (f);
}
/* END Feature Request # 16475: Automatically add/remove scroll bars. */
/* *************************************************************************** */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.