From e8e9b8ad82822f63b4160b482fa91edaacd058d7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 13 May 2020 12:01:55 +0200 Subject: [PATCH] tweaks: move an 'if', to not call leftedge_for() when not softwrapping --- src/files.c | 7 ++----- src/winio.c | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/files.c b/src/files.c index d5a86dce..1a6cbc05 100644 --- a/src/files.c +++ b/src/files.c @@ -535,12 +535,9 @@ void redecorate_after_switch(void) #ifndef NANO_TINY /* While in a different buffer, the screen may have been resized - * or softwrap mode maybe have been toggled, so make sure that the + * or softwrap mode may have been toggled, so make sure that the * starting column for the first row gets an appropriate value. */ - if (ISSET(SOFTWRAP)) - ensure_firstcolumn_is_aligned(); - else - openfile->firstcolumn = 0; + ensure_firstcolumn_is_aligned(); #endif /* Update title bar and multiline info to match the current buffer. */ diff --git a/src/winio.c b/src/winio.c index 76bb775c..8f1f8c76 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3130,8 +3130,11 @@ size_t number_of_chunks_in(linestruct *line) * has changed, because then the width of softwrapped chunks has changed. */ void ensure_firstcolumn_is_aligned(void) { - openfile->firstcolumn = leftedge_for(openfile->firstcolumn, - openfile->edittop); + if (ISSET(SOFTWRAP)) + openfile->firstcolumn = leftedge_for(openfile->firstcolumn, + openfile->edittop); + else + openfile->firstcolumn = 0; /* If smooth scrolling is on, make sure the viewport doesn't center. */ focusing = FALSE;