diff options
| author | Eli Zaretskii | 2014-04-14 18:32:27 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-04-14 18:32:27 +0300 |
| commit | ac6ec89c158aae5c4e78fcf70efd19d42c0abbe3 (patch) | |
| tree | 0a4f41e63533ad550e9ac4dcbf19710fe437fcfc /src | |
| parent | a73b9ddac85132aa0745734ee757e234298a6c7a (diff) | |
| download | emacs-ac6ec89c158aae5c4e78fcf70efd19d42c0abbe3.tar.gz emacs-ac6ec89c158aae5c4e78fcf70efd19d42c0abbe3.zip | |
Fix bidirectional redisplay when deletion creates a paragraph start.
src/insdel.c (invalidate_buffer_caches): When deleting or replacing
text, invalidate the bidi_paragraph_cache upto and including the
preceding newline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/insdel.c | 32 |
2 files changed, 35 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index be4ce13129c..6b6bd06634a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2014-04-14 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * insdel.c (invalidate_buffer_caches): When deleting or replacing | ||
| 4 | text, invalidate the bidi_paragraph_cache upto and including the | ||
| 5 | preceding newline. | ||
| 6 | |||
| 1 | 2014-04-13 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2014-04-13 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Port to IRIX 6.5 (Bug#9684). | 9 | Port to IRIX 6.5 (Bug#9684). |
diff --git a/src/insdel.c b/src/insdel.c index 30b22ec7b26..ea5f6301501 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1866,9 +1866,35 @@ invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 1866 | buf->width_run_cache, | 1866 | buf->width_run_cache, |
| 1867 | start - BUF_BEG (buf), BUF_Z (buf) - end); | 1867 | start - BUF_BEG (buf), BUF_Z (buf) - end); |
| 1868 | if (buf->bidi_paragraph_cache) | 1868 | if (buf->bidi_paragraph_cache) |
| 1869 | invalidate_region_cache (buf, | 1869 | { |
| 1870 | buf->bidi_paragraph_cache, | 1870 | if (start != end |
| 1871 | start - BUF_BEG (buf), BUF_Z (buf) - end); | 1871 | && start > BUF_BEG (buf)) |
| 1872 | { | ||
| 1873 | /* If we are deleting or replacing characters, we could | ||
| 1874 | create a paragraph start, because all of the characters | ||
| 1875 | from START to the beginning of START's line are | ||
| 1876 | whitespace. Therefore, we must extend the region to be | ||
| 1877 | invalidated up to the newline before START. */ | ||
| 1878 | ptrdiff_t line_beg = start; | ||
| 1879 | ptrdiff_t start_byte = buf_charpos_to_bytepos (buf, start); | ||
| 1880 | |||
| 1881 | if (BUF_FETCH_BYTE (buf, start_byte - 1) != '\n') | ||
| 1882 | { | ||
| 1883 | struct buffer *old = current_buffer; | ||
| 1884 | |||
| 1885 | set_buffer_internal (buf); | ||
| 1886 | |||
| 1887 | line_beg = find_newline_no_quit (start, start_byte, -1, | ||
| 1888 | &start_byte); | ||
| 1889 | set_buffer_internal (old); | ||
| 1890 | } | ||
| 1891 | if (line_beg > BUF_BEG (buf)) | ||
| 1892 | start = line_beg - 1; | ||
| 1893 | } | ||
| 1894 | invalidate_region_cache (buf, | ||
| 1895 | buf->bidi_paragraph_cache, | ||
| 1896 | start - BUF_BEG (buf), BUF_Z (buf) - end); | ||
| 1897 | } | ||
| 1872 | } | 1898 | } |
| 1873 | 1899 | ||
| 1874 | /* These macros work with an argument named `preserve_ptr' | 1900 | /* These macros work with an argument named `preserve_ptr' |