1131 |
|
|
1132 |
WIDTH is the number of columns available to display text; |
WIDTH is the number of columns available to display text; |
1133 |
compute_motion uses this to handle continuation lines and such. |
compute_motion uses this to handle continuation lines and such. |
1134 |
|
If WIDTH is -1, use width of window's text area adjusted for |
1135 |
|
continuation glyph when needed. |
1136 |
|
|
1137 |
HSCROLL is the number of columns not being displayed at the left |
HSCROLL is the number of columns not being displayed at the left |
1138 |
margin; this is usually taken from a window's hscroll member. |
margin; this is usually taken from a window's hscroll member. |
1139 |
TAB_OFFSET is the number of columns of the first tab that aren't |
TAB_OFFSET is the number of columns of the first tab that aren't |
1231 |
int prev_vpos = 0; |
int prev_vpos = 0; |
1232 |
int contin_hpos; /* HPOS of last column of continued line. */ |
int contin_hpos; /* HPOS of last column of continued line. */ |
1233 |
int prev_tab_offset; /* Previous tab offset. */ |
int prev_tab_offset; /* Previous tab offset. */ |
1234 |
|
int continuation_glyph_width; |
1235 |
|
|
1236 |
XSETBUFFER (buffer, current_buffer); |
XSETBUFFER (buffer, current_buffer); |
1237 |
XSETWINDOW (window, win); |
XSETWINDOW (window, win); |
1249 |
if (tab_width <= 0 || tab_width > 1000) |
if (tab_width <= 0 || tab_width > 1000) |
1250 |
tab_width = 8; |
tab_width = 8; |
1251 |
|
|
1252 |
|
/* Negative width means use all available text columns. */ |
1253 |
|
if (width < 0) |
1254 |
|
{ |
1255 |
|
width = window_box_text_cols (win); |
1256 |
|
/* We must make room for continuation marks if we don't have fringes. */ |
1257 |
|
#ifdef HAVE_WINDOW_SYSTEM |
1258 |
|
if (!FRAME_WINDOW_P (XFRAME (win->frame))) |
1259 |
|
#endif |
1260 |
|
width -= 1; |
1261 |
|
} |
1262 |
|
|
1263 |
|
continuation_glyph_width = 1; |
1264 |
|
#ifdef HAVE_WINDOW_SYSTEM |
1265 |
|
if (FRAME_WINDOW_P (XFRAME (win->frame))) |
1266 |
|
continuation_glyph_width = 0; /* In the fringe. */ |
1267 |
|
#endif |
1268 |
|
|
1269 |
immediate_quit = 1; |
immediate_quit = 1; |
1270 |
QUIT; |
QUIT; |
1271 |
|
|
1389 |
{ |
{ |
1390 |
if (hscroll |
if (hscroll |
1391 |
|| (truncate_partial_width_windows |
|| (truncate_partial_width_windows |
1392 |
&& width + 1 < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))) |
&& ((width + continuation_glyph_width) |
1393 |
|
< FRAME_COLS (XFRAME (WINDOW_FRAME (win))))) |
1394 |
|| !NILP (current_buffer->truncate_lines)) |
|| !NILP (current_buffer->truncate_lines)) |
1395 |
{ |
{ |
1396 |
/* Truncating: skip to newline, unless we are already past |
/* Truncating: skip to newline, unless we are already past |
1674 |
hpos -= hscroll; |
hpos -= hscroll; |
1675 |
/* Count the truncation glyph on column 0 */ |
/* Count the truncation glyph on column 0 */ |
1676 |
if (hscroll > 0) |
if (hscroll > 0) |
1677 |
hpos++; |
hpos += continuation_glyph_width; |
1678 |
tab_offset = 0; |
tab_offset = 0; |
1679 |
} |
} |
1680 |
contin_hpos = 0; |
contin_hpos = 0; |
1759 |
to position TO or position TOPOS--another cons of the form (HPOS . VPOS)-- |
to position TO or position TOPOS--another cons of the form (HPOS . VPOS)-- |
1760 |
and return the ending buffer position and screen location. |
and return the ending buffer position and screen location. |
1761 |
|
|
1762 |
|
If TOPOS is nil, the actual width and height of the window's |
1763 |
|
text area are used. |
1764 |
|
|
1765 |
There are three additional arguments: |
There are three additional arguments: |
1766 |
|
|
1767 |
WIDTH is the number of columns available to display text; |
WIDTH is the number of columns available to display text; |
1768 |
this affects handling of continuation lines. |
this affects handling of continuation lines. A value of nil |
1769 |
This is usually the value returned by `window-width', less one (to allow |
corresponds to the actual number of available text columns. |
|
for the continuation glyph). |
|
1770 |
|
|
1771 |
OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET). |
OFFSETS is either nil or a cons cell (HSCROLL . TAB-OFFSET). |
1772 |
HSCROLL is the number of columns not being displayed at the left |
HSCROLL is the number of columns not being displayed at the left |
1798 |
Lisp_Object from, frompos, to, topos; |
Lisp_Object from, frompos, to, topos; |
1799 |
Lisp_Object width, offsets, window; |
Lisp_Object width, offsets, window; |
1800 |
{ |
{ |
1801 |
|
struct window *w; |
1802 |
Lisp_Object bufpos, hpos, vpos, prevhpos; |
Lisp_Object bufpos, hpos, vpos, prevhpos; |
1803 |
struct position *pos; |
struct position *pos; |
1804 |
int hscroll, tab_offset; |
int hscroll, tab_offset; |
1808 |
CHECK_NUMBER_CAR (frompos); |
CHECK_NUMBER_CAR (frompos); |
1809 |
CHECK_NUMBER_CDR (frompos); |
CHECK_NUMBER_CDR (frompos); |
1810 |
CHECK_NUMBER_COERCE_MARKER (to); |
CHECK_NUMBER_COERCE_MARKER (to); |
1811 |
CHECK_CONS (topos); |
if (!NILP (topos)) |
1812 |
CHECK_NUMBER_CAR (topos); |
{ |
1813 |
CHECK_NUMBER_CDR (topos); |
CHECK_CONS (topos); |
1814 |
CHECK_NUMBER (width); |
CHECK_NUMBER_CAR (topos); |
1815 |
|
CHECK_NUMBER_CDR (topos); |
1816 |
|
} |
1817 |
|
if (!NILP (width)) |
1818 |
|
CHECK_NUMBER (width); |
1819 |
|
|
1820 |
if (!NILP (offsets)) |
if (!NILP (offsets)) |
1821 |
{ |
{ |
1822 |
CHECK_CONS (offsets); |
CHECK_CONS (offsets); |
1832 |
window = Fselected_window (); |
window = Fselected_window (); |
1833 |
else |
else |
1834 |
CHECK_LIVE_WINDOW (window); |
CHECK_LIVE_WINDOW (window); |
1835 |
|
w = XWINDOW (window); |
1836 |
|
|
1837 |
if (XINT (from) < BEGV || XINT (from) > ZV) |
if (XINT (from) < BEGV || XINT (from) > ZV) |
1838 |
args_out_of_range_3 (from, make_number (BEGV), make_number (ZV)); |
args_out_of_range_3 (from, make_number (BEGV), make_number (ZV)); |
1841 |
|
|
1842 |
pos = compute_motion (XINT (from), XINT (XCDR (frompos)), |
pos = compute_motion (XINT (from), XINT (XCDR (frompos)), |
1843 |
XINT (XCAR (frompos)), 0, |
XINT (XCAR (frompos)), 0, |
1844 |
XINT (to), XINT (XCDR (topos)), |
XINT (to), |
1845 |
XINT (XCAR (topos)), |
(NILP (topos) |
1846 |
XINT (width), hscroll, tab_offset, |
? window_internal_height (w) |
1847 |
|
: XINT (XCDR (topos))), |
1848 |
|
(NILP (topos) |
1849 |
|
? (window_box_text_cols (w) |
1850 |
|
- ( |
1851 |
|
#ifdef HAVE_WINDOW_SYSTEM |
1852 |
|
FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 : |
1853 |
|
#endif |
1854 |
|
1)) |
1855 |
|
: XINT (XCAR (topos))), |
1856 |
|
(NILP (width) ? -1 : XINT (width)), |
1857 |
|
hscroll, tab_offset, |
1858 |
XWINDOW (window)); |
XWINDOW (window)); |
1859 |
|
|
1860 |
XSETFASTINT (bufpos, pos->bufpos); |
XSETFASTINT (bufpos, pos->bufpos); |
1879 |
register int from, vtarget; |
register int from, vtarget; |
1880 |
struct window *w; |
struct window *w; |
1881 |
{ |
{ |
|
int width = window_box_text_cols (w); |
|
1882 |
int hscroll = XINT (w->hscroll); |
int hscroll = XINT (w->hscroll); |
1883 |
struct position pos; |
struct position pos; |
1884 |
/* vpos is cumulative vertical position, changed as from is changed */ |
/* vpos is cumulative vertical position, changed as from is changed */ |
1899 |
|
|
1900 |
XSETWINDOW (window, w); |
XSETWINDOW (window, w); |
1901 |
|
|
|
/* We must make room for continuation marks if we don't have fringes. */ |
|
|
#ifdef HAVE_WINDOW_SYSTEM |
|
|
if (!FRAME_WINDOW_P (XFRAME (w->frame))) |
|
|
#endif |
|
|
width -= 1; |
|
|
|
|
1902 |
/* If the window contains this buffer, use it for getting text properties. |
/* If the window contains this buffer, use it for getting text properties. |
1903 |
Otherwise use the current buffer as arg for doing that. */ |
Otherwise use the current buffer as arg for doing that. */ |
1904 |
if (EQ (w->buffer, Fcurrent_buffer ())) |
if (EQ (w->buffer, Fcurrent_buffer ())) |
1940 |
1 << (BITS_PER_SHORT - 1), |
1 << (BITS_PER_SHORT - 1), |
1941 |
/* ... nor HPOS. */ |
/* ... nor HPOS. */ |
1942 |
1 << (BITS_PER_SHORT - 1), |
1 << (BITS_PER_SHORT - 1), |
1943 |
width, hscroll, |
-1, hscroll, |
1944 |
/* This compensates for start_hpos |
/* This compensates for start_hpos |
1945 |
so that a tab as first character |
so that a tab as first character |
1946 |
still occupies 8 columns. */ |
still occupies 8 columns. */ |
1999 |
1 << (BITS_PER_SHORT - 1), |
1 << (BITS_PER_SHORT - 1), |
2000 |
/* ... nor HPOS. */ |
/* ... nor HPOS. */ |
2001 |
1 << (BITS_PER_SHORT - 1), |
1 << (BITS_PER_SHORT - 1), |
2002 |
width, hscroll, |
-1, hscroll, |
2003 |
(XFASTINT (prevline) == BEG ? -start_hpos : 0), |
(XFASTINT (prevline) == BEG ? -start_hpos : 0), |
2004 |
w); |
w); |
2005 |
did_motion = 1; |
did_motion = 1; |
2013 |
} |
} |
2014 |
return compute_motion (from, vpos, pos.hpos, did_motion, |
return compute_motion (from, vpos, pos.hpos, did_motion, |
2015 |
ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), |
ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), |
2016 |
width, hscroll, |
-1, hscroll, |
2017 |
pos.tab_offset - (from == BEG ? start_hpos : 0), |
pos.tab_offset - (from == BEG ? start_hpos : 0), |
2018 |
w); |
w); |
2019 |
} |
} |