Commit df80bfd2 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

Improving comments and combining two conditions.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5385 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 14 additions and 14 deletions
+14 -14
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
on, the mark's pointer needs to be refreshed only when it is on the on, the mark's pointer needs to be refreshed only when it is on the
same line as the cursor, and the mark's x coordinate only when the same line as the cursor, and the mark's x coordinate only when the
mark is located after the cursor. This fixes Savannah bug #46347. mark is located after the cursor. This fixes Savannah bug #46347.
* src/nano.c (copy_from_filestruct): Improve comments and combine
two conditions.
2015-10-29 Benno Schulenberg <bensberg@justemail.net> 2015-10-29 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (add_undo): Only skip adding an undo when the current * src/text.c (add_undo): Only skip adding an undo when the current
......
...@@ -451,11 +451,12 @@ void copy_from_filestruct(filestruct *somebuffer) ...@@ -451,11 +451,12 @@ void copy_from_filestruct(filestruct *somebuffer)
while (openfile->filebot->next != NULL) while (openfile->filebot->next != NULL)
openfile->filebot = openfile->filebot->next; openfile->filebot = openfile->filebot->next;
/* Restore the current line and cursor position. If the mark begins /* Put the cursor at the end of the pasted text. */
* inside the partition, adjust the mark coordinates to compensate
* for the change in the current line. */
openfile->current = openfile->filebot; openfile->current = openfile->filebot;
openfile->current_x = strlen(openfile->filebot->data); openfile->current_x = strlen(openfile->filebot->data);
/* Refresh the mark's pointer, and compensate the mark's
* x coordinate for the change in the current line. */
if (openfile->fileage == openfile->filebot) { if (openfile->fileage == openfile->filebot) {
#ifndef NANO_TINY #ifndef NANO_TINY
if (openfile->mark_set && single_line) { if (openfile->mark_set && single_line) {
...@@ -464,22 +465,19 @@ void copy_from_filestruct(filestruct *somebuffer) ...@@ -464,22 +465,19 @@ void copy_from_filestruct(filestruct *somebuffer)
openfile->mark_begin_x += openfile->current_x; openfile->mark_begin_x += openfile->current_x;
} }
#endif #endif
/* When the pasted stuff contains no newline, adjust the cursor's
* x coordinate for the text that is before the pasted stuff. */
openfile->current_x += current_x_save; openfile->current_x += current_x_save;
} }
#ifndef NANO_TINY #ifndef NANO_TINY
else if (openfile->mark_set) { else if (openfile->mark_set && single_line) {
if (right_side_up) { if (right_side_up)
if (single_line)
/* Get the new data, stuff was inserted on the mark line. */
openfile->mark_begin = openfile->fileage; openfile->mark_begin = openfile->fileage;
/* The x is okay, it did not move. */ else {
} else {
if (single_line) {
openfile->mark_begin = openfile->current; openfile->mark_begin = openfile->current;
openfile->mark_begin_x += openfile->current_x - current_x_save; openfile->mark_begin_x += openfile->current_x - current_x_save;
} }
} }
}
#endif #endif
/* Get the number of characters in the copied text, and add it to /* Get the number of characters in the copied text, and add it to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment