comparison src/indent.c @ 58396:60b3e92b3dd4

(Fvertical_motion): Fix last change. Use another method to detect if iterator moved too far ahead after reseat.
author Kim F. Storm <storm@cua.dk>
date Sun, 21 Nov 2004 12:56:53 +0000
parents ae080fc5eb58
children 4fcc66cf0b9c 2a3f27a45698
comparison
equal deleted inserted replaced
58395:c2e1b8d54550 58396:60b3e92b3dd4
2067 pos = *vmotion (PT, XINT (lines), w); 2067 pos = *vmotion (PT, XINT (lines), w);
2068 SET_PT_BOTH (pos.bufpos, pos.bytepos); 2068 SET_PT_BOTH (pos.bufpos, pos.bytepos);
2069 } 2069 }
2070 else 2070 else
2071 { 2071 {
2072 int it_start;
2073
2072 SET_TEXT_POS (pt, PT, PT_BYTE); 2074 SET_TEXT_POS (pt, PT, PT_BYTE);
2073 start_display (&it, w, pt); 2075 start_display (&it, w, pt);
2074 2076
2075 /* Scan from the start of the line containing PT. If we don't 2077 /* Scan from the start of the line containing PT. If we don't
2076 do this, we start moving with IT->current_x == 0, while PT is 2078 do this, we start moving with IT->current_x == 0, while PT is
2077 really at some x > 0. The effect is, in continuation lines, that 2079 really at some x > 0. The effect is, in continuation lines, that
2078 we end up with the iterator placed at where it thinks X is 0, 2080 we end up with the iterator placed at where it thinks X is 0,
2079 while the end position is really at some X > 0, the same X that 2081 while the end position is really at some X > 0, the same X that
2080 PT had. */ 2082 PT had. */
2083 it_start = IT_CHARPOS (it);
2081 reseat_at_previous_visible_line_start (&it); 2084 reseat_at_previous_visible_line_start (&it);
2082 it.current_x = it.hpos = 0; 2085 it.current_x = it.hpos = 0;
2083 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 2086 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
2084 2087
2085 /* Move back if we got too far. This may happen if 2088 /* Move back if we got too far. This may happen if
2086 truncate-lines is on and PT is beyond right margin. */ 2089 truncate-lines is on and PT is beyond right margin. */
2087 if (IT_CHARPOS (it) > PT && it.vpos > 0 && XINT (lines) > 0) 2090 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0)
2088 move_it_by_lines (&it, -1, 0); 2091 move_it_by_lines (&it, -1, 0);
2089 2092
2090 it.vpos = 0; 2093 it.vpos = 0;
2091 if (XINT (lines) != 0) 2094 if (XINT (lines) != 0)
2092 move_it_by_lines (&it, XINT (lines), 0); 2095 move_it_by_lines (&it, XINT (lines), 0);