[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select 7928693 020/218: Fix 'window-text-pixe
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select 7928693 020/218: Fix 'window-text-pixel-size' when display properties are around |
Date: |
Fri, 14 Dec 2018 03:34:47 -0500 (EST) |
branch: feature/gnus-select
commit 792869332acddc0673b7112091dbd1db8c1beeea
Author: Eli Zaretskii <address@hidden>
Commit: Andrew G Cohen <address@hidden>
Fix 'window-text-pixel-size' when display properties are around
* src/xdisp.c (Fwindow_text_pixel_size): Correct the result when
there's a display property at the TO position, and the call to
move_it_to overshoots. (Bug#30746)
---
src/xdisp.c | 45 +++++++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 23a1065..c2b3f5d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10136,17 +10136,46 @@ include the height of both, if present, in the return
value. */)
itdata = bidi_shelve_cache ();
SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start));
start_display (&it, w, startp);
-
- if (NILP (x_limit))
- x = move_it_to (&it, end, -1, max_y, -1, MOVE_TO_POS | MOVE_TO_Y);
- else
+ /* It makes no sense to measure dimensions of region of text that
+ crosses the point where bidi reordering changes scan direction.
+ By using unidirectional movement here we at least support the use
+ case of measuring regions of text that have a uniformly R2L
+ directionality, and regions that begin and end in text of the
+ same directionality. */
+ it.bidi_p = false;
+ void *it2data = NULL;
+ struct it it2;
+ SAVE_IT (it2, it, it2data);
+
+ int move_op = MOVE_TO_POS | MOVE_TO_Y;
+ int to_x = -1;
+ if (!NILP (x_limit))
{
- it.last_visible_x = max_x;
/* Actually, we never want move_it_to stop at to_x. But to make
sure that move_it_in_display_line_to always moves far enough,
- we set it to INT_MAX and specify MOVE_TO_X. */
- x = move_it_to (&it, end, INT_MAX, max_y, -1,
- MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
+ we set to_x to INT_MAX and specify MOVE_TO_X. */
+ move_op |= MOVE_TO_X;
+ to_x = INT_MAX;
+ }
+
+ x = move_it_to (&it, end, to_x, max_y, -1, move_op);
+
+ /* We could have a display property at END, in which case asking
+ move_it_to to stop at END will overshoot and stop at position
+ after END. So we try again, stopping before END, and account for
+ the width of the last buffer position manually. */
+ if (IT_CHARPOS (it) > end)
+ {
+ end--;
+ RESTORE_IT (&it, &it2, it2data);
+ x = move_it_to (&it, end, to_x, max_y, -1, move_op);
+ /* Add the width of the thing at TO, but only if we didn't
+ overshoot it; if we did, it is already accounted for. */
+ if (IT_CHARPOS (it) == end)
+ x += it.pixel_width;
+ }
+ if (!NILP (x_limit))
+ {
/* Don't return more than X-LIMIT. */
if (x > max_x)
x = max_x;
- [Emacs-diffs] feature/gnus-select 2005a72 069/218: Avoid assertion violation under visual-order-cursor-movement, (continued)
- [Emacs-diffs] feature/gnus-select 2005a72 069/218: Avoid assertion violation under visual-order-cursor-movement, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select b405149 072/218: * src/xdisp.c (Fwindow_text_pixel_size): Fix last change., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select ea586a7 081/218: Fix problems caused by fontconfig-2.13.0, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 3b92c80 068/218: * lisp/subr.el (focus-frame, unfocus-frame): Remove obsolete no-ops., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 64c4ec0 082/218: More hydra.nixos.org logging for unfinished tests, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 066e71d 056/218: More changes in the Emacs manual, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 212e217 064/218: * lisp/loadhist.el (unload-hook-features-list): Remove obsolete alias., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 88a19e4 080/218: * lisp/desktop.el: Make use some "new" functionality, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select d27fdc5 085/218: Fix an error in tramp-archive-test42-auto-load, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e3338f2 078/218: Extend ert to print duration of single tests, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7928693 020/218: Fix 'window-text-pixel-size' when display properties are around,
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select 850e683 023/218: ; Tiny fix for recent doc change, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7a082db 022/218: Minor change in the manual, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 6e30330 041/218: Clarify that nil doesn't match itself as a cl-case clause (Bug#30749), Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select eeda1f8 015/218: Update from Gnulib, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e269430 039/218: Document the "URL" keyword in library headers, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select ecb867a 027/218: Replace uses of the obsolete local-write-file-hooks, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 9be7eb4 034/218: Quieten --without-json compilation of json-tests.el, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 496ccae 036/218: * Makefile.in (check-declare): Also check test/ directory., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e16a1e7 028/218: Replace the obsolete process-kill-without-query in documentation, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 672b68c 043/218: Let warning about (:foo) be suppressible (Bug#30499), Andrew G Cohen, 2018/12/14