From: Eli Zaretskii <eliz@gnu.org>
To: Ari Roponen <ari.roponen@gmail.com>
Cc: 11464@debbugs.gnu.org, mwd@cert.org
Subject: bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text
Date: Sat, 19 May 2012 15:26:24 +0300 [thread overview]
Message-ID: <83k408z79r.fsf@gnu.org> (raw)
In-Reply-To: <8762btimdw.fsf@gmail.com>
> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
> RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2
> From: Ari Roponen <ari.roponen@gmail.com>
> Cc: mwd@cert.org, 11464@debbugs.gnu.org
> Date: Fri, 18 May 2012 17:39:39 +0300
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Thanks. This is consistent with top_y and bottom_y, but leaves open
> > the question why move_it_to didn't advance one more line. I will try
> > to reproduce this on my system before I bother you with more
> > questions.
>
> In case it helps, I found out this:
>
> Using emacs-24 rev. 107994 (your original patch):
>
> ./emacs -Q -fn "DejaVu Sans Mono-10" -l bug.el
> => "Should be nil: nil"
>
> ./emacs -Q -fn "DejaVu Sans Mono-12" -l bug.el
> => "Should be nil: t"
>
> In both cases, the latin letters use the given font, and the Hebrew
> letters are displayed with corresponding "Arimo" font:
>
> xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-16-*-*-*-m-0-iso10646-1 (#x44)
> xft:-unknown-Arimo-normal-normal-normal-*-16-*-*-*-*-0-iso10646-1 (#x9BD)
I couldn't find an Arimo font that supports Hebrew. However, I found
several fonts already installed on my system with which I could
reproduce all of your 3 cases.
It turned out there was a subtle misfeature in move_it_to, which
pos_visible_p calls, that would produce a situation where bottom_y
computed in pos_visible_p could be less that it.last_visible_y. That
misfeature caused the computation of bottom_y produce inaccurate
result. By fixing that misfeature (see below), I was able to revert
the comparison against bottom_y to what it originally was, and get
correct results from pos_visible_p in all the cases I tried.
In general, if move_it_to stops at the bottom of the window, the last
line's bottom_y cannot be less than last_visible_y, because that means
there's one more line (partially) visible in the window. So the
comparison I originally installed is the correct one.
I installed the patch below as revision 108008 on the emacs-24
branch. Please test.
Ari and Michael, many thanks for your help in working on this tricky
problem.
=== modified file 'src/ChangeLog'
--- src/ChangeLog 2012-05-15 16:17:42 +0000
+++ src/ChangeLog 2012-05-19 12:14:11 +0000
@@ -1,3 +1,13 @@
+2012-05-19 Eli Zaretskii <eliz@gnu.org>
+
+ * xdisp.c (move_it_to): Under MOVE_TO_Y, when restoring iterator
+ state after an additional call to move_it_in_display_line_to, keep
+ the values of it->max_ascent and it->max_descent found for the
+ entire line.
+ (pos_visible_p): Revert the comparison against bottom_y to what it
+ was in revid eliz@gnu.org-20120513182235-4p6386j761ld0nwb.
+ (Bug#11464)
+
2012-05-15 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (pos_visible_p): Fix last change. (Bug#11464)
=== modified file 'src/xdisp.c'
--- src/xdisp.c 2012-05-15 16:17:42 +0000
+++ src/xdisp.c 2012-05-19 12:14:11 +0000
@@ -1313,7 +1313,7 @@ pos_visible_p (struct window *w, EMACS_I
visible_p = bottom_y > window_top_y;
else if (top_y < it.last_visible_y)
visible_p = 1;
- if (bottom_y <= it.last_visible_y
+ if (bottom_y >= it.last_visible_y
&& it.bidi_p && it.bidi_it.scan_dir == -1
&& IT_CHARPOS (it) < charpos)
{
@@ -8689,8 +8689,18 @@ move_it_to (struct it *it, EMACS_INT to_
{
/* If TO_Y is in this line and TO_X was reached
above, we scanned too far. We have to restore
- IT's settings to the ones before skipping. */
+ IT's settings to the ones before skipping. But
+ keep the more accurate values of max_ascent and
+ max_descent we've found while skipping the rest
+ of the line, for the sake of callers, such as
+ pos_visible_p, that need to know the line
+ height. */
+ int max_ascent = it->max_ascent;
+ int max_descent = it->max_descent;
+
RESTORE_IT (it, &it_backup, backup_data);
+ it->max_ascent = max_ascent;
+ it->max_descent = max_descent;
reached = 6;
}
else
next prev parent reply other threads:[~2012-05-19 12:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-13 15:54 bug#11464: 24.1.50; pos-visible-in-window-p returns a false positive with bidi text Ari Roponen
2012-05-13 18:26 ` Eli Zaretskii
2012-05-15 10:07 ` Ari Roponen
2012-05-15 16:19 ` Eli Zaretskii
2012-05-16 5:21 ` Ari Roponen
2012-05-16 15:15 ` Eli Zaretskii
2012-05-17 4:52 ` Ari Roponen
2012-05-17 16:23 ` Eli Zaretskii
2012-05-17 17:54 ` Ari Roponen
2012-05-17 17:56 ` Michael Welsh Duggan
2012-05-17 21:11 ` Eli Zaretskii
2012-05-17 21:22 ` Michael Welsh Duggan
2012-05-18 7:42 ` Eli Zaretskii
2012-05-18 8:03 ` Ari Roponen
2012-05-18 8:26 ` Ari Roponen
2012-05-18 8:44 ` Eli Zaretskii
2012-05-18 10:47 ` Ari Roponen
2012-05-18 11:32 ` Eli Zaretskii
2012-05-18 11:47 ` Ari Roponen
2012-05-18 14:02 ` Eli Zaretskii
2012-05-18 14:39 ` Ari Roponen
2012-05-18 14:59 ` Eli Zaretskii
2012-05-19 12:26 ` Eli Zaretskii [this message]
2012-05-19 12:32 ` Ari Roponen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83k408z79r.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=11464@debbugs.gnu.org \
--cc=ari.roponen@gmail.com \
--cc=mwd@cert.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.