aboutsummaryrefslogtreecommitdiffstats
path: root/src/indent.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-08-03 12:45:59 +0000
committerKaroly Lorentey2004-08-03 12:45:59 +0000
commit4fce8dfae60dce6a19bef88ce893bcc019576c66 (patch)
tree41dcfb7ebfda8af1faba9e2833283f3dd1fba472 /src/indent.c
parentd0e37e4839b378aa90ba6686013f9563cc3c0821 (diff)
parented5c373cab5483317a8b6fca3d8d4d52432934fc (diff)
downloademacs-4fce8dfae60dce6a19bef88ce893bcc019576c66.tar.gz
emacs-4fce8dfae60dce6a19bef88ce893bcc019576c66.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-473 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-474 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-475 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-476 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-477 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-478 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-225
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c79
1 files changed, 57 insertions, 22 deletions
diff --git a/src/indent.c b/src/indent.c
index 1dc5c91fbad..d6fea34f5f5 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1133,6 +1133,9 @@ struct position val_compute_motion;
1133 1133
1134 WIDTH is the number of columns available to display text; 1134 WIDTH is the number of columns available to display text;
1135 compute_motion uses this to handle continuation lines and such. 1135 compute_motion uses this to handle continuation lines and such.
1136 If WIDTH is -1, use width of window's text area adjusted for
1137 continuation glyph when needed.
1138
1136 HSCROLL is the number of columns not being displayed at the left 1139 HSCROLL is the number of columns not being displayed at the left
1137 margin; this is usually taken from a window's hscroll member. 1140 margin; this is usually taken from a window's hscroll member.
1138 TAB_OFFSET is the number of columns of the first tab that aren't 1141 TAB_OFFSET is the number of columns of the first tab that aren't
@@ -1230,6 +1233,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
1230 int prev_vpos = 0; 1233 int prev_vpos = 0;
1231 int contin_hpos; /* HPOS of last column of continued line. */ 1234 int contin_hpos; /* HPOS of last column of continued line. */
1232 int prev_tab_offset; /* Previous tab offset. */ 1235 int prev_tab_offset; /* Previous tab offset. */
1236 int continuation_glyph_width;
1233 1237
1234 XSETBUFFER (buffer, current_buffer); 1238 XSETBUFFER (buffer, current_buffer);
1235 XSETWINDOW (window, win); 1239 XSETWINDOW (window, win);
@@ -1247,6 +1251,23 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
1247 if (tab_width <= 0 || tab_width > 1000) 1251 if (tab_width <= 0 || tab_width > 1000)
1248 tab_width = 8; 1252 tab_width = 8;
1249 1253
1254 /* Negative width means use all available text columns. */
1255 if (width < 0)
1256 {
1257 width = window_box_text_cols (win);
1258 /* We must make room for continuation marks if we don't have fringes. */
1259#ifdef HAVE_WINDOW_SYSTEM
1260 if (!FRAME_WINDOW_P (XFRAME (win->frame)))
1261#endif
1262 width -= 1;
1263 }
1264
1265 continuation_glyph_width = 0;
1266#ifdef HAVE_WINDOW_SYSTEM
1267 if (!FRAME_WINDOW_P (XFRAME (win->frame)))
1268 continuation_glyph_width = 1;
1269#endif
1270
1250 immediate_quit = 1; 1271 immediate_quit = 1;
1251 QUIT; 1272 QUIT;
1252 1273
@@ -1370,7 +1391,8 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
1370 { 1391 {
1371 if (hscroll 1392 if (hscroll
1372 || (truncate_partial_width_windows 1393 || (truncate_partial_width_windows
1373 && width + 1 < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))) 1394 && ((width + continuation_glyph_width)
1395 < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))))
1374 || !NILP (current_buffer->truncate_lines)) 1396 || !NILP (current_buffer->truncate_lines))
1375 { 1397 {
1376 /* Truncating: skip to newline, unless we are already past 1398 /* Truncating: skip to newline, unless we are already past
@@ -1654,7 +1676,7 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width,
1654 hpos -= hscroll; 1676 hpos -= hscroll;
1655 /* Count the truncation glyph on column 0 */ 1677 /* Count the truncation glyph on column 0 */
1656 if (hscroll > 0) 1678 if (hscroll > 0)
1657 hpos++; 1679 hpos += continuation_glyph_width;
1658 tab_offset = 0; 1680 tab_offset = 0;
1659 } 1681 }
1660 contin_hpos = 0; 1682 contin_hpos = 0;
@@ -1739,12 +1761,14 @@ assuming it is at position FROMPOS--a cons of the form (HPOS . VPOS)--
1739to position TO or position TOPOS--another cons of the form (HPOS . VPOS)-- 1761to position TO or position TOPOS--another cons of the form (HPOS . VPOS)--
1740and return the ending buffer position and screen location. 1762and return the ending buffer position and screen location.
1741 1763
1764If TOPOS is nil, the actual width and height of the window's
1765text area are used.
1766
1742There are three additional arguments: 1767There are three additional arguments:
1743 1768
1744WIDTH is the number of columns available to display text; 1769WIDTH is the number of columns available to display text;
1745this affects handling of continuation lines. 1770this affects handling of continuation lines. A value of nil
1746This is usually the value returned by `window-width', less one (to allow 1771corresponds to the actual number of available text columns.
1747for the continuation glyph).
1748 1772
1749OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET). 1773OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET).
1750HSCROLL is the number of columns not being displayed at the left 1774HSCROLL is the number of columns not being displayed at the left
@@ -1776,6 +1800,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1776 Lisp_Object from, frompos, to, topos; 1800 Lisp_Object from, frompos, to, topos;
1777 Lisp_Object width, offsets, window; 1801 Lisp_Object width, offsets, window;
1778{ 1802{
1803 struct window *w;
1779 Lisp_Object bufpos, hpos, vpos, prevhpos; 1804 Lisp_Object bufpos, hpos, vpos, prevhpos;
1780 struct position *pos; 1805 struct position *pos;
1781 int hscroll, tab_offset; 1806 int hscroll, tab_offset;
@@ -1785,10 +1810,15 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1785 CHECK_NUMBER_CAR (frompos); 1810 CHECK_NUMBER_CAR (frompos);
1786 CHECK_NUMBER_CDR (frompos); 1811 CHECK_NUMBER_CDR (frompos);
1787 CHECK_NUMBER_COERCE_MARKER (to); 1812 CHECK_NUMBER_COERCE_MARKER (to);
1788 CHECK_CONS (topos); 1813 if (!NILP (topos))
1789 CHECK_NUMBER_CAR (topos); 1814 {
1790 CHECK_NUMBER_CDR (topos); 1815 CHECK_CONS (topos);
1791 CHECK_NUMBER (width); 1816 CHECK_NUMBER_CAR (topos);
1817 CHECK_NUMBER_CDR (topos);
1818 }
1819 if (!NILP (width))
1820 CHECK_NUMBER (width);
1821
1792 if (!NILP (offsets)) 1822 if (!NILP (offsets))
1793 { 1823 {
1794 CHECK_CONS (offsets); 1824 CHECK_CONS (offsets);
@@ -1804,6 +1834,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1804 window = Fselected_window (); 1834 window = Fselected_window ();
1805 else 1835 else
1806 CHECK_LIVE_WINDOW (window); 1836 CHECK_LIVE_WINDOW (window);
1837 w = XWINDOW (window);
1807 1838
1808 if (XINT (from) < BEGV || XINT (from) > ZV) 1839 if (XINT (from) < BEGV || XINT (from) > ZV)
1809 args_out_of_range_3 (from, make_number (BEGV), make_number (ZV)); 1840 args_out_of_range_3 (from, make_number (BEGV), make_number (ZV));
@@ -1812,9 +1843,20 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
1812 1843
1813 pos = compute_motion (XINT (from), XINT (XCDR (frompos)), 1844 pos = compute_motion (XINT (from), XINT (XCDR (frompos)),
1814 XINT (XCAR (frompos)), 0, 1845 XINT (XCAR (frompos)), 0,
1815 XINT (to), XINT (XCDR (topos)), 1846 XINT (to),
1816 XINT (XCAR (topos)), 1847 (NILP (topos)
1817 XINT (width), hscroll, tab_offset, 1848 ? window_internal_height (w)
1849 : XINT (XCDR (topos))),
1850 (NILP (topos)
1851 ? (window_box_text_cols (w)
1852 - (
1853#ifdef HAVE_WINDOW_SYSTEM
1854 FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 :
1855#endif
1856 1))
1857 : XINT (XCAR (topos))),
1858 (NILP (width) ? -1 : XINT (width)),
1859 hscroll, tab_offset,
1818 XWINDOW (window)); 1860 XWINDOW (window));
1819 1861
1820 XSETFASTINT (bufpos, pos->bufpos); 1862 XSETFASTINT (bufpos, pos->bufpos);
@@ -1839,7 +1881,6 @@ vmotion (from, vtarget, w)
1839 register int from, vtarget; 1881 register int from, vtarget;
1840 struct window *w; 1882 struct window *w;
1841{ 1883{
1842 int width = window_box_text_cols (w);
1843 int hscroll = XINT (w->hscroll); 1884 int hscroll = XINT (w->hscroll);
1844 struct position pos; 1885 struct position pos;
1845 /* vpos is cumulative vertical position, changed as from is changed */ 1886 /* vpos is cumulative vertical position, changed as from is changed */
@@ -1860,12 +1901,6 @@ vmotion (from, vtarget, w)
1860 1901
1861 XSETWINDOW (window, w); 1902 XSETWINDOW (window, w);
1862 1903
1863 /* We must make room for continuation marks if we don't have fringes. */
1864#ifdef HAVE_WINDOW_SYSTEM
1865 if (!FRAME_WINDOW_P (XFRAME (w->frame)))
1866#endif
1867 width -= 1;
1868
1869 /* If the window contains this buffer, use it for getting text properties. 1904 /* If the window contains this buffer, use it for getting text properties.
1870 Otherwise use the current buffer as arg for doing that. */ 1905 Otherwise use the current buffer as arg for doing that. */
1871 if (EQ (w->buffer, Fcurrent_buffer ())) 1906 if (EQ (w->buffer, Fcurrent_buffer ()))
@@ -1907,7 +1942,7 @@ vmotion (from, vtarget, w)
1907 1 << (BITS_PER_SHORT - 1), 1942 1 << (BITS_PER_SHORT - 1),
1908 /* ... nor HPOS. */ 1943 /* ... nor HPOS. */
1909 1 << (BITS_PER_SHORT - 1), 1944 1 << (BITS_PER_SHORT - 1),
1910 width, hscroll, 1945 -1, hscroll,
1911 /* This compensates for start_hpos 1946 /* This compensates for start_hpos
1912 so that a tab as first character 1947 so that a tab as first character
1913 still occupies 8 columns. */ 1948 still occupies 8 columns. */
@@ -1966,7 +2001,7 @@ vmotion (from, vtarget, w)
1966 1 << (BITS_PER_SHORT - 1), 2001 1 << (BITS_PER_SHORT - 1),
1967 /* ... nor HPOS. */ 2002 /* ... nor HPOS. */
1968 1 << (BITS_PER_SHORT - 1), 2003 1 << (BITS_PER_SHORT - 1),
1969 width, hscroll, 2004 -1, hscroll,
1970 (XFASTINT (prevline) == BEG ? -start_hpos : 0), 2005 (XFASTINT (prevline) == BEG ? -start_hpos : 0),
1971 w); 2006 w);
1972 did_motion = 1; 2007 did_motion = 1;
@@ -1980,7 +2015,7 @@ vmotion (from, vtarget, w)
1980 } 2015 }
1981 return compute_motion (from, vpos, pos.hpos, did_motion, 2016 return compute_motion (from, vpos, pos.hpos, did_motion,
1982 ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), 2017 ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)),
1983 width, hscroll, 2018 -1, hscroll,
1984 pos.tab_offset - (from == BEG ? start_hpos : 0), 2019 pos.tab_offset - (from == BEG ? start_hpos : 0),
1985 w); 2020 w);
1986} 2021}