From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: feature/fix-the-long-lines-display-bug 0699f80f85 1/2: Fix calculation of the vertical scroll bar's thumb Date: Tue, 19 Jul 2022 05:40:35 +0300 Message-ID: <83ilntome4.fsf@gnu.org> References: <165817757368.23995.17503819582850726768@vcs2.savannah.gnu.org> <20220718205254.2F890C0F203@vcs2.savannah.gnu.org> <87wnc9c3za.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13542"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 19 04:41:28 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDdAu-0003KP-3T for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jul 2022 04:41:28 +0200 Original-Received: from localhost ([::1]:46648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDdAs-0005Ir-SW for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Jul 2022 22:41:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDdAF-0004WA-RV for emacs-devel@gnu.org; Mon, 18 Jul 2022 22:40:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDdAF-0006qf-IL; Mon, 18 Jul 2022 22:40:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=hxxYCvSCB4CkpGJquhjw4Pal4pBt/XXmJdarBSiavq0=; b=Syt4hwHml1HJ 2g3aHeHi0LHV5kon/QX5SFw9UFgzTnb1xFzgTdYEh77Phyutp+yOuXuNjFBlchanlf5aaWpJ3Pgeq ki+QY/rUDjRl8tN79aWE3966+oci+HnczwpEKmdvOr2eJIb8uCD0xcEyYG0E6JVZRfCtUEqvP+ko3 SZ6OygNwE3LIc9HiaGM2UjRwcxXRRZ31qyv4y3hOdMkp/9N+d7aduCfEhZnVWRjspkeG0bopo6TFG GxHnlgUXOXG5S63mihuxqAT9Hc6HHH5JYLFVddWyo9wj/cwzMgUVK6616cS6m3F9q402RChb+C2bV osdaOSd4IEZwzWs/7XYq1w==; Original-Received: from [87.69.77.57] (port=3393 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDdAF-0004Kj-1b; Mon, 18 Jul 2022 22:40:47 -0400 In-Reply-To: <87wnc9c3za.fsf@yahoo.com> (message from Po Lu on Tue, 19 Jul 2022 08:59:05 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292253 Archived-At: > From: Po Lu > Cc: Eli Zaretskii > Date: Tue, 19 Jul 2022 08:59:05 +0800 > > Gregory Heytings writes: > > > branch: feature/fix-the-long-lines-display-bug > > commit 0699f80f851b1f9e2f7b0a22ddd688abb7bebde1 > > Author: Eli Zaretskii > > Commit: Gregory Heytings > > > > Fix calculation of the vertical scroll bar's thumb > > > > * src/xdisp.c (set_vertical_scroll_bar): Compute window's end > > position "by hand" if w->window_end_pos cannot be relied upon. > > --- > > src/xdisp.c | 18 +++++++++++++++++- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/src/xdisp.c b/src/xdisp.c > > index 375158a520..ae6553d876 100644 > > --- a/src/xdisp.c > > +++ b/src/xdisp.c > > @@ -18924,11 +18924,27 @@ set_vertical_scroll_bar (struct window *w) > > && NILP (echo_area_buffer[0]))) > > { > > struct buffer *buf = XBUFFER (w->contents); > > + ptrdiff_t window_end_pos = w->window_end_pos; > > + > > + /* If w->window_end_pos cannot be trusted, recompute it "the > > + hard way". */ > > + if (!w->window_end_valid) > > + { > > + struct it it; > > + struct text_pos start_pos; > > + > > + SET_TEXT_POS_FROM_MARKER (start_pos, w->start); > > + start_display (&it, w, start_pos); > > + move_it_to (&it, -1, it.last_visible_x, window_box_height (w), -1, > > + MOVE_TO_X | MOVE_TO_Y); > > + window_end_pos = BUF_Z (buf) - IT_CHARPOS (it); > > + } > > + > > whole = BUF_ZV (buf) - BUF_BEGV (buf); > > start = marker_position (w->start) - BUF_BEGV (buf); > > /* I don't think this is guaranteed to be right. For the > > moment, we'll pretend it is. */ > > - end = BUF_Z (buf) - w->window_end_pos - BUF_BEGV (buf); > > + end = BUF_Z (buf) - window_end_pos - BUF_BEGV (buf); > > > > if (end < start) > > end = start; > > When making changes of this kind, you should test without toolkit scroll > bars, and with at least both the Motif (with > scroll-bar-adjust-thumb-position both on and off) and Xaw scroll bars to > make sure they still work correctly. Testing on NS also helps, since > the scroll bar logic there is somewhat different. > > The last time I tried to significantly change the scroll bar logic (to > operate on more realistic positions within a window), those specific > configurations bit me hard. I don't have any access to such systems, sorry. If you see specific problems with that change, please tell. Otherwise, we will have to rely on people reporting bugs.