aboutsummaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c158
1 files changed, 77 insertions, 81 deletions
diff --git a/src/indent.c b/src/indent.c
index a3abf88feeb..1493e1d5ee5 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,6 +1,6 @@
1/* Indentation functions. 1/* Indentation functions.
2 Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2012 2 Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2013 Free Software
3 Free Software Foundation, Inc. 3 Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -138,7 +138,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
138 struct Lisp_Vector *widthtab; 138 struct Lisp_Vector *widthtab;
139 139
140 if (!VECTORP (BVAR (buf, width_table))) 140 if (!VECTORP (BVAR (buf, width_table)))
141 bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); 141 bset_width_table (buf, make_uninit_vector (256));
142 widthtab = XVECTOR (BVAR (buf, width_table)); 142 widthtab = XVECTOR (BVAR (buf, width_table));
143 eassert (widthtab->header.size == 256); 143 eassert (widthtab->header.size == 256);
144 144
@@ -254,7 +254,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Ob
254 the next property change */ 254 the next property change */
255 prop = Fget_char_property (position, Qinvisible, 255 prop = Fget_char_property (position, Qinvisible,
256 (!NILP (window) 256 (!NILP (window)
257 && EQ (XWINDOW (window)->buffer, buffer)) 257 && EQ (XWINDOW (window)->contents, buffer))
258 ? window : buffer); 258 ? window : buffer);
259 inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); 259 inv_p = TEXT_PROP_MEANS_INVISIBLE (prop);
260 /* When counting columns (window == nil), don't skip over ellipsis text. */ 260 /* When counting columns (window == nil), don't skip over ellipsis text. */
@@ -291,7 +291,7 @@ DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0,
291 doc: /* Return the horizontal position of point. Beginning of line is column 0. 291 doc: /* Return the horizontal position of point. Beginning of line is column 0.
292This is calculated by adding together the widths of all the displayed 292This is calculated by adding together the widths of all the displayed
293representations of the character between the start of the previous line 293representations of the character between the start of the previous line
294and point (eg. control characters will have a width of 2 or 4, tabs 294and point (e.g., control characters will have a width of 2 or 4, tabs
295will have a variable width). 295will have a variable width).
296Ignores finite width of frame, which means that this function may return 296Ignores finite width of frame, which means that this function may return
297values greater than (frame-width). 297values greater than (frame-width).
@@ -476,7 +476,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos)
476 if ((prop = Fplist_get (plist, QCwidth), 476 if ((prop = Fplist_get (plist, QCwidth),
477 RANGED_INTEGERP (0, prop, INT_MAX))) 477 RANGED_INTEGERP (0, prop, INT_MAX)))
478 width = XINT (prop); 478 width = XINT (prop);
479 else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) 479 else if (FLOATP (prop) && XFLOAT_DATA (prop) >= 0
480 && XFLOAT_DATA (prop) <= INT_MAX) 480 && XFLOAT_DATA (prop) <= INT_MAX)
481 width = (int)(XFLOAT_DATA (prop) + 0.5); 481 width = (int)(XFLOAT_DATA (prop) + 0.5);
482 else if ((prop = Fplist_get (plist, QCalign_to), 482 else if ((prop = Fplist_get (plist, QCalign_to),
@@ -571,7 +571,8 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
571 col += width; 571 col += width;
572 if (endp > scan) /* Avoid infinite loops with 0-width overlays. */ 572 if (endp > scan) /* Avoid infinite loops with 0-width overlays. */
573 { 573 {
574 scan = endp; scan_byte = charpos_to_bytepos (scan); 574 scan = endp;
575 scan_byte = CHAR_TO_BYTE (scan);
575 continue; 576 continue;
576 } 577 }
577 } 578 }
@@ -1087,8 +1088,8 @@ static struct position val_compute_motion;
1087 : (window_width + window_left != frame_cols)) 1088 : (window_width + window_left != frame_cols))
1088 1089
1089 where 1090 where
1090 window_width is XFASTINT (w->total_cols), 1091 window_width is w->total_cols,
1091 window_left is XFASTINT (w->left_col), 1092 window_left is w->left_col,
1092 has_vertical_scroll_bars is 1093 has_vertical_scroll_bars is
1093 WINDOW_HAS_VERTICAL_SCROLL_BAR (window) 1094 WINDOW_HAS_VERTICAL_SCROLL_BAR (window)
1094 and frame_cols = FRAME_COLS (XFRAME (window->frame)) 1095 and frame_cols = FRAME_COLS (XFRAME (window->frame))
@@ -1101,8 +1102,8 @@ static struct position val_compute_motion;
1101 the scroll bars if they are turned on. */ 1102 the scroll bars if they are turned on. */
1102 1103
1103struct position * 1104struct position *
1104compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, 1105compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos,
1105 bool did_motion, ptrdiff_t to, 1106 EMACS_INT fromhpos, bool did_motion, ptrdiff_t to,
1106 EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, 1107 EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width,
1107 ptrdiff_t hscroll, int tab_offset, struct window *win) 1108 ptrdiff_t hscroll, int tab_offset, struct window *win)
1108{ 1109{
@@ -1185,8 +1186,11 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1185 immediate_quit = 1; 1186 immediate_quit = 1;
1186 QUIT; 1187 QUIT;
1187 1188
1189 /* It's just impossible to be too paranoid here. */
1190 eassert (from == BYTE_TO_CHAR (frombyte) && frombyte == CHAR_TO_BYTE (from));
1191
1188 pos = prev_pos = from; 1192 pos = prev_pos = from;
1189 pos_byte = prev_pos_byte = CHAR_TO_BYTE (from); 1193 pos_byte = prev_pos_byte = frombyte;
1190 contin_hpos = 0; 1194 contin_hpos = 0;
1191 prev_tab_offset = tab_offset; 1195 prev_tab_offset = tab_offset;
1192 memset (&cmp_it, 0, sizeof cmp_it); 1196 memset (&cmp_it, 0, sizeof cmp_it);
@@ -1327,8 +1331,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1327 TO (we need to go back below). */ 1331 TO (we need to go back below). */
1328 if (pos <= to) 1332 if (pos <= to)
1329 { 1333 {
1330 pos = find_before_next_newline (pos, to, 1); 1334 pos = find_before_next_newline (pos, to, 1, &pos_byte);
1331 pos_byte = CHAR_TO_BYTE (pos);
1332 hpos = width; 1335 hpos = width;
1333 /* If we just skipped next_boundary, 1336 /* If we just skipped next_boundary,
1334 loop around in the main while 1337 loop around in the main while
@@ -1582,10 +1585,9 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1582 /* Skip any number of invisible lines all at once */ 1585 /* Skip any number of invisible lines all at once */
1583 do 1586 do
1584 { 1587 {
1585 pos = find_before_next_newline (pos, to, 1); 1588 pos = find_before_next_newline (pos, to, 1, &pos_byte);
1586 if (pos < to) 1589 if (pos < to)
1587 pos++; 1590 INC_BOTH (pos, pos_byte);
1588 pos_byte = CHAR_TO_BYTE (pos);
1589 } 1591 }
1590 while (pos < to 1592 while (pos < to
1591 && indented_beyond_p (pos, pos_byte, 1593 && indented_beyond_p (pos, pos_byte,
@@ -1621,10 +1623,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1621 everything from a ^M to the end of the line is invisible. 1623 everything from a ^M to the end of the line is invisible.
1622 Stop *before* the real newline. */ 1624 Stop *before* the real newline. */
1623 if (pos < to) 1625 if (pos < to)
1624 { 1626 pos = find_before_next_newline (pos, to, 1, &pos_byte);
1625 pos = find_before_next_newline (pos, to, 1);
1626 pos_byte = CHAR_TO_BYTE (pos);
1627 }
1628 /* If we just skipped next_boundary, 1627 /* If we just skipped next_boundary,
1629 loop around in the main while 1628 loop around in the main while
1630 and handle it. */ 1629 and handle it. */
@@ -1728,7 +1727,8 @@ of a certain window, pass the window's starting location as FROM
1728and the window's upper-left coordinates as FROMPOS. 1727and the window's upper-left coordinates as FROMPOS.
1729Pass the buffer's (point-max) as TO, to limit the scan to the end of the 1728Pass the buffer's (point-max) as TO, to limit the scan to the end of the
1730visible section of the buffer, and pass LINE and COL as TOPOS. */) 1729visible section of the buffer, and pass LINE and COL as TOPOS. */)
1731 (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos, Lisp_Object width, Lisp_Object offsets, Lisp_Object window) 1730 (Lisp_Object from, Lisp_Object frompos, Lisp_Object to, Lisp_Object topos,
1731 Lisp_Object width, Lisp_Object offsets, Lisp_Object window)
1732{ 1732{
1733 struct window *w; 1733 struct window *w;
1734 Lisp_Object bufpos, hpos, vpos, prevhpos; 1734 Lisp_Object bufpos, hpos, vpos, prevhpos;
@@ -1771,7 +1771,8 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1771 if (XINT (to) < BEGV || XINT (to) > ZV) 1771 if (XINT (to) < BEGV || XINT (to) > ZV)
1772 args_out_of_range_3 (to, make_number (BEGV), make_number (ZV)); 1772 args_out_of_range_3 (to, make_number (BEGV), make_number (ZV));
1773 1773
1774 pos = compute_motion (XINT (from), XINT (XCDR (frompos)), 1774 pos = compute_motion (XINT (from), CHAR_TO_BYTE (XINT (from)),
1775 XINT (XCDR (frompos)),
1775 XINT (XCAR (frompos)), 0, 1776 XINT (XCAR (frompos)), 0,
1776 XINT (to), 1777 XINT (to),
1777 (NILP (topos) 1778 (NILP (topos)
@@ -1793,28 +1794,23 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1793 XSETINT (vpos, pos->vpos); 1794 XSETINT (vpos, pos->vpos);
1794 XSETINT (prevhpos, pos->prevhpos); 1795 XSETINT (prevhpos, pos->prevhpos);
1795 1796
1796 return Fcons (bufpos, 1797 return list5 (bufpos, hpos, vpos, prevhpos, pos->contin ? Qt : Qnil);
1797 Fcons (hpos,
1798 Fcons (vpos,
1799 Fcons (prevhpos,
1800 Fcons (pos->contin ? Qt : Qnil, Qnil)))));
1801
1802} 1798}
1803 1799
1804/* Fvertical_motion and vmotion */ 1800/* Fvertical_motion and vmotion. */
1805 1801
1806static struct position val_vmotion; 1802static struct position val_vmotion;
1807 1803
1808struct position * 1804struct position *
1809vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) 1805vmotion (register ptrdiff_t from, register ptrdiff_t from_byte,
1806 register EMACS_INT vtarget, struct window *w)
1810{ 1807{
1811 ptrdiff_t hscroll = w->hscroll; 1808 ptrdiff_t hscroll = w->hscroll;
1812 struct position pos; 1809 struct position pos;
1813 /* vpos is cumulative vertical position, changed as from is changed */ 1810 /* VPOS is cumulative vertical position, changed as from is changed. */
1814 register EMACS_INT vpos = 0; 1811 register EMACS_INT vpos = 0;
1815 ptrdiff_t prevline; 1812 ptrdiff_t prevline;
1816 register ptrdiff_t first; 1813 register ptrdiff_t first;
1817 ptrdiff_t from_byte;
1818 ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0; 1814 ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0;
1819 ptrdiff_t selective 1815 ptrdiff_t selective
1820 = (INTEGERP (BVAR (current_buffer, selective_display)) 1816 = (INTEGERP (BVAR (current_buffer, selective_display))
@@ -1830,7 +1826,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1830 1826
1831 /* If the window contains this buffer, use it for getting text properties. 1827 /* If the window contains this buffer, use it for getting text properties.
1832 Otherwise use the current buffer as arg for doing that. */ 1828 Otherwise use the current buffer as arg for doing that. */
1833 if (EQ (w->buffer, Fcurrent_buffer ())) 1829 if (EQ (w->contents, Fcurrent_buffer ()))
1834 text_prop_object = window; 1830 text_prop_object = window;
1835 else 1831 else
1836 text_prop_object = Fcurrent_buffer (); 1832 text_prop_object = Fcurrent_buffer ();
@@ -1844,44 +1840,44 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1844 1840
1845 while ((vpos > vtarget || first) && from > BEGV) 1841 while ((vpos > vtarget || first) && from > BEGV)
1846 { 1842 {
1843 ptrdiff_t bytepos = from_byte;
1847 Lisp_Object propval; 1844 Lisp_Object propval;
1848 1845
1849 prevline = find_next_newline_no_quit (from - 1, -1); 1846 prevline = from;
1847 DEC_BOTH (prevline, bytepos);
1848 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1849
1850 while (prevline > BEGV 1850 while (prevline > BEGV
1851 && ((selective > 0 1851 && ((selective > 0
1852 && indented_beyond_p (prevline, 1852 && indented_beyond_p (prevline, bytepos, selective))
1853 CHAR_TO_BYTE (prevline),
1854 selective))
1855 /* Watch out for newlines with `invisible' property. 1853 /* Watch out for newlines with `invisible' property.
1856 When moving upward, check the newline before. */ 1854 When moving upward, check the newline before. */
1857 || (propval = Fget_char_property (make_number (prevline - 1), 1855 || (propval = Fget_char_property (make_number (prevline - 1),
1858 Qinvisible, 1856 Qinvisible,
1859 text_prop_object), 1857 text_prop_object),
1860 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1858 TEXT_PROP_MEANS_INVISIBLE (propval))))
1861 prevline = find_next_newline_no_quit (prevline - 1, -1); 1859 {
1862 pos = *compute_motion (prevline, 0, 1860 DEC_BOTH (prevline, bytepos);
1863 lmargin, 1861 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1864 0, 1862 }
1865 from, 1863 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from,
1866 /* Don't care for VPOS... */ 1864 /* Don't care for VPOS... */
1867 1 << (BITS_PER_SHORT - 1), 1865 1 << (BITS_PER_SHORT - 1),
1868 /* ... nor HPOS. */ 1866 /* ... nor HPOS. */
1869 1 << (BITS_PER_SHORT - 1), 1867 1 << (BITS_PER_SHORT - 1),
1870 -1, hscroll, 1868 -1, hscroll, 0, w);
1871 0,
1872 w);
1873 vpos -= pos.vpos; 1869 vpos -= pos.vpos;
1874 first = 0; 1870 first = 0;
1875 from = prevline; 1871 from = prevline;
1872 from_byte = bytepos;
1876 } 1873 }
1877 1874
1878 /* If we made exactly the desired vertical distance, 1875 /* If we made exactly the desired vertical distance, or
1879 or if we hit beginning of buffer, 1876 if we hit beginning of buffer, return point found. */
1880 return point found */
1881 if (vpos >= vtarget) 1877 if (vpos >= vtarget)
1882 { 1878 {
1883 val_vmotion.bufpos = from; 1879 val_vmotion.bufpos = from;
1884 val_vmotion.bytepos = CHAR_TO_BYTE (from); 1880 val_vmotion.bytepos = from_byte;
1885 val_vmotion.vpos = vpos; 1881 val_vmotion.vpos = vpos;
1886 val_vmotion.hpos = lmargin; 1882 val_vmotion.hpos = lmargin;
1887 val_vmotion.contin = 0; 1883 val_vmotion.contin = 0;
@@ -1889,39 +1885,37 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1889 return &val_vmotion; 1885 return &val_vmotion;
1890 } 1886 }
1891 1887
1892 /* Otherwise find the correct spot by moving down */ 1888 /* Otherwise find the correct spot by moving down. */
1893 } 1889 }
1894 /* Moving downward is simple, but must calculate from beg of line 1890
1895 to determine hpos of starting point */ 1891 /* Moving downward is simple, but must calculate from
1896 from_byte = CHAR_TO_BYTE (from); 1892 beg of line to determine hpos of starting point. */
1893
1897 if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n') 1894 if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n')
1898 { 1895 {
1896 ptrdiff_t bytepos;
1899 Lisp_Object propval; 1897 Lisp_Object propval;
1900 1898
1901 prevline = find_next_newline_no_quit (from, -1); 1899 prevline = find_newline_no_quit (from, from_byte, -1, &bytepos);
1902 while (prevline > BEGV 1900 while (prevline > BEGV
1903 && ((selective > 0 1901 && ((selective > 0
1904 && indented_beyond_p (prevline, 1902 && indented_beyond_p (prevline, bytepos, selective))
1905 CHAR_TO_BYTE (prevline),
1906 selective))
1907 /* Watch out for newlines with `invisible' property. 1903 /* Watch out for newlines with `invisible' property.
1908 When moving downward, check the newline after. */ 1904 When moving downward, check the newline after. */
1909 || (propval = Fget_char_property (make_number (prevline), 1905 || (propval = Fget_char_property (make_number (prevline),
1910 Qinvisible, 1906 Qinvisible,
1911 text_prop_object), 1907 text_prop_object),
1912 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1908 TEXT_PROP_MEANS_INVISIBLE (propval))))
1913 prevline = find_next_newline_no_quit (prevline - 1, -1); 1909 {
1914 pos = *compute_motion (prevline, 0, 1910 DEC_BOTH (prevline, bytepos);
1915 lmargin, 1911 prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos);
1916 0, 1912 }
1917 from, 1913 pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from,
1918 /* Don't care for VPOS... */ 1914 /* Don't care for VPOS... */
1919 1 << (BITS_PER_SHORT - 1), 1915 1 << (BITS_PER_SHORT - 1),
1920 /* ... nor HPOS. */ 1916 /* ... nor HPOS. */
1921 1 << (BITS_PER_SHORT - 1), 1917 1 << (BITS_PER_SHORT - 1),
1922 -1, hscroll, 1918 -1, hscroll, 0, w);
1923 0,
1924 w);
1925 did_motion = 1; 1919 did_motion = 1;
1926 } 1920 }
1927 else 1921 else
@@ -1930,11 +1924,9 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1930 pos.vpos = 0; 1924 pos.vpos = 0;
1931 did_motion = 0; 1925 did_motion = 0;
1932 } 1926 }
1933 return compute_motion (from, vpos, pos.hpos, did_motion, 1927 return compute_motion (from, from_byte, vpos, pos.hpos, did_motion,
1934 ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), 1928 ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)),
1935 -1, hscroll, 1929 -1, hscroll, 0, w);
1936 0,
1937 w);
1938} 1930}
1939 1931
1940DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0, 1932DEFUN ("vertical-motion", Fvertical_motion, Svertical_motion, 1, 2, 0,
@@ -1969,7 +1961,7 @@ whether or not it is currently displayed in some window. */)
1969 struct window *w; 1961 struct window *w;
1970 Lisp_Object old_buffer; 1962 Lisp_Object old_buffer;
1971 EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0); 1963 EMACS_INT old_charpos IF_LINT (= 0), old_bytepos IF_LINT (= 0);
1972 struct gcpro gcpro1, gcpro2, gcpro3; 1964 struct gcpro gcpro1;
1973 Lisp_Object lcols = Qnil; 1965 Lisp_Object lcols = Qnil;
1974 double cols IF_LINT (= 0); 1966 double cols IF_LINT (= 0);
1975 void *itdata = NULL; 1967 void *itdata = NULL;
@@ -1986,22 +1978,22 @@ whether or not it is currently displayed in some window. */)
1986 w = decode_live_window (window); 1978 w = decode_live_window (window);
1987 1979
1988 old_buffer = Qnil; 1980 old_buffer = Qnil;
1989 GCPRO3 (old_buffer, old_charpos, old_bytepos); 1981 GCPRO1 (old_buffer);
1990 if (XBUFFER (w->buffer) != current_buffer) 1982 if (XBUFFER (w->contents) != current_buffer)
1991 { 1983 {
1992 /* Set the window's buffer temporarily to the current buffer. */ 1984 /* Set the window's buffer temporarily to the current buffer. */
1993 old_buffer = w->buffer; 1985 old_buffer = w->contents;
1994 old_charpos = XMARKER (w->pointm)->charpos; 1986 old_charpos = marker_position (w->pointm);
1995 old_bytepos = XMARKER (w->pointm)->bytepos; 1987 old_bytepos = marker_byte_position (w->pointm);
1996 wset_buffer (w, Fcurrent_buffer ()); 1988 wset_buffer (w, Fcurrent_buffer ());
1997 set_marker_both (w->pointm, w->buffer, 1989 set_marker_both (w->pointm, w->contents,
1998 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); 1990 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
1999 } 1991 }
2000 1992
2001 if (noninteractive) 1993 if (noninteractive)
2002 { 1994 {
2003 struct position pos; 1995 struct position pos;
2004 pos = *vmotion (PT, XINT (lines), w); 1996 pos = *vmotion (PT, PT_BYTE, XINT (lines), w);
2005 SET_PT_BOTH (pos.bufpos, pos.bytepos); 1997 SET_PT_BOTH (pos.bufpos, pos.bytepos);
2006 } 1998 }
2007 else 1999 else
@@ -2025,7 +2017,11 @@ whether or not it is currently displayed in some window. */)
2025 const char *s = SSDATA (it.string); 2017 const char *s = SSDATA (it.string);
2026 const char *e = s + SBYTES (it.string); 2018 const char *e = s + SBYTES (it.string);
2027 2019
2028 disp_string_at_start_p = it.string_from_display_prop_p; 2020 /* If it.area is anything but TEXT_AREA, we need not bother
2021 about the display string, as it doesn't affect cursor
2022 positioning. */
2023 disp_string_at_start_p =
2024 it.string_from_display_prop_p && it.area == TEXT_AREA;
2029 while (s < e) 2025 while (s < e)
2030 { 2026 {
2031 if (*s++ == '\n') 2027 if (*s++ == '\n')
@@ -2143,7 +2139,7 @@ whether or not it is currently displayed in some window. */)
2143 if (BUFFERP (old_buffer)) 2139 if (BUFFERP (old_buffer))
2144 { 2140 {
2145 wset_buffer (w, old_buffer); 2141 wset_buffer (w, old_buffer);
2146 set_marker_both (w->pointm, w->buffer, 2142 set_marker_both (w->pointm, w->contents,
2147 old_charpos, old_bytepos); 2143 old_charpos, old_bytepos);
2148 } 2144 }
2149 2145