# HG changeset patch # User Richard M. Stallman # Date 1098874660 0 # Node ID 32217d296ff371f622880acc6fdb390a3c994941 # Parent bf99e505dd7af89d42f031bc01bd5d1959a1d080 (vmotion): When moving up, check the newline before. Make prevline an int, not a Lisp_Object. diff -r bf99e505dd7a -r 32217d296ff3 src/indent.c --- a/src/indent.c Wed Oct 27 10:27:46 2004 +0000 +++ b/src/indent.c Wed Oct 27 10:57:40 2004 +0000 @@ -1883,7 +1883,7 @@ struct position pos; /* vpos is cumulative vertical position, changed as from is changed */ register int vpos = 0; - Lisp_Object prevline; + int prevline; register int first; int from_byte; int lmargin = hscroll > 0 ? 1 - hscroll : 0; @@ -1917,23 +1917,21 @@ { Lisp_Object propval; - XSETFASTINT (prevline, find_next_newline_no_quit (from - 1, -1)); - while (XFASTINT (prevline) > BEGV + prevline = find_next_newline_no_quit (from - 1, -1); + while (prevline > BEGV && ((selective > 0 - && indented_beyond_p (XFASTINT (prevline), - CHAR_TO_BYTE (XFASTINT (prevline)), + && indented_beyond_p (prevline, + CHAR_TO_BYTE (prevline), (double) selective)) /* iftc */ - /* watch out for newlines with `invisible' property */ - || (propval = Fget_char_property (prevline, + /* Watch out for newlines with `invisible' property. + When moving upward, check the newline before. */ + || (propval = Fget_char_property (make_number (prevline - 1), Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - XSETFASTINT (prevline, - find_next_newline_no_quit (XFASTINT (prevline) - 1, - -1)); - pos = *compute_motion (XFASTINT (prevline), 0, - lmargin + (XFASTINT (prevline) == BEG - ? start_hpos : 0), + prevline = find_next_newline_no_quit (prevline - 1, -1); + pos = *compute_motion (prevline, 0, + lmargin + (prevline == BEG ? start_hpos : 0), 0, from, /* Don't care for VPOS... */ @@ -1944,12 +1942,11 @@ /* This compensates for start_hpos so that a tab as first character still occupies 8 columns. */ - (XFASTINT (prevline) == BEG - ? -start_hpos : 0), + (prevline == BEG ? -start_hpos : 0), w); vpos -= pos.vpos; first = 0; - from = XFASTINT (prevline); + from = prevline; } /* If we made exactly the desired vertical distance, @@ -1977,21 +1974,21 @@ { Lisp_Object propval; - XSETFASTINT (prevline, find_next_newline_no_quit (from, -1)); - while (XFASTINT (prevline) > BEGV + prevline = find_next_newline_no_quit (from, -1); + while (prevline > BEGV && ((selective > 0 - && indented_beyond_p (XFASTINT (prevline), - CHAR_TO_BYTE (XFASTINT (prevline)), + && indented_beyond_p (prevline, + CHAR_TO_BYTE (prevline), (double) selective)) /* iftc */ - /* watch out for newlines with `invisible' property */ - || (propval = Fget_char_property (prevline, Qinvisible, + /* Watch out for newlines with `invisible' property. + When moving downward, check the newline after. */ + || (propval = Fget_char_property (make_number (prevline), + Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - XSETFASTINT (prevline, - find_next_newline_no_quit (XFASTINT (prevline) - 1, - -1)); - pos = *compute_motion (XFASTINT (prevline), 0, - lmargin + (XFASTINT (prevline) == BEG + prevline = find_next_newline_no_quit (prevline - 1, -1); + pos = *compute_motion (prevline, 0, + lmargin + (prevline == BEG ? start_hpos : 0), 0, from, @@ -2000,7 +1997,7 @@ /* ... nor HPOS. */ 1 << (BITS_PER_SHORT - 1), -1, hscroll, - (XFASTINT (prevline) == BEG ? -start_hpos : 0), + (prevline == BEG ? -start_hpos : 0), w); did_motion = 1; }