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: move_it_vertically_backward question Date: Sun, 19 Dec 2021 20:07:49 +0200 Message-ID: <83lf0g79je.fsf@gnu.org> References: <87lf0pw78r.fsf.ref@yahoo.com> <837dc7l2pa.fsf@gnu.org> <87ilvqty24.fsf@yahoo.com> <8335muj8zk.fsf@gnu.org> <87h7bang3d.fsf@yahoo.com> <83mtl1j527.fsf@gnu.org> <87zgp1mldh.fsf@yahoo.com> <83tuf9gdg5.fsf@gnu.org> <87pmpwkikp.fsf@yahoo.com> <83mtl0hnm5.fsf@gnu.org> <87czlwkfpk.fsf@yahoo.com> <8735mskal2.fsf@yahoo.com> <83ee6che8h.fsf@gnu.org> <87y24kisgf.fsf@yahoo.com> <838rwkhcqb.fsf@gnu.org> <87r1achulq.fsf@yahoo.com> <83pmpub41v.fsf@gnu.org> <87pmptbeii.fsf@yahoo.com> <8335mp9evn.fsf@gnu.org> <877dc19cpc.fsf@yahoo.com> <83zgox7xmf.fsf@gnu.org> <87ilvk99j0.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8312"; 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 Sun Dec 19 19:08:53 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 1mz0c9-00021K-0y for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Dec 2021 19:08:53 +0100 Original-Received: from localhost ([::1]:41230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mz0c7-00016L-3C for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Dec 2021 13:08:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mz0bG-0000Ro-Ni for emacs-devel@gnu.org; Sun, 19 Dec 2021 13:07:58 -0500 Original-Received: from [2001:470:142:3::e] (port=41962 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 1mz0bG-0004tr-9Y; Sun, 19 Dec 2021 13:07:58 -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=StKP5KLY7sbcluv00LwuHfS8OYpRDxdoImB7VcnQfyY=; b=lm+A7DYdeXr1 Hnc/CsC2+JUCQ14399iT8+U0K18gmgkQr9mcJZw4jrROp1N+wnJ9I4C5/6EsG93LaB7DZ+byXoIiN n9+IrBCB3V0B1pK8t2Y1uAs5RsS61RnwhZiDQxvYOdMAI2PFby7YeQHo9mlbunvgym3q+eEJkVqhh r9Qh+dW0x0T8h3V3th9LN00m6lXMKFIqkq96DX7lzVqR07Lbq2b3saF9vYVY8x49Lmoeh+OySH+BJ E8dY571m6NfmY6NoGwo5dHQNY2pTeGH4HduTjUUAQ66n06sWBINwj9ok2GlqzIaP5CGRQHoUpVCaK ONtkW87pRzxmy7EOsE1KTg==; Original-Received: from [87.69.77.57] (port=3984 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 1mz0bG-0006Zi-1n; Sun, 19 Dec 2021 13:07:58 -0500 In-Reply-To: <87ilvk99j0.fsf@yahoo.com> (message from Po Lu on Sun, 19 Dec 2021 18:25:07 +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:282463 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Sun, 19 Dec 2021 18:25:07 +0800 > > + if (movement != 0) > + { > + int last_y; > + it.current_y = 0; The last assignment should be unnecessary here: start-display always initializes the coordinates to zero. > + if (movement < 0) > + { > + while (it.current_y > movement) > + { > + last_y = it.current_y; > + move_it_vertically_backward (&it, > + abs (movement) + it.current_y); > + > + if (it.current_y == last_y) > + break; > + } > + } > + else > + { > + move_it_vertically (&it, movement); > + } I don't understand the different logic depending on the sign of 'movement' (and didn't we agree to use a better name for it?). > + it.current_y = (WINDOW_TAB_LINE_HEIGHT (w) > + + WINDOW_HEADER_LINE_HEIGHT (w)); > + start = clip_to_bounds (BEGV, IT_CHARPOS (it), ZV); > + start_y = it.current_y; > + } > + else > + { > + /* Start at the beginning of the line containing FROM. Otherwise > + IT.current_x will be incorrectly set to zero at some arbitrary > + non-zero X coordinate. */ > + reseat_at_previous_visible_line_start (&it); > + it.current_x = it.hpos = 0; > + if (IT_CHARPOS (it) != start) > + move_it_to (&it, start, -1, -1, -1, MOVE_TO_POS); > + } And here: why a different initial value for it.current_y, depending on how FROM was specified? (Again, I didn't yet pay attention to the documentation.) Thanks.