diff options
| author | Dmitry Antipov | 2013-03-08 03:37:36 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-03-08 03:37:36 +0400 |
| commit | 36075a19b2d37e38e8258dff2f774a2a3702dc55 (patch) | |
| tree | d6b7433481f28fcfd8f609fe2974a4b0f2ed5ea1 /src | |
| parent | c095b77025b5bc3ea72972b33dae025b4c52abeb (diff) | |
| download | emacs-36075a19b2d37e38e8258dff2f774a2a3702dc55.tar.gz emacs-36075a19b2d37e38e8258dff2f774a2a3702dc55.zip | |
* bidi.c (bidi_fetch_char): Swap first and second arguments
to match other functions accepting character and byte positions.
Adjust comment.
(bidi_resolve_explicit_1, bidi_level_of_next_char): Adjust users.
(bidi_paragraph_init): Likewise. Use DEC_BOTH which is faster
when you need just to move to the previous buffer position.
* xdisp.c (Fcurrent_bidi_paragraph_direction): Use DEC_BOTH.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/bidi.c | 15 | ||||
| -rw-r--r-- | src/xdisp.c | 5 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 54b1fd04503..02c928f8f82 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-03-08 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * bidi.c (bidi_fetch_char): Swap first and second arguments | ||
| 4 | to match other functions accepting character and byte positions. | ||
| 5 | Adjust comment. | ||
| 6 | (bidi_resolve_explicit_1, bidi_level_of_next_char): Adjust users. | ||
| 7 | (bidi_paragraph_init): Likewise. Use DEC_BOTH which is faster | ||
| 8 | when you need just to move to the previous buffer position. | ||
| 9 | * xdisp.c (Fcurrent_bidi_paragraph_direction): Use DEC_BOTH. | ||
| 10 | |||
| 1 | 2013-03-07 Eli Zaretskii <eliz@gnu.org> | 11 | 2013-03-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 12 | ||
| 3 | * .gdbinit (prowlims): Display the enabled_p flag of the row. | 13 | * .gdbinit (prowlims): Display the enabled_p flag of the row. |
diff --git a/src/bidi.c b/src/bidi.c index cf5e580cd8f..7d070462a85 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -910,7 +910,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) | |||
| 910 | return STRING_CHAR (s); | 910 | return STRING_CHAR (s); |
| 911 | } | 911 | } |
| 912 | 912 | ||
| 913 | /* Fetch and return the character at BYTEPOS/CHARPOS. If that | 913 | /* Fetch and return the character at CHARPOS/BYTEPOS. If that |
| 914 | character is covered by a display string, treat the entire run of | 914 | character is covered by a display string, treat the entire run of |
| 915 | covered characters as a single character, either u+2029 or u+FFFC, | 915 | covered characters as a single character, either u+2029 or u+FFFC, |
| 916 | and return their combined length in CH_LEN and NCHARS. DISP_POS | 916 | and return their combined length in CH_LEN and NCHARS. DISP_POS |
| @@ -925,7 +925,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) | |||
| 925 | string to iterate, or NULL if iterating over a buffer or a Lisp | 925 | string to iterate, or NULL if iterating over a buffer or a Lisp |
| 926 | string; in the latter case, STRING->lstring is the Lisp string. */ | 926 | string; in the latter case, STRING->lstring is the Lisp string. */ |
| 927 | static int | 927 | static int |
| 928 | bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, | 928 | bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, |
| 929 | int *disp_prop, struct bidi_string_data *string, | 929 | int *disp_prop, struct bidi_string_data *string, |
| 930 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) | 930 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) |
| 931 | { | 931 | { |
| @@ -1220,7 +1220,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1220 | bytepos = pstartbyte; | 1220 | bytepos = pstartbyte; |
| 1221 | if (!string_p) | 1221 | if (!string_p) |
| 1222 | pos = BYTE_TO_CHAR (bytepos); | 1222 | pos = BYTE_TO_CHAR (bytepos); |
| 1223 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, &disp_prop, | 1223 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, |
| 1224 | &bidi_it->string, | 1224 | &bidi_it->string, |
| 1225 | bidi_it->frame_window_p, &ch_len, &nchars); | 1225 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1226 | type = bidi_get_type (ch, NEUTRAL_DIR); | 1226 | type = bidi_get_type (ch, NEUTRAL_DIR); |
| @@ -1248,7 +1248,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1248 | && bidi_at_paragraph_end (pos, bytepos) >= -1) | 1248 | && bidi_at_paragraph_end (pos, bytepos) >= -1) |
| 1249 | break; | 1249 | break; |
| 1250 | /* Fetch next character and advance to get past it. */ | 1250 | /* Fetch next character and advance to get past it. */ |
| 1251 | ch = bidi_fetch_char (bytepos, pos, &disp_pos, | 1251 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, |
| 1252 | &disp_prop, &bidi_it->string, | 1252 | &disp_prop, &bidi_it->string, |
| 1253 | bidi_it->frame_window_p, &ch_len, &nchars); | 1253 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1254 | pos += nchars; | 1254 | pos += nchars; |
| @@ -1279,8 +1279,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1279 | /* FXIME: What if p is covered by a display | 1279 | /* FXIME: What if p is covered by a display |
| 1280 | string? See also a FIXME inside | 1280 | string? See also a FIXME inside |
| 1281 | bidi_find_paragraph_start. */ | 1281 | bidi_find_paragraph_start. */ |
| 1282 | p--; | 1282 | DEC_BOTH (p, pbyte); |
| 1283 | pbyte = CHAR_TO_BYTE (p); | ||
| 1284 | prevpbyte = bidi_find_paragraph_start (p, pbyte); | 1283 | prevpbyte = bidi_find_paragraph_start (p, pbyte); |
| 1285 | } | 1284 | } |
| 1286 | pstartbyte = prevpbyte; | 1285 | pstartbyte = prevpbyte; |
| @@ -1398,7 +1397,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) | |||
| 1398 | /* Fetch the character at BYTEPOS. If it is covered by a | 1397 | /* Fetch the character at BYTEPOS. If it is covered by a |
| 1399 | display string, treat the entire run of covered characters as | 1398 | display string, treat the entire run of covered characters as |
| 1400 | a single character u+FFFC. */ | 1399 | a single character u+FFFC. */ |
| 1401 | curchar = bidi_fetch_char (bidi_it->bytepos, bidi_it->charpos, | 1400 | curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, |
| 1402 | &bidi_it->disp_pos, &bidi_it->disp_prop, | 1401 | &bidi_it->disp_pos, &bidi_it->disp_prop, |
| 1403 | &bidi_it->string, bidi_it->frame_window_p, | 1402 | &bidi_it->string, bidi_it->frame_window_p, |
| 1404 | &bidi_it->ch_len, &bidi_it->nchars); | 1403 | &bidi_it->ch_len, &bidi_it->nchars); |
| @@ -2191,7 +2190,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 2191 | if (bidi_it->nchars <= 0) | 2190 | if (bidi_it->nchars <= 0) |
| 2192 | emacs_abort (); | 2191 | emacs_abort (); |
| 2193 | do { | 2192 | do { |
| 2194 | ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs, | 2193 | ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, |
| 2195 | fwp, &clen, &nc); | 2194 | fwp, &clen, &nc); |
| 2196 | if (ch == '\n' || ch == BIDI_EOB) | 2195 | if (ch == '\n' || ch == BIDI_EOB) |
| 2197 | chtype = NEUTRAL_B; | 2196 | chtype = NEUTRAL_B; |
diff --git a/src/xdisp.c b/src/xdisp.c index 934c617bf8e..3838d237c91 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -19910,10 +19910,7 @@ See also `bidi-paragraph-direction'. */) | |||
| 19910 | to make sure we are within that paragraph. To that end, find | 19910 | to make sure we are within that paragraph. To that end, find |
| 19911 | the previous non-empty line. */ | 19911 | the previous non-empty line. */ |
| 19912 | if (pos >= ZV && pos > BEGV) | 19912 | if (pos >= ZV && pos > BEGV) |
| 19913 | { | 19913 | DEC_BOTH (pos, bytepos); |
| 19914 | pos--; | ||
| 19915 | bytepos = CHAR_TO_BYTE (pos); | ||
| 19916 | } | ||
| 19917 | if (fast_looking_at (build_string ("[\f\t ]*\n"), | 19914 | if (fast_looking_at (build_string ("[\f\t ]*\n"), |
| 19918 | pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) | 19915 | pos, bytepos, ZV, ZV_BYTE, Qnil) > 0) |
| 19919 | { | 19916 | { |