Commit 29e3d8d1 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent 5e65aec0
2009-10-24 Eli Zaretskii <eliz@gnu.org>
* 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 <eliz@gnu.org>
* bidi.c: Include setjmp.h.
2009-10-17 Eli Zaretskii <eliz@gnu.org>
* dispextern.h (struct glyph): New members resolved_level and
......
......@@ -55,6 +55,8 @@ Boston, MA 02110-1301, USA. */
#include <string.h>
#endif
#include <setjmp.h>
#include "lisp.h"
#include "buffer.h"
#include "character.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 */
......
......@@ -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];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment