1
1

tweaks: reduce a bit of mark-adjusting code to its essence

It doesn't matter whether the grafted text contains a newline or not.

It only matters whether the mark was before or after the cursor.  When
it was after the cursor, the mark needs to be set to the bottom line of
the grafted text and its x coordinate needs adjustment; and when it was
before the cursor, the mark just needs to be set to the top line of the
grafted text.
Этот коммит содержится в:
Benno Schulenberg 2019-04-28 12:02:38 +02:00
родитель 065afe6e0f
Коммит d54180ad8b

Просмотреть файл

@ -431,20 +431,14 @@ void ingraft_buffer(linestruct *somebuffer)
openfile->current_x += current_x_save; openfile->current_x += current_x_save;
#ifndef NANO_TINY #ifndef NANO_TINY
/* Refresh the mark's pointer, and compensate the mark's /* When needed, refresh the mark's pointer and compensate the mark's
* x coordinate for the change in the current line. */ * x coordinate for the change in the current line. */
if (openfile->mark && single_line) { if (openfile->mark && single_line) {
if (openfile->filetop == openfile->filebot) { if (!right_side_up) {
openfile->mark = openfile->current; openfile->mark = openfile->filebot;
if (!right_side_up)
openfile->mark_x += openfile->current_x - current_x_save; openfile->mark_x += openfile->current_x - current_x_save;
} else } else
if (right_side_up)
openfile->mark = openfile->filetop; openfile->mark = openfile->filetop;
else {
openfile->mark = openfile->current;
openfile->mark_x += openfile->current_x - current_x_save;
}
} }
#endif #endif