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: move_it_vertically_backward question Date: Mon, 13 Dec 2021 10:47:48 +0800 Message-ID: <87lf0pw78r.fsf@yahoo.com> References: <87lf0pw78r.fsf.ref@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="4977"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 13 03:49: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 1mwbP8-00019Y-8m for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Dec 2021 03:49:30 +0100 Original-Received: from localhost ([::1]:33744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwbP6-0006yq-FH for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Dec 2021 21:49:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwbNl-0005cn-9b for emacs-devel@gnu.org; Sun, 12 Dec 2021 21:48:06 -0500 Original-Received: from sonic311-25.consmr.mail.ne1.yahoo.com ([66.163.188.206]:43597) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwbNi-0003QN-1v for emacs-devel@gnu.org; Sun, 12 Dec 2021 21:48:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1639363679; bh=emzMQysArmoswFb5cJy+4aF7ZcTKZ5HKojPFXwrDID0=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=jEkMjH7FLIsot9YGW8Aw/k1G1rrvzMycb1C5KSz3RJ+jDB02GlQrAFiMKOX6ryZphWt4+hYxXD9SK0n5u86RdCVZHramfKdCN/2TWMgtVt44HwAHdwQHVHLEBei+YOrnuiFWcgijnT15MYQVu0J8DnVU/w1qN+RH5s6e/FdSf4h7otz5UPE/kcB3HVlQGkvmIK+Hg1lY7xW12zTIZ8CmJN8PeORqz9DhcOz1I8LO5WFfa2Ow+sMfM6Z0p0TS9B/kN4MmrhrmnqWCZz5LzWYwBQi3OTKApXSTU+XXg9/FTMvOD3YtDCizO4DWtdO9ggzhv67YFAtk/Xp6qUJLONcQ9w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1639363679; bh=0oL3bX14svegdIzYjYqBoOWZpswcIPIpCpOM5HixZqu=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=En7S9WfyKVM7M9Pc142Zh9bMonS7ug7BB7B4XZkCkSKmfrZu4xN0M/OnrszgOi3nfgLSgvDOlvO1+bxwGNuvyJ5Pwb2K//X4DkGBIyMGUKTY8uA4L0eI8KHLWwxd4FLHC0ZrWnZdYKpmdkB0nuowX36X4k5g6yGeJ2TRaBlQ1apAE7H/2h+mYmg3bj1hFC4Yt0gEmqRXACsbJXh0qe+AA90fCmcZjeYI3gd756oFBfdPLAufcu7x/dUaX0PN6gW37B8L7GNAgxDx+Tdp/h41GbHXEOvQH4qEUVbRB8XHjbd0limMBABXkchqe+DS2XowzSwNN664nneV/+UVtiod1Q== X-YMail-OSG: HrB6sbkVM1nXj7IAfYtKckiX0cZwg4U0HlQEYr92bLBec1x3X3woGPAEHYqr59W R66Z79QIUAlEaL4f3RO2YHJEUNdVsd.D25KUblp0l2XdM_r5r_soRTPWHjbXFiT0v2Vz0IGVLjrZ hwuWx7.DYCD8zk7IZ5tHE2E2NsmOG8JAgz5hi4JRxEY2PRuy3aGUjjfTM3Q8cl9EGkoSGLChi7oV 0u__3yuquDuxeE8Qafjs7Tu83HS2vItgNd5qRNOwza2YVFyAliz7qfcskW9aVHbZEB3g5uWicZxn y7Q_k.7BArY9ETF5ThrU6DqaD11hWRYEIJiyJE_wUudCDZ8ewWWdLoIYxgW02PtYLuI6xA2bfdAR u2midDYFedtHGpKVDqRepyN98PmTkf5TgcHuHQFo79u3tYwNSfgHVTQT86lMU7NTzigM2rkpN3vb htaQqDvM.oxLv6k01mIzfpdQhmbaZzvhtGGneK0hXxWjkQPILLUbYFSnzXc3PJqfbVKrR_ewrCPM 84aLNmFfKmD4JWqh0j2oY9L8tkZsyisl77wpdy7mCkiQs19mGrDasv3xGTBTovPmf0M1GmfaYnfD xvvdfUiE9pDhOSzzNQ4FeQ6ZxKrYFJGMcONfIKQoIEFv3XIX9P1FXE7qTaNdxok1yJfmv9BwBJhx At.wkM_6BKZrC48PqEwnPF2EPXjDUbrO9pSfex1PJ._w4MF3oBz.t2gXlZIhFwj.x0xIt0LYAVR3 5a4Zc5sKe1tKq.AXt0kI5.V.kPCAVdqMRROF_l6AriYUf4LF.o8gN4oe08IE_BggUsosAvDCEg6B 5kTw9vkVXiIU_a_monisUbTOQyLoWu2FdFp8W45kJa X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Mon, 13 Dec 2021 02:47:59 +0000 Original-Received: by kubenode503.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID d045ad812b165c851a873f1c5ef9fea0; Mon, 13 Dec 2021 02:47:54 +0000 (UTC) X-Mailer: WebService/1.1.19415 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.188.206; envelope-from=luangruo@yahoo.com; helo=sonic311-25.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=ham 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:281814 Archived-At: I've been trying to introduce a new redisplay primitive to speed up precision pixel scrolling, but I don't understand the behaviour of move_it_vertically_backward. According to the comment, it will move IT backwards by at least as many pixels as DY, but that's not how it seems to behave, at least in the primitive I'm trying to implement. DEFUN ("point-and-pixel-height-of-unseen-line-above", Fpoint_and_pixel_height_of_unseen_line_above, Spoint_and_pixel_height_of_unseen_line_above, 1, 1, 0, doc: /* Find a visual line at least PIXELS above window start. Return the dimensions of the line as a cons of the buffer position of the start of the line, and the vertical distance in pixels between that line and the start of the window. */) (Lisp_Object pixels) { int pix; struct it it; struct text_pos pt; struct window *w; struct buffer *old_buffer = NULL; Lisp_Object result; CHECK_FIXNAT (pixels); pix = XFIXNAT (pixels); w = XWINDOW (selected_window); if (XBUFFER (w->contents) != current_buffer) { old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (w->contents)); } SET_TEXT_POS_FROM_MARKER (pt, w->start); void *itdata = bidi_shelve_cache (); start_display (&it, w, pt); it.vpos = it.current_y = 0; last_height = 0; move_it_by_lines (&it, 0); move_it_vertically_backward (&it, pix); result = Fcons (make_fixnum (IT_CHARPOS (it)), make_fixnum (-it.current_y)); if (old_buffer) set_buffer_internal_1 (old_buffer); bidi_unshelve_cache (itdata, false); return result; } If there are 3 lines above window start, all of which are 17 pixels tall, calling this new primitive with PIXELS anything between 18 and 33 will result in the start and height of the first line being returned, while I would have expected it to move onto the second line, as anything between 18 and 33 pixels above window start should be inside the second line. Ideas? Thanks in advance.