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: Redisplay resets vscroll when window start changes Date: Mon, 15 Nov 2021 16:18:16 +0200 Message-ID: <83r1bhsdsn.fsf@gnu.org> References: <87k0h9pp7t.fsf.ref@yahoo.com> <87k0h9pp7t.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17864"; 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 Mon Nov 15 15:19:31 2021 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 1mmcpX-0004Qp-Fi for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 15:19:31 +0100 Original-Received: from localhost ([::1]:34340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmcpW-0005uf-3D for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 09:19:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmcoV-0004Xg-Qj for emacs-devel@gnu.org; Mon, 15 Nov 2021 09:18:27 -0500 Original-Received: from [2001:470:142:3::e] (port=36290 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmcoV-0002WO-IV; Mon, 15 Nov 2021 09:18:27 -0500 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=W+L3zY1TKOPM1w9p3r0mfdbBf8CDfVoVwWkQeyzurFc=; b=SR7lMx/GWl1V 7Qu6/lDbCjfNvtnxnxv212a0NZWK85giWabnQLlGVt6QcoalpkUeKv6QIUxQ3eGcEJI5WRcsIgx7s +IxJEOt+6xa8zo4la8lIlSMLIUXO2U93MUKiupGm/wTJnKCRIU8nCXu+YBDhaNTweN43eWegrXcyL LxVCMByuS3XwS4Hy4jzPgPmA0wKeFWsVyujRe08Y86qXIdBkufIiksoHN79gwnDPa5PIsK6dT9cbY IAWbp9LFHHHNHG2dSE4JCtZAFR4JdifX3T0ZY5+EbhIzql+yfyo2mwSuTxqMV3JF3hE23CGcZrKCG sWbsbE/G2AXb1XCer/XhjQ==; Original-Received: from [87.69.77.57] (port=3606 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 1mmcoV-0001ID-4g; Mon, 15 Nov 2021 09:18:27 -0500 In-Reply-To: <87k0h9pp7t.fsf@yahoo.com> (message from Po Lu on Mon, 15 Nov 2021 20:39:50 +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:279505 Archived-At: > From: Po Lu > Date: Mon, 15 Nov 2021 20:39:50 +0800 > > I was implementing pixel-based scrolling based on XInput 2 pixel scroll > events earlier, and i noticed this line in xdisp.c: > > /* Handle case where place to start displaying has been specified, > unless the specified location is outside the accessible range. */ > if (w->force_start) > { > /* We set this later on if we have to adjust point. */ > int new_vpos = -1; > > w->force_start = false; > --> w->vscroll = 0; > w->window_end_valid = false; > > It resets the vscroll whenever window start changes, which is annoying > if you, for example, recenter the window during pixel scroll. Yes. This is the basis of how scrolling commands work in Emacs: they set the window-start point. When that happens, vscroll must be reset. > Is it OK to control whether or not the vscroll is reset there based on a > variable or a window parameter? It would be very convenient to have > such a feature. That'd open a Pandora box of endless hacks and bug reports, so I'd prefer not to allow that. It is not how the present display code was designed. Forcing window-start and setting vscroll contradict each other, because forcing window-start means we want the user to see the stuff at that buffer position. Are you using scroll commands to implement this? If so, don't: they are not the right way of having pixel-wise scrolling in Emacs. Instead, scroll the display by controlling the non-zero vscroll, without forcing window-start.