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: move_it_vertically_backward question Date: Tue, 21 Dec 2021 20:58:55 +0800 Message-ID: <871r26w1v4.fsf@yahoo.com> References: <87lf0pw78r.fsf.ref@yahoo.com> <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> <83lf0g79je.fsf@gnu.org> <87mtkw5bn4.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14736"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 21 14:01:58 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 1mzemE-0003dh-RF for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Dec 2021 14:01:58 +0100 Original-Received: from localhost ([::1]:40860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzemC-0006EK-Pq for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Dec 2021 08:01:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzejV-0002fF-PF for emacs-devel@gnu.org; Tue, 21 Dec 2021 07:59:09 -0500 Original-Received: from sonic313-56.consmr.mail.ne1.yahoo.com ([66.163.185.31]:44333) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mzejS-0004E9-T6 for emacs-devel@gnu.org; Tue, 21 Dec 2021 07:59:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1640091544; bh=3WsCP3a03pvOeiP93pZTkLleO7gae4D+3SdodRFQ3EQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=XCuVu2hkz7smCsPlNXOzae/ZXnIkqFplc0kAeXuHkeeSS19IiQrlEhsdHXad1XCdx8rV/qQ7eJf+KEQoc+2LqgaBmVDH4hmlIImVkN8np+baOtN7pYgILygRPsxAAPqiyuY8ypKgDCbdWAGqWnDDN4WOB0uYl8lWYr0SjeQ+SxLzYZ/feu3eETTdroNAh+BKnYrtjRr3lD4qoYAq4HbH52WaXXhRmYIXOxVUOdpA1ZEp/hSJXkvPuNN/W8XqqXfR/is57eu1lduUgi04L5DTwUs7ZvbNk4Fh0Zpt7zLz1MW3BMlDbrirJwpfC8+v6BRoQ+koHwJ1lorN4mV5FP664Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1640091544; bh=WAZt6BqchEL199We9OhLpvxw+jVUEH7fGnHgT+8jEfm=; h=X-Sonic-MF:From:To:Subject:Date:From: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5x.62GF3jgbrDDmfEmeP20T kHVTViuErgfKiK3V1N256hSXflgL.HjzLysDjdUOV2oQfZTBgCeBRxQUGHdDfQyJZmWVxkN4SoKu KFG8oxSj.rLGN7J1notK.KfV49250Jc0mhpDlgJHqD X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Tue, 21 Dec 2021 12:59:04 +0000 Original-Received: by kubenode510.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 3f6d6ba1b517215e63f6237e3df832ca; Tue, 21 Dec 2021 12:59:01 +0000 (UTC) In-Reply-To: <87mtkw5bn4.fsf@yahoo.com> (Po Lu's message of "Mon, 20 Dec 2021 09:05:19 +0800") X-Mailer: WebService/1.1.19498 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.31; envelope-from=luangruo@yahoo.com; helo=sonic313-56.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 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:282581 Archived-At: Yahoo said this reply wasn't delivered successfully (?), so I'm sending it again. Thanks. > The last assignment should be unnecessary here: start-display always > initializes the coordinates to zero. The comment (and code) below seems to make it seem as if start_display initializes it to WINDOW_TAB_LINE_HEIGHT + WINDOW_HEADER_LINE_HEIGHT. >> + 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?). Sorry for forgetting that. I'll fix it ASAP. As for the logic, movement being negative means to move backwards from the specified buffer position, while it being positive means to move forwards. >> + 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? It should be that way, as we subtract the tab line height and header line height from that value afterwards. Thanks.