aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-08-27 13:52:50 +0000
committerGerd Moellmann2001-08-27 13:52:50 +0000
commit47d57b22214afc761a35978bd6066a6ff881d0ce (patch)
tree5858d2efc77b94afd4c4b8f0c6f78606c2d7a128 /src
parent1ddb09f51c247494d4b434fc603e5adda8b9aa7d (diff)
downloademacs-47d57b22214afc761a35978bd6066a6ff881d0ce.tar.gz
emacs-47d57b22214afc761a35978bd6066a6ff881d0ce.zip
(init_from_display_pos, init_to_row_end): Return 0 if
there exist overlay strings with newlines at POS. (text_outside_line_unchanged_p): Return 0 if changes start at START and overlays exist at START. Likewise for END. (try_window_id): Give up if init_to_row_end returns 0.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/xdisp.c70
2 files changed, 63 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dba6e5b2023..1da0dcb742b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12001-08-27 Gerd Moellmann <gerd@gnu.org> 12001-08-27 Gerd Moellmann <gerd@gnu.org>
2 2
3 * fileio.c (Finsert_file_contents): Allocate, restore, and
4 free composition data in the case of REPLACE not being nil.
5
6 * xdisp.c (init_from_display_pos, init_to_row_end): Return 0 if
7 there exist overlay strings with newlines at POS.
8 (text_outside_line_unchanged_p): Return 0 if changes start at
9 START and overlays exist at START. Likewise for END.
10 (try_window_id): Give up if init_to_row_end returns 0.
11
3 * fileio.c (Finsert_file_contents): Call Fset_buffer_multibyte 12 * fileio.c (Finsert_file_contents): Call Fset_buffer_multibyte
4 unconditionally. 13 unconditionally.
5 14
diff --git a/src/xdisp.c b/src/xdisp.c
index f5c38c52d9b..6272eece52f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -753,8 +753,8 @@ static int next_element_from_composition P_ ((struct it *));
753static int next_element_from_image P_ ((struct it *)); 753static int next_element_from_image P_ ((struct it *));
754static int next_element_from_stretch P_ ((struct it *)); 754static int next_element_from_stretch P_ ((struct it *));
755static void load_overlay_strings P_ ((struct it *, int)); 755static void load_overlay_strings P_ ((struct it *, int));
756static void init_from_display_pos P_ ((struct it *, struct window *, 756static int init_from_display_pos P_ ((struct it *, struct window *,
757 struct display_pos *)); 757 struct display_pos *));
758static void reseat_to_string P_ ((struct it *, unsigned char *, 758static void reseat_to_string P_ ((struct it *, unsigned char *,
759 Lisp_Object, int, int, int, int)); 759 Lisp_Object, int, int, int, int));
760static enum move_it_result move_it_in_display_line_to P_ ((struct it *, 760static enum move_it_result move_it_in_display_line_to P_ ((struct it *,
@@ -762,8 +762,8 @@ static enum move_it_result move_it_in_display_line_to P_ ((struct it *,
762void move_it_vertically_backward P_ ((struct it *, int)); 762void move_it_vertically_backward P_ ((struct it *, int));
763static void init_to_row_start P_ ((struct it *, struct window *, 763static void init_to_row_start P_ ((struct it *, struct window *,
764 struct glyph_row *)); 764 struct glyph_row *));
765static void init_to_row_end P_ ((struct it *, struct window *, 765static int init_to_row_end P_ ((struct it *, struct window *,
766 struct glyph_row *)); 766 struct glyph_row *));
767static void back_to_previous_line_start P_ ((struct it *)); 767static void back_to_previous_line_start P_ ((struct it *));
768static int forward_to_next_line_start P_ ((struct it *, int *)); 768static int forward_to_next_line_start P_ ((struct it *, int *));
769static struct text_pos string_pos_nchars_ahead P_ ((struct text_pos, 769static struct text_pos string_pos_nchars_ahead P_ ((struct text_pos,
@@ -1805,15 +1805,17 @@ in_ellipses_for_invisible_text_p (pos, w)
1805 1805
1806/* Initialize IT for stepping through current_buffer in window W, 1806/* Initialize IT for stepping through current_buffer in window W,
1807 starting at position POS that includes overlay string and display 1807 starting at position POS that includes overlay string and display
1808 vector/ control character translation position information. */ 1808 vector/ control character translation position information. Value
1809 is zero if there are overlay strings with newlines at POS. */
1809 1810
1810static void 1811static int
1811init_from_display_pos (it, w, pos) 1812init_from_display_pos (it, w, pos)
1812 struct it *it; 1813 struct it *it;
1813 struct window *w; 1814 struct window *w;
1814 struct display_pos *pos; 1815 struct display_pos *pos;
1815{ 1816{
1816 int charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos); 1817 int charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos);
1818 int i, overlay_strings_with_newlines = 0;
1817 1819
1818 /* If POS specifies a position in a display vector, this might 1820 /* If POS specifies a position in a display vector, this might
1819 be for an ellipsis displayed for invisible text. We won't 1821 be for an ellipsis displayed for invisible text. We won't
@@ -1836,6 +1838,13 @@ init_from_display_pos (it, w, pos)
1836 after-string. */ 1838 after-string. */
1837 init_iterator (it, w, charpos, bytepos, NULL, DEFAULT_FACE_ID); 1839 init_iterator (it, w, charpos, bytepos, NULL, DEFAULT_FACE_ID);
1838 1840
1841 for (i = 0; i < it->n_overlay_strings; ++i)
1842 if (index (XSTRING (it->overlay_strings[i])->data, '\n') != NULL)
1843 {
1844 overlay_strings_with_newlines = 1;
1845 break;
1846 }
1847
1839 /* If position is within an overlay string, set up IT to the right 1848 /* If position is within an overlay string, set up IT to the right
1840 overlay string. */ 1849 overlay string. */
1841 if (pos->overlay_string_index >= 0) 1850 if (pos->overlay_string_index >= 0)
@@ -1905,6 +1914,7 @@ init_from_display_pos (it, w, pos)
1905 } 1914 }
1906 1915
1907 CHECK_IT (it); 1916 CHECK_IT (it);
1917 return !overlay_strings_with_newlines;
1908} 1918}
1909 1919
1910 1920
@@ -1924,20 +1934,28 @@ init_to_row_start (it, w, row)
1924 1934
1925 1935
1926/* Initialize IT for stepping through current_buffer in window W 1936/* Initialize IT for stepping through current_buffer in window W
1927 starting in the line following ROW, i.e. starting at ROW->end. */ 1937 starting in the line following ROW, i.e. starting at ROW->end.
1938 Value is zero if there are overlay strings with newlines at ROW's
1939 end position. */
1928 1940
1929static void 1941static int
1930init_to_row_end (it, w, row) 1942init_to_row_end (it, w, row)
1931 struct it *it; 1943 struct it *it;
1932 struct window *w; 1944 struct window *w;
1933 struct glyph_row *row; 1945 struct glyph_row *row;
1934{ 1946{
1935 init_from_display_pos (it, w, &row->end); 1947 int success = 0;
1936 1948
1937 if (row->continued_p) 1949 if (init_from_display_pos (it, w, &row->end))
1938 it->continuation_lines_width = (row->continuation_lines_width 1950 {
1939 + row->pixel_width); 1951 if (row->continued_p)
1940 CHECK_IT (it); 1952 it->continuation_lines_width
1953 = row->continuation_lines_width + row->pixel_width;
1954 CHECK_IT (it);
1955 success = 1;
1956 }
1957
1958 return success;
1941} 1959}
1942 1960
1943 1961
@@ -8167,6 +8185,23 @@ text_outside_line_unchanged_p (w, start, end)
8167 && XINT (current_buffer->selective_display) > 0 8185 && XINT (current_buffer->selective_display) > 0
8168 && (BEG_UNCHANGED < start || GPT <= start)) 8186 && (BEG_UNCHANGED < start || GPT <= start))
8169 unchanged_p = 0; 8187 unchanged_p = 0;
8188
8189 /* If there are overlays at the start or end of the line, these
8190 may have overlay strings with newlines in them. A change at
8191 START, for instance, may actually concern the display of such
8192 overlay strings as well, and they are displayed on different
8193 lines. So, quickly rule out this case. (For the future, it
8194 might be desirable to implement something more telling than
8195 just BEG/END_UNCHANGED.) */
8196 if (unchanged_p)
8197 {
8198 if (BEG + BEG_UNCHANGED == start
8199 && overlay_touches_p (start))
8200 unchanged_p = 0;
8201 if (END_UNCHANGED == end
8202 && overlay_touches_p (Z - end))
8203 unchanged_p = 0;
8204 }
8170 } 8205 }
8171 8206
8172 return unchanged_p; 8207 return unchanged_p;
@@ -8186,6 +8221,7 @@ redisplay ()
8186 redisplay_internal (0); 8221 redisplay_internal (0);
8187} 8222}
8188 8223
8224
8189/* Return 1 if point moved out of or into a composition. Otherwise 8225/* Return 1 if point moved out of or into a composition. Otherwise
8190 return 0. PREV_BUF and PREV_PT are the last point buffer and 8226 return 0. PREV_BUF and PREV_PT are the last point buffer and
8191 position. BUF and PT are the current point buffer and position. */ 8227 position. BUF and PT are the current point buffer and position. */
@@ -8224,6 +8260,7 @@ check_point_in_composition (prev_buf, prev_pt, buf, pt)
8224 && start < pt && end > pt); 8260 && start < pt && end > pt);
8225} 8261}
8226 8262
8263
8227/* Reconsider the setting of B->clip_changed which is displayed 8264/* Reconsider the setting of B->clip_changed which is displayed
8228 in window W. */ 8265 in window W. */
8229 8266
@@ -11399,8 +11436,9 @@ try_window_id (w)
11399 11436
11400 if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (last_unchanged_at_beg_row)) 11437 if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (last_unchanged_at_beg_row))
11401 GIVE_UP (17); 11438 GIVE_UP (17);
11402 11439
11403 init_to_row_end (&it, w, last_unchanged_at_beg_row); 11440 if (init_to_row_end (&it, w, last_unchanged_at_beg_row) == 0)
11441 GIVE_UP (18);
11404 start_pos = it.current.pos; 11442 start_pos = it.current.pos;
11405 11443
11406 /* Start displaying new lines in the desired matrix at the same 11444 /* Start displaying new lines in the desired matrix at the same