From cc95f6f654247ae6b0549cbf22a415b9d2b2ffc3 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 4 Jun 2017 09:47:45 +0300 Subject: [PATCH] Ticket #3826: mcview: goto doesn't grow file as much as needed. Goto decimal/hexadecimal offset doesn't grow the file if necessary, rather stops at an earlier offset. Goto percent doesn't work either. It's trickier because no matter what the percent value is, it'd need to read the entire contents. Goto line number works as expected. * (mcview_dialog_goto): read all data from pipe in case of MC_VIEW_GOTO_PERCENT. Signed-off-by: Andrew Borodin --- src/viewer/dialogs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viewer/dialogs.c b/src/viewer/dialogs.c index d059c19c9..dddcfe342 100644 --- a/src/viewer/dialogs.c +++ b/src/viewer/dialogs.c @@ -247,6 +247,9 @@ mcview_dialog_goto (WView * view, off_t * offset) case MC_VIEW_GOTO_PERCENT: if (addr > 100) addr = 100; + /* read all data from pipe to get real size */ + if (view->growbuf_in_use) + mcview_growbuf_read_until (view, OFFSETTYPE_MAX); *offset = addr * mcview_get_filesize (view) / 100; if (!view->hex_mode) *offset = mcview_bol (view, *offset, 0); -- 2.11.4.GIT