/* Low-level bidirectional buffer/string-scanning functions for GNU Emacs.
- Copyright (C) 2000-2001, 2004-2005, 2009-2015 Free Software
+ Copyright (C) 2000-2001, 2004-2005, 2009-2016 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
/* `(space ...)' display specs are handled as paragraph
separators for the purposes of the reordering; see UAX#9
section 3 and clause HL1 in section 4.3 there. */
- ch = 0x2029;
+ ch = PARAGRAPH_SEPARATOR;
}
else
{
/* All other display specs are handled as the Unicode Object
Replacement Character. */
- ch = 0xFFFC;
+ ch = OBJECT_REPLACEMENT_CHARACTER;
}
disp_end_pos = compute_display_string_end (*disp_pos, string);
if (disp_end_pos < 0)
#define MAX_BPA_STACK ((int)max (MAX_ALLOCA / sizeof (bpa_stack_entry), 1))
/* UAX#9 says to match opening brackets with the matching closing
- brackets or their canonical equivalents. As of Unicode 7.0, there
+ brackets or their canonical equivalents. As of Unicode 8.0, there
are only 2 bracket characters that have canonical equivalence
decompositions: u+2329 and u+232A. So instead of accessing the
table in uni-decomposition.el, we just handle these 2 characters
#define CANONICAL_EQU(c) \
( ASCII_CHAR_P (c) ? c \
- : (c) == 0x2329 ? 0x3008 \
- : (c) == 0x232a ? 0x3009 \
+ : (c) == LEFT_POINTING_ANGLE_BRACKET ? LEFT_ANGLE_BRACKET \
+ : (c) == RIGHT_POINTING_ANGLE_BRACKET ? RIGHT_ANGLE_BRACKET \
: c )
#ifdef ENABLE_CHECKING
we are already at paragraph end. */
&& (is_neutral || bidi_isolate_fmt_char (type)))
/* N1-N2/Retaining */
- || (type == WEAK_BN && bidi_explicit_dir_char (bidi_it->ch)))
+ || type == WEAK_BN)
{
if (bidi_it->next_for_neutral.type != UNKNOWN_BT)
{
entering the expensive loop in the "else" clause. */
else if (current_level == 0
&& bidi_it->prev_for_neutral.type == STRONG_L
+ && type != WEAK_BN
&& !bidi_explicit_dir_char (bidi_it->ch)
&& !bidi_isolate_fmt_char (type))
type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
&& (bidi_it->prev_for_neutral.type == STRONG_R
|| bidi_it->prev_for_neutral.type == WEAK_EN
|| bidi_it->prev_for_neutral.type == WEAK_AN)
+ && type != WEAK_BN
&& !bidi_explicit_dir_char (bidi_it->ch)
&& !bidi_isolate_fmt_char (type))
type = bidi_resolve_neutral_1 (bidi_it->prev_for_neutral.type,
{
/* Arrrgh!! The UAX#9 algorithm is too deeply entrenched in
the assumption of batch-style processing; see clauses W4,
- W5, and especially N1, which require to look far forward
+ W5, and especially N1, which require looking far forward
(as well as back) in the buffer/string. May the fleas of
a thousand camels infest the armpits of those who design
supposedly general-purpose algorithms by looking at their
it belongs to a sequence of WS characters preceding a newline
or a TAB or a paragraph separator. */
if ((bidi_it->orig_type == NEUTRAL_WS
+ || bidi_it->orig_type == WEAK_BN
|| bidi_isolate_fmt_char (bidi_it->orig_type))
&& bidi_it->next_for_ws.charpos < bidi_it->charpos)
{
/* Resolve implicit levels. */
if (bidi_it->orig_type == NEUTRAL_B /* L1 */
- || bidi_it->orig_type == NEUTRAL_S
- || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB
- || (bidi_it->orig_type == NEUTRAL_WS
- && (bidi_it->next_for_ws.type == NEUTRAL_B
- || bidi_it->next_for_ws.type == NEUTRAL_S)))
+ || bidi_it->orig_type == NEUTRAL_S
+ || bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB
+ || ((bidi_it->orig_type == NEUTRAL_WS
+ || bidi_it->orig_type == WEAK_BN
+ || bidi_isolate_fmt_char (bidi_it->orig_type)
+ || bidi_explicit_dir_char (bidi_it->ch))
+ && (bidi_it->next_for_ws.type == NEUTRAL_B
+ || bidi_it->next_for_ws.type == NEUTRAL_S)))
level = bidi_it->level_stack[0].level;
else if ((level & 1) == 0) /* I1 */
{
{
int old_level, new_level, next_level;
struct bidi_it sentinel;
- struct gcpro gcpro1;
if (bidi_it->charpos < 0 || bidi_it->bytepos < 0)
emacs_abort ();
bidi_it->scan_dir = 1; /* default to logical order */
}
- /* The code below can call eval, and thus cause GC. If we are
- iterating a Lisp string, make sure it won't be GCed. */
- if (STRINGP (bidi_it->string.lstring))
- GCPRO1 (bidi_it->string.lstring);
-
/* If we just passed a newline, initialize for the next line. */
if (!bidi_it->first_elt
&& (bidi_it->ch == '\n' || bidi_it->ch == BIDI_EOB))
eassert (bidi_it->resolved_level >= 0
&& bidi_it->resolved_level <= BIDI_MAXDEPTH + 2);
-
- if (STRINGP (bidi_it->string.lstring))
- UNGCPRO;
}
/* Utility function for looking for strong directional characters