2408 |
init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); |
init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); |
2409 |
it->first_vpos = first_vpos; |
it->first_vpos = first_vpos; |
2410 |
|
|
2411 |
if (!it->truncate_lines_p) |
/* Don't reseat to previous visible line start if current start |
2412 |
|
position is in a string or image. */ |
2413 |
|
if (it->method == GET_FROM_BUFFER && !it->truncate_lines_p) |
2414 |
{ |
{ |
2415 |
int start_at_line_beg_p; |
int start_at_line_beg_p; |
2416 |
int first_y = it->current_y; |
int first_y = it->current_y; |
6381 |
y-distance. */ |
y-distance. */ |
6382 |
it2 = *it; |
it2 = *it; |
6383 |
it2.max_ascent = it2.max_descent = 0; |
it2.max_ascent = it2.max_descent = 0; |
6384 |
move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, |
do |
6385 |
MOVE_TO_POS | MOVE_TO_VPOS); |
{ |
6386 |
|
move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, |
6387 |
|
MOVE_TO_POS | MOVE_TO_VPOS); |
6388 |
|
} |
6389 |
|
while (it2.method != GET_FROM_BUFFER); |
6390 |
xassert (IT_CHARPOS (*it) >= BEGV); |
xassert (IT_CHARPOS (*it) >= BEGV); |
6391 |
it3 = it2; |
it3 = it2; |
6392 |
|
|
6584 |
last_height = 0; |
last_height = 0; |
6585 |
} |
} |
6586 |
else if (dvpos > 0) |
else if (dvpos > 0) |
6587 |
move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); |
{ |
6588 |
|
move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); |
6589 |
|
if (it->method != GET_FROM_BUFFER) |
6590 |
|
move_it_to (it, IT_CHARPOS (*it) + 1, -1, -1, -1, MOVE_TO_POS); |
6591 |
|
} |
6592 |
else |
else |
6593 |
{ |
{ |
6594 |
struct it it2; |
struct it it2; |
6595 |
int start_charpos, i; |
int start_charpos, i; |
6596 |
|
|
6597 |
/* Start at the beginning of the screen line containing IT's |
/* Start at the beginning of the screen line containing IT's |
6598 |
position. */ |
position. This may actually move vertically backwards, |
6599 |
|
in case of overlays, so adjust dvpos accordingly. */ |
6600 |
|
dvpos += it->vpos; |
6601 |
move_it_vertically_backward (it, 0); |
move_it_vertically_backward (it, 0); |
6602 |
|
dvpos -= it->vpos; |
6603 |
|
|
6604 |
/* Go back -DVPOS visible lines and reseat the iterator there. */ |
/* Go back -DVPOS visible lines and reseat the iterator there. */ |
6605 |
start_charpos = IT_CHARPOS (*it); |
start_charpos = IT_CHARPOS (*it); |
6606 |
for (i = -dvpos; i && IT_CHARPOS (*it) > BEGV; --i) |
for (i = -dvpos; i > 0 && IT_CHARPOS (*it) > BEGV; --i) |
6607 |
back_to_previous_visible_line_start (it); |
back_to_previous_visible_line_start (it); |
6608 |
reseat (it, it->current.pos, 1); |
reseat (it, it->current.pos, 1); |
6609 |
|
|
6610 |
|
/* Move further back if we end up in a string or an image. */ |
6611 |
|
while (it->method != GET_FROM_BUFFER) |
6612 |
|
{ |
6613 |
|
/* First try to move to start of display line. */ |
6614 |
|
dvpos += it->vpos; |
6615 |
|
move_it_vertically_backward (it, 0); |
6616 |
|
dvpos -= it->vpos; |
6617 |
|
if (it->method == GET_FROM_BUFFER) |
6618 |
|
break; |
6619 |
|
/* If start of line is still in string or image, |
6620 |
|
move further back. */ |
6621 |
|
back_to_previous_visible_line_start (it); |
6622 |
|
reseat (it, it->current.pos, 1); |
6623 |
|
dvpos--; |
6624 |
|
} |
6625 |
|
|
6626 |
it->current_x = it->hpos = 0; |
it->current_x = it->hpos = 0; |
6627 |
|
|
6628 |
/* Above call may have moved too far if continuation lines |
/* Above call may have moved too far if continuation lines |
11854 |
while (!row->mode_line_p |
while (!row->mode_line_p |
11855 |
&& (MATRIX_ROW_START_CHARPOS (row) > PT |
&& (MATRIX_ROW_START_CHARPOS (row) > PT |
11856 |
|| (MATRIX_ROW_START_CHARPOS (row) == PT |
|| (MATRIX_ROW_START_CHARPOS (row) == PT |
11857 |
&& MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row))) |
&& (MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row) |
11858 |
|
|| (/* STARTS_IN_MIDDLE_OF_STRING_P (row) */ |
11859 |
|
row > w->current_matrix->rows |
11860 |
|
&& (row-1)->ends_in_newline_from_string_p)))) |
11861 |
&& (row->y > top_scroll_margin |
&& (row->y > top_scroll_margin |
11862 |
|| CHARPOS (startp) == BEGV)) |
|| CHARPOS (startp) == BEGV)) |
11863 |
{ |
{ |
15028 |
if (PT == MATRIX_ROW_END_CHARPOS (row)) |
if (PT == MATRIX_ROW_END_CHARPOS (row)) |
15029 |
{ |
{ |
15030 |
/* If the row ends with a newline from a string, we don't want |
/* If the row ends with a newline from a string, we don't want |
15031 |
the cursor there (if the row is continued it doesn't end in a |
the cursor there, but we still want it at the start of the |
15032 |
newline). */ |
string if the string starts in this row. |
15033 |
|
If the row is continued it doesn't end in a newline. */ |
15034 |
if (CHARPOS (row->end.string_pos) >= 0) |
if (CHARPOS (row->end.string_pos) >= 0) |
15035 |
cursor_row_p = row->continued_p; |
cursor_row_p = (row->continued_p |
15036 |
|
|| PT >= MATRIX_ROW_START_CHARPOS (row)); |
15037 |
else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) |
else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) |
15038 |
{ |
{ |
15039 |
/* If the row ends in middle of a real character, |
/* If the row ends in middle of a real character, |