added new parameter mcview_eof into ini-file

if mcview_eof defined show mcview_eof as EOF

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2010-01-18 15:35:29 +03:00
parent 8e68c5614a
commit 1eeffc2803
4 changed files with 16 additions and 0 deletions

View File

@ -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 }
};

View File

@ -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 ****************************************************************/

View File

@ -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 **********************************/

View File

@ -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);
}
}
}
/* --------------------------------------------------------------------------------------------- */