From 1423e571992a890cbe1f81475261375b160fb1f4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensberg@justemail.net> Date: Mon, 1 May 2017 16:48:13 +0200 Subject: [PATCH] tweaks: rename a function, to better suit what it does Things have morphed over time and display_buffer() no longer actually displays the buffer -- it just displays the title bar, precalculates the multiline color info, and schedules a refresh of the edit window. --- src/files.c | 15 +++++++-------- src/help.c | 2 +- src/nano.c | 4 ++-- src/proto.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/files.c b/src/files.c index 624771c5..7699424a 100644 --- a/src/files.c +++ b/src/files.c @@ -581,23 +581,22 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x, #endif /* !NANO_TINY */ #endif /* !DISABLE_SPELLER */ -/* Update the screen to account for the current buffer. */ -void display_buffer(void) +/* Update the titlebar and the multiline cache to match the current buffer. */ +void prepare_for_display(void) { /* Update the titlebar, since the filename may have changed. */ if (!inhelp) titlebar(NULL); #ifndef DISABLE_COLOR - have_palette = FALSE; - /* If there are multiline coloring regexes, and there is no * multiline cache data yet, precalculate it now. */ if (openfile->syntax && openfile->syntax->nmultis > 0 && openfile->fileage->multidata == NULL) precalc_multicolorinfo(); -#endif + have_palette = FALSE; +#endif refresh_needed = TRUE; } @@ -629,8 +628,8 @@ void switch_to_prevnext_buffer(bool to_next) openfile->firstcolumn = 0; #endif - /* Update the screen to account for the current buffer. */ - display_buffer(); + /* Update titlebar and multiline info to match the current buffer. */ + prepare_for_display(); /* Indicate the switch on the statusbar. */ if (!inhelp) @@ -1190,7 +1189,7 @@ void do_insertfile(void) } #endif /* !DISABLE_HISTORIES */ /* Update stuff to account for the current buffer. */ - display_buffer(); + prepare_for_display(); } else #endif /* !DISABLE_MULTIBUFFER */ { diff --git a/src/help.c b/src/help.c index ba6cd2cb..c39c0e6b 100644 --- a/src/help.c +++ b/src/help.c @@ -80,7 +80,7 @@ void display_the_help_text(bool redisplaying) open_buffer(tempfilename, FALSE); remove_magicline(); - display_buffer(); + prepare_for_display(); /* Move to the position in the file where we were before. */ while (TRUE) { diff --git a/src/nano.c b/src/nano.c index 155c057a..e1c6e693 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2624,10 +2624,10 @@ int main(int argc, char **argv) #endif #ifdef DEBUG - fprintf(stderr, "Main: show buffer contents, and enter main loop\n"); + fprintf(stderr, "Main: show title bar, and enter main loop\n"); #endif - display_buffer(); + prepare_for_display(); while (TRUE) { #ifdef ENABLE_LINENUMBERS diff --git a/src/proto.h b/src/proto.h index 57e180ac..a1cda31d 100644 --- a/src/proto.h +++ b/src/proto.h @@ -267,7 +267,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); #endif #endif -void display_buffer(void); +void prepare_for_display(void); #ifndef DISABLE_MULTIBUFFER void switch_to_prev_buffer_void(void); void switch_to_next_buffer_void(void); -- GitLab