# HG changeset patch # User Eli Zaretskii # Date 1262346336 18000 # Node ID 23f8a579b56eba26005aafd07c8e1742f8d7df6e # Parent 4bad2c6338cc181dd9ca1e8c7b514a383d27aee6 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 -r 4bad2c6338cc -r 23f8a579b56e src/ChangeLog.bidi --- a/src/ChangeLog.bidi Fri Jan 01 06:39:56 2010 -0500 +++ b/src/ChangeLog.bidi Fri Jan 01 06:45:36 2010 -0500 @@ -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 -r 4bad2c6338cc -r 23f8a579b56e src/bidi.c --- a/src/bidi.c Fri Jan 01 06:39:56 2010 -0500 +++ b/src/bidi.c Fri Jan 01 06:45:36 2010 -0500 @@ -55,6 +55,8 @@ #include #endif +#include + #include "lisp.h" #include "buffer.h" #include "character.h" diff -r 4bad2c6338cc -r 23f8a579b56e src/dispextern.h --- a/src/dispextern.h Fri Jan 01 06:39:56 2010 -0500 +++ b/src/dispextern.h Fri Jan 01 06:45:36 2010 -0500 @@ -371,11 +371,14 @@ 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 @@ /* 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 -r 4bad2c6338cc -r 23f8a579b56e src/xdisp.c --- a/src/xdisp.c Fri Jan 01 06:39:56 2010 -0500 +++ b/src/xdisp.c Fri Jan 01 06:45:36 2010 -0500 @@ -12520,8 +12520,8 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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];