diff --git a/src/setup.c b/src/setup.c index d25833b5b..7ea8ed5ca 100644 --- a/src/setup.c +++ b/src/setup.c @@ -241,6 +241,7 @@ static const struct { #ifdef USE_INTERNAL_EDIT { "editor_backup_extension", &option_backup_ext, "~" }, #endif + { "mcview_eof", &mcview_show_eof, "" }, { NULL, NULL, NULL } }; diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c index 2ff36d61d..a2aecf408 100644 --- a/src/viewer/mcviewer.c +++ b/src/viewer/mcviewer.c @@ -71,6 +71,8 @@ int mcview_max_dirt_limit = 10; /* Scrolling is done in pages or line increments */ int mcview_mouse_move_pages = 1; +/* end of file will be showen from mcview_show_eof */ +char *mcview_show_eof = NULL; /*** file scope macro definitions ****************************************************************/ diff --git a/src/viewer/mcviewer.h b/src/viewer/mcviewer.h index f3bbd2133..89ba27727 100644 --- a/src/viewer/mcviewer.h +++ b/src/viewer/mcviewer.h @@ -28,6 +28,7 @@ extern int mcview_remember_file_position; extern int mcview_max_dirt_limit; extern int mcview_mouse_move_pages; +extern char *mcview_show_eof; /*** declarations of public functions **********************************/ diff --git a/src/viewer/plain.c b/src/viewer/plain.c index c82f4d897..f9dd8302d 100644 --- a/src/viewer/plain.c +++ b/src/viewer/plain.c @@ -46,6 +46,7 @@ #include "../src/main.h" #include "../src/charsets.h" #include "../src/util.h" /* is_printable() */ +#include "mcviewer.h" /* mcview_show_eof */ #include "internal.h" @@ -74,6 +75,7 @@ mcview_display_text (mcview_t * view) off_t from; int cw = 1; int c, prev_ch = 0; + gboolean last_row = TRUE; struct hexedit_change_node *curr = view->change_list; mcview_display_clean (view); @@ -102,6 +104,7 @@ mcview_display_text (mcview_t * view) if (!mcview_get_byte (view, from, &c)) break; + last_row = FALSE; from++; if (cw > 1) from += cw - 1; @@ -177,6 +180,15 @@ mcview_display_text (mcview_t * view) } view->dpy_end = from; + if (mcview_show_eof != NULL && mcview_show_eof[0] != '\0') { + if (last_row && mcview_get_byte (view, from - 1, &c)) + if (c != '\n') + row--; + while (++row < height) { + widget_move (view, top + row, left); + tty_print_string (mcview_show_eof); + } + } } /* --------------------------------------------------------------------------------------------- */