From: Eli Zaretskii Date: Fri, 1 Jan 2010 11:45:36 +0000 (-0500) Subject: Retrospective commit from 2009-10-24. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~635^2~47 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=29e3d8d1cb8920b16e70b2a19ddd8e597969b10b;p=emacs.git Retrospective commit from 2009-10-24. Continue working on set_cursor_from_row. Cleanup of resolved_level and bidi_type members of struct glyph. xdisp.c (set_cursor_from_row): Fix off-by-one error when skipping over non-character glyphs at end of a reversed row. dispextern.h (struct glyph): The `resolved_level' member needs only 5 bits, not 6. The `bidi_type' member needs only 3 bits. (bidi_type_t): Rearrange so that types that can appear in the resolved type are at the beginning and have values less than 8. bidi.c: Include setjmp.h. --- diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index 9824981c086..d4146e4c2e6 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi @@ -1,3 +1,17 @@ +2009-10-24 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Fix off-by-one error when + skipping over non-character glyphs at end of a reversed row. + + * dispextern.h (struct glyph): The `resolved_level' member needs + only 5 bits, not 6. The `bidi_type' member needs only 3 bits. + (bidi_type_t): Rearrange so that types that can appear in the + resolved type are at the beginning and have values less than 8. + +2009-10-23 Eli Zaretskii + + * bidi.c: Include setjmp.h. + 2009-10-17 Eli Zaretskii * dispextern.h (struct glyph): New members resolved_level and diff --git a/src/bidi.c b/src/bidi.c index 3a2d45cdb4d..4b239caa6f8 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -55,6 +55,8 @@ Boston, MA 02110-1301, USA. */ #include #endif +#include + #include "lisp.h" #include "buffer.h" #include "character.h" diff --git a/src/dispextern.h b/src/dispextern.h index 5f18b7f3a4a..19e3f13fd87 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -371,11 +371,14 @@ struct glyph unsigned avoid_cursor_p : 1; /* Resolved bidirection level of the characters [0..63]. */ - unsigned resolved_level : 6; + unsigned resolved_level : 5; /* Resolved bidirectional type of this character, see enum - bidi_type_t below. */ - unsigned bidi_type : 5; + bidi_type_t below. Note that according to UAX#9, only some + values (STRONG_L, STRONG_R, WEAK_AN, WEAK_EN, WEAK_BN, and + NEUTRAL_B) can appear in the resolved type, so we only reserve + space for those that can. */ + unsigned bidi_type : 3; #define FACE_ID_BITS 20 @@ -1726,25 +1729,28 @@ extern int face_change_count; /* For BIDI */ #define BIDI_MAXLEVEL 64 -/* Data type for describing the bidirectional character types. */ +/* Data type for describing the bidirectional character types. The + first 7 must be at the beginning, because they are the only values + valid in the `bidi_type' member of `struct glyph'; we only reserve + 3 bits for it, so we cannot use there values larger than 7. */ typedef enum { - UNKNOWN_BT, + UNKNOWN_BT = 0, STRONG_L, /* strong left-to-right */ STRONG_R, /* strong right-to-left */ + WEAK_EN, /* european number */ + WEAK_AN, /* arabic number */ + WEAK_BN, /* boundary neutral */ + NEUTRAL_B, /* paragraph separator */ STRONG_AL, /* arabic right-to-left letter */ LRE, /* left-to-right embedding */ LRO, /* left-to-right override */ RLE, /* right-to-left embedding */ RLO, /* right-to-left override */ PDF, /* pop directional format */ - WEAK_EN, /* european number */ WEAK_ES, /* european number separator */ WEAK_ET, /* european number terminator */ - WEAK_AN, /* arabic number */ WEAK_CS, /* common separator */ WEAK_NSM, /* non-spacing mark */ - WEAK_BN, /* boundary neutral */ - NEUTRAL_B, /* paragraph separator */ NEUTRAL_S, /* segment separator */ NEUTRAL_WS, /* whitespace */ NEUTRAL_ON /* other neutrals */ diff --git a/src/xdisp.c b/src/xdisp.c index 90f16b938c0..b44ce759870 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12520,8 +12520,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) x += g->pixel_width; cursor_x = x; while (end < glyph - && INTEGERP (end->object) - && end->charpos <= 0) + && INTEGERP ((end + 1)->object) + && (end + 1)->charpos <= 0) ++end; glyph_before = glyph + 1; glyph_after = end; @@ -20926,6 +20926,8 @@ append_glyph (it) if (it->bidi_p) { glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -20983,6 +20985,8 @@ append_composite_glyph (it) if (it->bidi_p) { glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -21162,6 +21166,8 @@ produce_image_glyph (it) if (it->bidi_p) { glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -21213,6 +21219,8 @@ append_stretch_glyph (it, object, width, height, ascent) if (it->bidi_p) { glyph->resolved_level = it->bidi_it.resolved_level; + if ((it->bidi_it.type & 7) != it->bidi_it.type) + abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area];