mirror of https://github.com/MidnightCommander/mc
added procedure mcview_update_filesize,
now mcview reread the file size before goto bottom the file. Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
parent
4197af0048
commit
8e68c5614a
|
@ -117,6 +117,18 @@ mcview_get_filesize (mcview_t * view)
|
|||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mcview_update_filesize (mcview_t * view)
|
||||
{
|
||||
if (view->datasource == DS_FILE) {
|
||||
struct stat st;
|
||||
if (mc_fstat (view->ds_file_fd, &st) != -1)
|
||||
view->ds_file_filesize = st.st_size;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
char *
|
||||
mcview_get_ptr_file (mcview_t * view, off_t byte_index)
|
||||
{
|
||||
|
|
|
@ -222,6 +222,7 @@ void mcview_ccache_lookup (mcview_t *view, coord_cache_entry_t *coord,
|
|||
/* datasource.c: */
|
||||
void mcview_set_datasource_none (mcview_t *);
|
||||
off_t mcview_get_filesize (mcview_t *);
|
||||
void mcview_update_filesize (mcview_t * view);
|
||||
char *mcview_get_ptr_file (mcview_t *, off_t);
|
||||
char *mcview_get_ptr_string (mcview_t *, off_t);
|
||||
int mcview_get_utf (mcview_t *, off_t, int *, gboolean *);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
2005 Roland Illig <roland.illig@gmx.de>
|
||||
2009 Slava Zanko <slavazanko@google.com>
|
||||
2009 Andrew Borodin <aborodin@vmail.ru>
|
||||
2009 Ilia Maslakov <il.smind@gmail.com>
|
||||
2009, 2010 Ilia Maslakov <il.smind@gmail.com>
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
|
@ -231,6 +231,8 @@ mcview_moveto_bottom (mcview_t * view)
|
|||
{
|
||||
off_t datalines, lines_up, filesize, last_offset;
|
||||
|
||||
mcview_update_filesize (view);
|
||||
|
||||
if (view->growbuf_in_use)
|
||||
mcview_growbuf_read_until (view, OFFSETTYPE_MAX);
|
||||
|
||||
|
@ -245,6 +247,7 @@ mcview_moveto_bottom (mcview_t * view)
|
|||
view->hex_cursor = last_offset;
|
||||
} else {
|
||||
view->dpy_start = filesize;
|
||||
mcview_move_up (view, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue