From: Po Lu <luangruo@yahoo.com>
To: emacs-devel@gnu.org
Subject: move_it_vertically_backward question
Date: Mon, 13 Dec 2021 10:47:48 +0800 [thread overview]
Message-ID: <87lf0pw78r.fsf@yahoo.com> (raw)
In-Reply-To: 87lf0pw78r.fsf.ref@yahoo.com
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.
next parent reply other threads:[~2021-12-13 2:47 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87lf0pw78r.fsf.ref@yahoo.com>
2021-12-13 2:47 ` Po Lu [this message]
2021-12-13 14:50 ` move_it_vertically_backward question Eli Zaretskii
2021-12-14 0:53 ` Po Lu
2021-12-14 12:52 ` Eli Zaretskii
2021-12-14 13:28 ` Po Lu
2021-12-14 13:45 ` Eli Zaretskii
2021-12-15 1:18 ` Po Lu
2021-12-15 3:27 ` Eli Zaretskii
2021-12-15 3:30 ` Po Lu
2021-12-15 13:27 ` Eli Zaretskii
2021-12-15 13:39 ` Po Lu
2021-12-15 2:13 ` Po Lu
2021-12-15 10:28 ` Po Lu
2021-12-15 13:56 ` Eli Zaretskii
2021-12-15 13:25 ` Eli Zaretskii
2021-12-15 13:38 ` Po Lu
2021-12-15 14:50 ` Eli Zaretskii
2021-12-16 0:41 ` Po Lu
2021-12-16 8:29 ` Eli Zaretskii
2021-12-16 9:25 ` Po Lu
2021-12-16 10:04 ` Eli Zaretskii
2021-12-16 10:27 ` Po Lu
2021-12-16 12:17 ` Po Lu
2021-12-16 13:27 ` Eli Zaretskii
2021-12-16 13:34 ` Po Lu
2021-12-16 13:59 ` Eli Zaretskii
2021-12-17 1:45 ` Po Lu
2021-12-18 10:28 ` Eli Zaretskii
2021-12-18 10:49 ` Po Lu
2021-12-18 11:03 ` Eli Zaretskii
2021-12-18 11:18 ` Po Lu
2021-12-18 11:29 ` Eli Zaretskii
2021-12-18 11:31 ` Po Lu
2021-12-18 11:35 ` Eli Zaretskii
2021-12-18 11:39 ` Po Lu
2021-12-19 0:54 ` Po Lu
2021-12-19 8:29 ` Eli Zaretskii
2021-12-19 9:16 ` Po Lu
2021-12-19 9:27 ` Eli Zaretskii
2021-12-19 10:25 ` Po Lu
2021-12-19 18:07 ` Eli Zaretskii
2021-12-20 1:05 ` Po Lu
2021-12-21 12:58 ` Po Lu
2021-12-21 17:07 ` Eli Zaretskii
2021-12-22 0:49 ` Po Lu
2021-12-22 14:59 ` Eli Zaretskii
2021-12-23 1:30 ` Po Lu
2021-12-23 9:49 ` Eli Zaretskii
2021-12-23 10:29 ` Po Lu
2021-12-23 10:39 ` Eli Zaretskii
2021-12-23 10:42 ` Po Lu
2021-12-23 10:50 ` Eli Zaretskii
2021-12-23 10:55 ` Po Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lf0pw78r.fsf@yahoo.com \
--to=luangruo@yahoo.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).