nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit faf77fb1ecab8fa6bde8d67e7137558c94707a3e
parent b0b24d9c3a47881428b009b270c9705f4d8a2405
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun, 11 Dec 2016 11:18:28 +0100

tweaks: don't bother making the next line of an end point NULL

Diffstat:
Msrc/winio.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -3117,7 +3117,6 @@ void display_main_list(void) * position always. In any case we reset suppress_cursorpos to FALSE. */ void do_cursorpos(bool constant) { - filestruct *f; char c; size_t i, cur_xpt = xplustabs() + 1; size_t cur_lenpt = strlenpt(openfile->current->data) + 1; @@ -3126,16 +3125,16 @@ void do_cursorpos(bool constant) assert(openfile->fileage != NULL && openfile->current != NULL); /* Determine the size of the file up to the cursor. */ - f = openfile->current->next; c = openfile->current->data[openfile->current_x]; - - openfile->current->next = NULL; openfile->current->data[openfile->current_x] = '\0'; i = get_totsize(openfile->fileage, openfile->current); openfile->current->data[openfile->current_x] = c; - openfile->current->next = f; + + /* When not at EOF, subtract 1 for an overcounted newline. */ + if (openfile->current != openfile->filebot) + i--; /* If the position needs to be suppressed, don't suppress it next time. */ if (suppress_cursorpos && constant) {