comparison src/indent.c @ 57734:32217d296ff3

(vmotion): When moving up, check the newline before. Make prevline an int, not a Lisp_Object.
author Richard M. Stallman <rms@gnu.org>
date Wed, 27 Oct 2004 10:57:40 +0000
parents 5b9242222549
children fd88ccc2e4cf 4056279af756 e24e2e78deda
comparison
equal deleted inserted replaced
57733:bf99e505dd7a 57734:32217d296ff3
1881 { 1881 {
1882 int hscroll = XINT (w->hscroll); 1882 int hscroll = XINT (w->hscroll);
1883 struct position pos; 1883 struct position pos;
1884 /* vpos is cumulative vertical position, changed as from is changed */ 1884 /* vpos is cumulative vertical position, changed as from is changed */
1885 register int vpos = 0; 1885 register int vpos = 0;
1886 Lisp_Object prevline; 1886 int prevline;
1887 register int first; 1887 register int first;
1888 int from_byte; 1888 int from_byte;
1889 int lmargin = hscroll > 0 ? 1 - hscroll : 0; 1889 int lmargin = hscroll > 0 ? 1 - hscroll : 0;
1890 int selective 1890 int selective
1891 = (INTEGERP (current_buffer->selective_display) 1891 = (INTEGERP (current_buffer->selective_display)
1915 1915
1916 while ((vpos > vtarget || first) && from > BEGV) 1916 while ((vpos > vtarget || first) && from > BEGV)
1917 { 1917 {
1918 Lisp_Object propval; 1918 Lisp_Object propval;
1919 1919
1920 XSETFASTINT (prevline, find_next_newline_no_quit (from - 1, -1)); 1920 prevline = find_next_newline_no_quit (from - 1, -1);
1921 while (XFASTINT (prevline) > BEGV 1921 while (prevline > BEGV
1922 && ((selective > 0 1922 && ((selective > 0
1923 && indented_beyond_p (XFASTINT (prevline), 1923 && indented_beyond_p (prevline,
1924 CHAR_TO_BYTE (XFASTINT (prevline)), 1924 CHAR_TO_BYTE (prevline),
1925 (double) selective)) /* iftc */ 1925 (double) selective)) /* iftc */
1926 /* watch out for newlines with `invisible' property */ 1926 /* Watch out for newlines with `invisible' property.
1927 || (propval = Fget_char_property (prevline, 1927 When moving upward, check the newline before. */
1928 || (propval = Fget_char_property (make_number (prevline - 1),
1928 Qinvisible, 1929 Qinvisible,
1929 text_prop_object), 1930 text_prop_object),
1930 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1931 TEXT_PROP_MEANS_INVISIBLE (propval))))
1931 XSETFASTINT (prevline, 1932 prevline = find_next_newline_no_quit (prevline - 1, -1);
1932 find_next_newline_no_quit (XFASTINT (prevline) - 1, 1933 pos = *compute_motion (prevline, 0,
1933 -1)); 1934 lmargin + (prevline == BEG ? start_hpos : 0),
1934 pos = *compute_motion (XFASTINT (prevline), 0,
1935 lmargin + (XFASTINT (prevline) == BEG
1936 ? start_hpos : 0),
1937 0, 1935 0,
1938 from, 1936 from,
1939 /* Don't care for VPOS... */ 1937 /* Don't care for VPOS... */
1940 1 << (BITS_PER_SHORT - 1), 1938 1 << (BITS_PER_SHORT - 1),
1941 /* ... nor HPOS. */ 1939 /* ... nor HPOS. */
1942 1 << (BITS_PER_SHORT - 1), 1940 1 << (BITS_PER_SHORT - 1),
1943 -1, hscroll, 1941 -1, hscroll,
1944 /* This compensates for start_hpos 1942 /* This compensates for start_hpos
1945 so that a tab as first character 1943 so that a tab as first character
1946 still occupies 8 columns. */ 1944 still occupies 8 columns. */
1947 (XFASTINT (prevline) == BEG 1945 (prevline == BEG ? -start_hpos : 0),
1948 ? -start_hpos : 0),
1949 w); 1946 w);
1950 vpos -= pos.vpos; 1947 vpos -= pos.vpos;
1951 first = 0; 1948 first = 0;
1952 from = XFASTINT (prevline); 1949 from = prevline;
1953 } 1950 }
1954 1951
1955 /* If we made exactly the desired vertical distance, 1952 /* If we made exactly the desired vertical distance,
1956 or if we hit beginning of buffer, 1953 or if we hit beginning of buffer,
1957 return point found */ 1954 return point found */
1975 from_byte = CHAR_TO_BYTE (from); 1972 from_byte = CHAR_TO_BYTE (from);
1976 if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n') 1973 if (from > BEGV && FETCH_BYTE (from_byte - 1) != '\n')
1977 { 1974 {
1978 Lisp_Object propval; 1975 Lisp_Object propval;
1979 1976
1980 XSETFASTINT (prevline, find_next_newline_no_quit (from, -1)); 1977 prevline = find_next_newline_no_quit (from, -1);
1981 while (XFASTINT (prevline) > BEGV 1978 while (prevline > BEGV
1982 && ((selective > 0 1979 && ((selective > 0
1983 && indented_beyond_p (XFASTINT (prevline), 1980 && indented_beyond_p (prevline,
1984 CHAR_TO_BYTE (XFASTINT (prevline)), 1981 CHAR_TO_BYTE (prevline),
1985 (double) selective)) /* iftc */ 1982 (double) selective)) /* iftc */
1986 /* watch out for newlines with `invisible' property */ 1983 /* Watch out for newlines with `invisible' property.
1987 || (propval = Fget_char_property (prevline, Qinvisible, 1984 When moving downward, check the newline after. */
1985 || (propval = Fget_char_property (make_number (prevline),
1986 Qinvisible,
1988 text_prop_object), 1987 text_prop_object),
1989 TEXT_PROP_MEANS_INVISIBLE (propval)))) 1988 TEXT_PROP_MEANS_INVISIBLE (propval))))
1990 XSETFASTINT (prevline, 1989 prevline = find_next_newline_no_quit (prevline - 1, -1);
1991 find_next_newline_no_quit (XFASTINT (prevline) - 1, 1990 pos = *compute_motion (prevline, 0,
1992 -1)); 1991 lmargin + (prevline == BEG
1993 pos = *compute_motion (XFASTINT (prevline), 0,
1994 lmargin + (XFASTINT (prevline) == BEG
1995 ? start_hpos : 0), 1992 ? start_hpos : 0),
1996 0, 1993 0,
1997 from, 1994 from,
1998 /* Don't care for VPOS... */ 1995 /* Don't care for VPOS... */
1999 1 << (BITS_PER_SHORT - 1), 1996 1 << (BITS_PER_SHORT - 1),
2000 /* ... nor HPOS. */ 1997 /* ... nor HPOS. */
2001 1 << (BITS_PER_SHORT - 1), 1998 1 << (BITS_PER_SHORT - 1),
2002 -1, hscroll, 1999 -1, hscroll,
2003 (XFASTINT (prevline) == BEG ? -start_hpos : 0), 2000 (prevline == BEG ? -start_hpos : 0),
2004 w); 2001 w);
2005 did_motion = 1; 2002 did_motion = 1;
2006 } 2003 }
2007 else 2004 else
2008 { 2005 {