From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu 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 08:59:05 +0800 Message-ID: <87wnc9c3za.fsf@yahoo.com> References: <165817757368.23995.17503819582850726768@vcs2.savannah.gnu.org> <20220718205254.2F890C0F203@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36394"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Eli Zaretskii To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 19 02:59:58 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 1oDbaf-0009JZ-MO for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jul 2022 02:59:57 +0200 Original-Received: from localhost ([::1]:52602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDbae-0006lU-LG for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Jul 2022 20:59:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDba5-00064L-11 for emacs-devel@gnu.org; Mon, 18 Jul 2022 20:59:21 -0400 Original-Received: from sonic303-22.consmr.mail.ne1.yahoo.com ([66.163.188.148]:38875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDba3-0006AB-Eo for emacs-devel@gnu.org; Mon, 18 Jul 2022 20:59:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1658192357; bh=sb1rigup7GNWXDO73pqwy/K/GK6kBc3uIeFO+OhOEic=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=PSwfw+F20LvsTbFNY9U2FnYgUWMR36C3DKB91evltAIjkg26bjaCbbAg+vGLERncoGgw8svW5Z5jIb6HTtCaoFs6QokptZL7pDBRSTVyrtjQ8eORDVO1N8HW3zo8K6gw2e2VGhPUgWvO7ceVrYc7ShQWSzTNiJWRv99uihABEwcoYc+zcgfik7RMFrQRDnsUMe20N8CLQkC9yq3thnSAuvF36yFWLfFUXItRkoQ/p6zNjHCxnApRAgApRJpoBfpUeCtMdgTJP/CNIJfo3AIdnKTiMpFsw0MwOHgZN3orCBMFR7tWvYvrcB6CoLhkHiJ3u3ohn4LxNrb25WsQtF+Agg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1658192357; bh=tOyT7YtZWuqB88Y7oicihQeOpsOA9Ec0boHCaNEWHo5=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=CLYdVLNeFc61SUEArprxbJotIom0OWSRd/He8bRrMhG9nFDcnBLNNcevwZSNHDWAVXva+3a1UTiD2XDquCp98bEN7qEO9w4HEBnoe92229LE6IiC9JyoF2yVfdOUQ+ggqMVicvNBcTM2IuImnVYCgYjatyWuC1TGibAwfCQ8HlWi8WXYIE3xHaHaU1BVP8bnQET41BxUHB+40wKJDwH4UASvk3v0PocaT+uoVnXPQ2sISBdHEpt+oJd9DLKRQ+TzHoVE8uMwTDASX18yIYvCq2QYcs4J491wI0JEqHJN3aZqam3c6eIXCg4ewAcXJMCBOE9J/IE3gUl4vaUh6Exx6Q== X-YMail-OSG: AzXbd_EVM1mVCUup2W2ETTLhauFg20Cw1OQWwbVrjY19H_dj6EDWbM6CJMDmu.G TIwmErEP0_XbhFuYu__iMcC6h6muiFBjYBjlGY4Cc5RrrGfTL.62MxVcqcIKdZ.cmsaAxRAtE8qM Bup5g_ROLzPl7WYhBsvuBTi_5zLR6aOGxUz7o0qTiEOe9KW_I3lAc7BRUO8pP_F3V1i8T39NsXwV TGzjcigeBaenlSN5mgnroDHjW9JQ4itJZB.HYfTd1vYDqxBtvyCZtEQI5bp61CuowsvWiy48yKWs ZsHy3Lzv0K_ZfxcBLZkFc4YgQDgSNfqG9ssOOdVFSpGpDOqrgMiG9zg2c0IpH_Ado3v4Svy0hJcW BHUeZQUr73ecLADTWFQrimy3wkKI6qWjroHJnzLLdDYlALBCnzntL2BqIQE0d9_kukAPmdAIzD_U YYvu4FeEBkC_E97H0uQhej20uyohxEIO6lQkx7Ru5Jg18DekxRufMwYvsjhbAKFSXlchUGhUqzTF QMxH50xslG8MUXHSqBV2U1cKLknvLwCkX0kuZkco.G5nYK5qOspGIMhbwWji2VnIyvKlb8_iCpms PW0oNbbm99BuWme8ze1U4mRVndmJJcN928TMGbl7MYE2WNpLvPGR85IBu9K1aj9uDwjipY_5US.E .jdXx_u5d7sl.BL808jH4Bw1i_ZLoV1WuVGkv2lFTrGgsb0UuHiLFqfgaDnRhKo6A7tefU__ZTkH 3x.KngnkXQMQiWINc1LaStXujSWrMEVGDw8WPG8Jv8YobghXLOtksscJioNQAzx3u3Y.F2YL5xoW brK9oQ2w_p8ed2hQJihNV4GU_sMpEJzf0a1.ai__wx X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Tue, 19 Jul 2022 00:59:17 +0000 Original-Received: by hermes--canary-production-sg3-67975bbd4b-5klrh (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID fe623bfc791e0f4d862dce29d6e2b5ef; Tue, 19 Jul 2022 00:59:11 +0000 (UTC) In-Reply-To: <20220718205254.2F890C0F203@vcs2.savannah.gnu.org> (Gregory Heytings's message of "Mon, 18 Jul 2022 16:52:54 -0400 (EDT)") X-Mailer: WebService/1.1.20407 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.188.148; envelope-from=luangruo@yahoo.com; helo=sonic303-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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:292250 Archived-At: 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.