diff options
| author | Kenichi Handa | 2012-09-15 15:14:18 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-09-15 15:14:18 +0900 |
| commit | dcbd9236f7be9da4e658fd559dfbd7454f4b6018 (patch) | |
| tree | df71af7779e1a0da9d0822ce5b89e51bd603bd40 /src | |
| parent | ea964864a66828ce2457e44c4c670160d5879ec6 (diff) | |
| parent | 823751606a90e3850551b43e707d58bbf58033dc (diff) | |
| download | emacs-dcbd9236f7be9da4e658fd559dfbd7454f4b6018.tar.gz emacs-dcbd9236f7be9da4e658fd559dfbd7454f4b6018.zip | |
merge trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/insdel.c | 31 |
3 files changed, 29 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e598d4d465a..88e385c876b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -3,6 +3,19 @@ | |||
| 3 | * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster | 3 | * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster |
| 4 | here, but just check the validity of glyphs in the glyph-string. | 4 | here, but just check the validity of glyphs in the glyph-string. |
| 5 | 5 | ||
| 6 | 2012-09-14 Paul Eggert <eggert@cs.ucla.edu> | ||
| 7 | |||
| 8 | * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]: | ||
| 9 | Include "syssignal.h", for 'main_thread'. | ||
| 10 | |||
| 11 | 2012-09-14 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 12 | |||
| 13 | Avoid out-of-range marker position (Bug#12426). | ||
| 14 | * insdel.c (replace_range, replace_range_2): Adjust | ||
| 15 | markers before overlays, as suggested by comments. | ||
| 16 | (insert_1_both, insert_from_buffer_1, adjust_after_replace): | ||
| 17 | Remove redundant check before calling offset_intervals. | ||
| 18 | |||
| 6 | 2012-09-14 Martin Rudalics <rudalics@gmx.at> | 19 | 2012-09-14 Martin Rudalics <rudalics@gmx.at> |
| 7 | 20 | ||
| 8 | * xdisp.c (Fformat_mode_line): Unconditionally save/restore | 21 | * xdisp.c (Fformat_mode_line): Unconditionally save/restore |
diff --git a/src/alloc.c b/src/alloc.c index 77807f6e086..25cf03dfa2e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -100,6 +100,8 @@ extern void _free_internal (void *); | |||
| 100 | #if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT | 100 | #if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT |
| 101 | #ifdef HAVE_PTHREAD | 101 | #ifdef HAVE_PTHREAD |
| 102 | 102 | ||
| 103 | # include "syssignal.h" | ||
| 104 | |||
| 103 | /* When GTK uses the file chooser dialog, different backends can be loaded | 105 | /* When GTK uses the file chooser dialog, different backends can be loaded |
| 104 | dynamically. One such a backend is the Gnome VFS backend that gets loaded | 106 | dynamically. One such a backend is the Gnome VFS backend that gets loaded |
| 105 | if you run Gnome. That backend creates several threads and also allocates | 107 | if you run Gnome. That backend creates several threads and also allocates |
diff --git a/src/insdel.c b/src/insdel.c index b12a390633e..bfb2327a696 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -840,8 +840,7 @@ insert_1_both (const char *string, | |||
| 840 | PT + nchars, PT_BYTE + nbytes, | 840 | PT + nchars, PT_BYTE + nbytes, |
| 841 | before_markers); | 841 | before_markers); |
| 842 | 842 | ||
| 843 | if (buffer_intervals (current_buffer)) | 843 | offset_intervals (current_buffer, PT, nchars); |
| 844 | offset_intervals (current_buffer, PT, nchars); | ||
| 845 | 844 | ||
| 846 | if (!inherit && buffer_intervals (current_buffer)) | 845 | if (!inherit && buffer_intervals (current_buffer)) |
| 847 | set_text_properties (make_number (PT), make_number (PT + nchars), | 846 | set_text_properties (make_number (PT), make_number (PT + nchars), |
| @@ -1153,8 +1152,7 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1153 | PT_BYTE + outgoing_nbytes, | 1152 | PT_BYTE + outgoing_nbytes, |
| 1154 | 0); | 1153 | 0); |
| 1155 | 1154 | ||
| 1156 | if (buffer_intervals (current_buffer)) | 1155 | offset_intervals (current_buffer, PT, nchars); |
| 1157 | offset_intervals (current_buffer, PT, nchars); | ||
| 1158 | 1156 | ||
| 1159 | /* Get the intervals for the part of the string we are inserting. */ | 1157 | /* Get the intervals for the part of the string we are inserting. */ |
| 1160 | intervals = buffer_intervals (buf); | 1158 | intervals = buffer_intervals (buf); |
| @@ -1222,8 +1220,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1222 | else if (len < nchars_del) | 1220 | else if (len < nchars_del) |
| 1223 | adjust_overlays_for_delete (from, nchars_del - len); | 1221 | adjust_overlays_for_delete (from, nchars_del - len); |
| 1224 | 1222 | ||
| 1225 | if (buffer_intervals (current_buffer)) | 1223 | offset_intervals (current_buffer, from, len - nchars_del); |
| 1226 | offset_intervals (current_buffer, from, len - nchars_del); | ||
| 1227 | 1224 | ||
| 1228 | if (from < PT) | 1225 | if (from < PT) |
| 1229 | adjust_point (len - nchars_del, len_byte - nbytes_del); | 1226 | adjust_point (len - nchars_del, len_byte - nbytes_del); |
| @@ -1394,16 +1391,16 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, | |||
| 1394 | 1391 | ||
| 1395 | eassert (GPT <= GPT_BYTE); | 1392 | eassert (GPT <= GPT_BYTE); |
| 1396 | 1393 | ||
| 1397 | /* Adjust the overlay center as needed. This must be done after | ||
| 1398 | adjusting the markers that bound the overlays. */ | ||
| 1399 | adjust_overlays_for_delete (from, nchars_del); | ||
| 1400 | adjust_overlays_for_insert (from, inschars); | ||
| 1401 | |||
| 1402 | /* Adjust markers for the deletion and the insertion. */ | 1394 | /* Adjust markers for the deletion and the insertion. */ |
| 1403 | if (markers) | 1395 | if (markers) |
| 1404 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, | 1396 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, |
| 1405 | inschars, outgoing_insbytes); | 1397 | inschars, outgoing_insbytes); |
| 1406 | 1398 | ||
| 1399 | /* Adjust the overlay center as needed. This must be done after | ||
| 1400 | adjusting the markers that bound the overlays. */ | ||
| 1401 | adjust_overlays_for_delete (from, nchars_del); | ||
| 1402 | adjust_overlays_for_insert (from, inschars); | ||
| 1403 | |||
| 1407 | offset_intervals (current_buffer, from, inschars - nchars_del); | 1404 | offset_intervals (current_buffer, from, inschars - nchars_del); |
| 1408 | 1405 | ||
| 1409 | /* Get the intervals for the part of the string we are inserting-- | 1406 | /* Get the intervals for the part of the string we are inserting-- |
| @@ -1510,6 +1507,12 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1510 | 1507 | ||
| 1511 | eassert (GPT <= GPT_BYTE); | 1508 | eassert (GPT <= GPT_BYTE); |
| 1512 | 1509 | ||
| 1510 | /* Adjust markers for the deletion and the insertion. */ | ||
| 1511 | if (markers | ||
| 1512 | && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes)) | ||
| 1513 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, | ||
| 1514 | inschars, insbytes); | ||
| 1515 | |||
| 1513 | /* Adjust the overlay center as needed. This must be done after | 1516 | /* Adjust the overlay center as needed. This must be done after |
| 1514 | adjusting the markers that bound the overlays. */ | 1517 | adjusting the markers that bound the overlays. */ |
| 1515 | if (nchars_del != inschars) | 1518 | if (nchars_del != inschars) |
| @@ -1518,12 +1521,6 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1518 | adjust_overlays_for_delete (from + inschars, nchars_del); | 1521 | adjust_overlays_for_delete (from + inschars, nchars_del); |
| 1519 | } | 1522 | } |
| 1520 | 1523 | ||
| 1521 | /* Adjust markers for the deletion and the insertion. */ | ||
| 1522 | if (markers | ||
| 1523 | && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes)) | ||
| 1524 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, | ||
| 1525 | inschars, insbytes); | ||
| 1526 | |||
| 1527 | offset_intervals (current_buffer, from, inschars - nchars_del); | 1524 | offset_intervals (current_buffer, from, inschars - nchars_del); |
| 1528 | 1525 | ||
| 1529 | /* Relocate point as if it were a marker. */ | 1526 | /* Relocate point as if it were a marker. */ |