Mercurial > emacs
comparison src/indent.c @ 64282:769e8d799acf
(Fvertical_motion): If start position is on an image,
don't move back if we move too far (that's almost certain to happen).
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 13 Jul 2005 10:02:58 +0000 |
parents | a8fa7c632ee4 |
children | a0d1312ede66 fbb2bea03df9 |
comparison
equal
deleted
inserted
replaced
64281:6d94773592af | 64282:769e8d799acf |
---|---|
2072 } | 2072 } |
2073 else | 2073 else |
2074 { | 2074 { |
2075 int it_start; | 2075 int it_start; |
2076 int oselective; | 2076 int oselective; |
2077 int start_on_image_p; | |
2077 | 2078 |
2078 SET_TEXT_POS (pt, PT, PT_BYTE); | 2079 SET_TEXT_POS (pt, PT, PT_BYTE); |
2079 start_display (&it, w, pt); | 2080 start_display (&it, w, pt); |
2080 | 2081 |
2081 /* Scan from the start of the line containing PT. If we don't | 2082 /* Scan from the start of the line containing PT. If we don't |
2083 really at some x > 0. The effect is, in continuation lines, that | 2084 really at some x > 0. The effect is, in continuation lines, that |
2084 we end up with the iterator placed at where it thinks X is 0, | 2085 we end up with the iterator placed at where it thinks X is 0, |
2085 while the end position is really at some X > 0, the same X that | 2086 while the end position is really at some X > 0, the same X that |
2086 PT had. */ | 2087 PT had. */ |
2087 it_start = IT_CHARPOS (it); | 2088 it_start = IT_CHARPOS (it); |
2089 start_on_image_p = (it.method == GET_FROM_IMAGE); | |
2088 reseat_at_previous_visible_line_start (&it); | 2090 reseat_at_previous_visible_line_start (&it); |
2089 it.current_x = it.hpos = 0; | 2091 it.current_x = it.hpos = 0; |
2090 /* Temporarily disable selective display so we don't move too far */ | 2092 /* Temporarily disable selective display so we don't move too far */ |
2091 oselective = it.selective; | 2093 oselective = it.selective; |
2092 it.selective = 0; | 2094 it.selective = 0; |
2093 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); | 2095 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); |
2094 it.selective = oselective; | 2096 it.selective = oselective; |
2095 | 2097 |
2096 /* Move back if we got too far. This may happen if | 2098 /* Move back if we got too far. This may happen if |
2097 truncate-lines is on and PT is beyond right margin. */ | 2099 truncate-lines is on and PT is beyond right margin. |
2098 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0) | 2100 It may also happen if it_start is on an image -- |
2101 in that case, don't go back. */ | |
2102 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 && !start_on_image_p) | |
2099 move_it_by_lines (&it, -1, 0); | 2103 move_it_by_lines (&it, -1, 0); |
2100 | 2104 |
2101 it.vpos = 0; | 2105 it.vpos = 0; |
2102 /* Do this even if LINES is 0, so that we move back | 2106 /* Do this even if LINES is 0, so that we move back |
2103 to the beginning of the current line as we ought. */ | 2107 to the beginning of the current line as we ought. */ |