diff options
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 @@ * font.c (Ffont_shape_gstring): Don't adjust grapheme cluster here, but just check the validity of glyphs in the glyph-string. +2012-09-14 Paul Eggert <eggert@cs.ucla.edu> + + * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT && HAVE_PTHREAD]: + Include "syssignal.h", for 'main_thread'. + +2012-09-14 Dmitry Antipov <dmantipov@yandex.ru> + + Avoid out-of-range marker position (Bug#12426). + * insdel.c (replace_range, replace_range_2): Adjust + markers before overlays, as suggested by comments. + (insert_1_both, insert_from_buffer_1, adjust_after_replace): + Remove redundant check before calling offset_intervals. + 2012-09-14 Martin Rudalics <rudalics@gmx.at> * 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 *); #if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT #ifdef HAVE_PTHREAD +# include "syssignal.h" + /* When GTK uses the file chooser dialog, different backends can be loaded dynamically. One such a backend is the Gnome VFS backend that gets loaded 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, PT + nchars, PT_BYTE + nbytes, before_markers); - if (buffer_intervals (current_buffer)) - offset_intervals (current_buffer, PT, nchars); + offset_intervals (current_buffer, PT, nchars); if (!inherit && buffer_intervals (current_buffer)) set_text_properties (make_number (PT), make_number (PT + nchars), @@ -1153,8 +1152,7 @@ insert_from_buffer_1 (struct buffer *buf, PT_BYTE + outgoing_nbytes, 0); - if (buffer_intervals (current_buffer)) - offset_intervals (current_buffer, PT, nchars); + offset_intervals (current_buffer, PT, nchars); /* Get the intervals for the part of the string we are inserting. */ intervals = buffer_intervals (buf); @@ -1222,8 +1220,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, else if (len < nchars_del) adjust_overlays_for_delete (from, nchars_del - len); - if (buffer_intervals (current_buffer)) - offset_intervals (current_buffer, from, len - nchars_del); + offset_intervals (current_buffer, from, len - nchars_del); if (from < PT) adjust_point (len - nchars_del, len_byte - nbytes_del); @@ -1394,16 +1391,16 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, eassert (GPT <= GPT_BYTE); - /* Adjust the overlay center as needed. This must be done after - adjusting the markers that bound the overlays. */ - adjust_overlays_for_delete (from, nchars_del); - adjust_overlays_for_insert (from, inschars); - /* Adjust markers for the deletion and the insertion. */ if (markers) adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, inschars, outgoing_insbytes); + /* Adjust the overlay center as needed. This must be done after + adjusting the markers that bound the overlays. */ + adjust_overlays_for_delete (from, nchars_del); + adjust_overlays_for_insert (from, inschars); + offset_intervals (current_buffer, from, inschars - nchars_del); /* 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, eassert (GPT <= GPT_BYTE); + /* Adjust markers for the deletion and the insertion. */ + if (markers + && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes)) + adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, + inschars, insbytes); + /* Adjust the overlay center as needed. This must be done after adjusting the markers that bound the overlays. */ if (nchars_del != inschars) @@ -1518,12 +1521,6 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, adjust_overlays_for_delete (from + inschars, nchars_del); } - /* Adjust markers for the deletion and the insertion. */ - if (markers - && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes)) - adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, - inschars, insbytes); - offset_intervals (current_buffer, from, inschars - nchars_del); /* Relocate point as if it were a marker. */ |
