commit 065afe6e0f684945a5375751af15e23feebbf548 parent 37eccd3117cfed0e05b2c35f9f76509371e1e770 Author: Benno Schulenberg <bensberg@telfort.nl> Date: Sun, 28 Apr 2019 11:41:42 +0200 tweaks: reshuffle a bit of code, to be less intertwined Diffstat:
M | src/nano.c | | | 22 | ++++++++++------------ |
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/src/nano.c b/src/nano.c @@ -425,22 +425,20 @@ void ingraft_buffer(linestruct *somebuffer) openfile->current = openfile->filebot; openfile->current_x = strlen(openfile->filebot->data); + /* When the pasted stuff contains no newline, adjust the cursor's + * x coordinate for the text that is before the pasted stuff. */ + if (openfile->filetop == openfile->filebot) + openfile->current_x += current_x_save; + +#ifndef NANO_TINY /* Refresh the mark's pointer, and compensate the mark's * x coordinate for the change in the current line. */ - if (openfile->filetop == openfile->filebot) { -#ifndef NANO_TINY - if (openfile->mark && single_line) { + if (openfile->mark && single_line) { + if (openfile->filetop == openfile->filebot) { openfile->mark = openfile->current; if (!right_side_up) - openfile->mark_x += openfile->current_x; - } -#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; - } -#ifndef NANO_TINY - else if (openfile->mark && single_line) { + openfile->mark_x += openfile->current_x - current_x_save; + } else if (right_side_up) openfile->mark = openfile->filetop; else {