diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2013-03-13 19:21:46 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2013-03-13 19:21:46 +0400 |
commit | 8a7debc14cad081ac726fe2e812ce25d8122327f (patch) | |
tree | 9a82265f290650b75db46361c89179cc2bb9fab2 | |
parent | dba720f1d15a1cd7b866143f2f6c416277a193e1 (diff) | |
download | emacs-8a7debc14cad081ac726fe2e812ce25d8122327f.tar.gz |
* xdisp.c (init_iterator): Simplify because both character and byte
positions are either specified or -1. Add eassert. Adjust comment.
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/xdisp.c | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7642393bb01..e23f0167339 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-03-13 Dmitry Antipov <dmantipov@yandex.ru> + + * xdisp.c (init_iterator): Simplify because both character and byte + positions are either specified or -1. Add eassert. Adjust comment. + 2013-03-13 Paul Eggert <eggert@cs.ucla.edu> Static checking by Sun C 5.12. diff --git a/src/xdisp.c b/src/xdisp.c index 511a5eeb2c3..a5bba1a81cd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2550,7 +2550,7 @@ markpos_of_region (void) at character position CHARPOS. CHARPOS < 0 means that no buffer position is specified which is useful when the iterator is assigned a position later. BYTEPOS is the byte position corresponding to - CHARPOS. BYTEPOS < 0 means compute it from CHARPOS. + CHARPOS. If ROW is not null, calls to produce_glyphs with IT as parameter will produce glyphs in that row. @@ -2828,18 +2828,14 @@ init_iterator (struct it *it, struct window *w, if (charpos >= BUF_BEG (current_buffer)) { it->end_charpos = ZV; + eassert (charpos == BYTE_TO_CHAR (bytepos)); IT_CHARPOS (*it) = charpos; + IT_BYTEPOS (*it) = bytepos; /* We will rely on `reseat' to set this up properly, via handle_face_prop. */ it->face_id = it->base_face_id; - /* Compute byte position if not specified. */ - if (bytepos < charpos) - IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos); - else - IT_BYTEPOS (*it) = bytepos; - it->start = it->current; /* Do we need to reorder bidirectional text? Not if this is a unibyte buffer: by definition, none of the single-byte |