Ticket #3817: mc-3817-mcview-eol.patch

File mc-3817-mcview-eol.patch, 2.5 KB (added by egmont, 7 years ago)

Fix

  • src/viewer/ascii.c

    diff --git a/src/viewer/ascii.c b/src/viewer/ascii.c
    index d73a02bcb..b5991daff 100644
    a b mcview_display_line (WView * view, mcview_state_machine_t * state, int row, 
    610610        off_t eol; 
    611611        int retval; 
    612612 
    613         eol = mcview_eol (view, state->offset, mcview_get_filesize (view)); 
     613        eol = mcview_eol (view, state->offset); 
    614614        retval = (eol > state->offset) ? 1 : 0; 
    615615 
    616616        mcview_state_machine_init (state, eol); 
    mcview_display_line (WView * view, mcview_state_machine_t * state, int row, 
    752752             * parsing and then not actually displaying it. */ 
    753753            off_t eol; 
    754754 
    755             eol = mcview_eol (view, state->offset, mcview_get_filesize (view)); 
     755            eol = mcview_eol (view, state->offset); 
    756756            mcview_state_machine_init (state, eol); 
    757757            return 1; 
    758758        } 
    mcview_ascii_move_down (WView * view, off_t lines) 
    957957         * EOF, that can't happen. */ 
    958958        if (!view->text_wrap_mode) 
    959959        { 
    960             view->dpy_start = mcview_eol (view, view->dpy_start, mcview_get_filesize (view)); 
     960            view->dpy_start = mcview_eol (view, view->dpy_start); 
    961961            view->dpy_paragraph_skip_lines = 0; 
    962962            view->dpy_wrap_dirty = TRUE; 
    963963        } 
  • src/viewer/internal.h

    diff --git a/src/viewer/internal.h b/src/viewer/internal.h
    index fc020609c..194f507ef 100644
    a b void mcview_select_encoding (WView * view); 
    316316void mcview_set_codeset (WView * view); 
    317317void mcview_show_error (WView * view, const char *error); 
    318318off_t mcview_bol (WView * view, off_t current, off_t limit); 
    319 off_t mcview_eol (WView * view, off_t current, off_t limit); 
     319off_t mcview_eol (WView * view, off_t current); 
    320320char *mcview_get_title (const WDialog * h, size_t len); 
    321321int mcview_calc_percent (WView * view, off_t p); 
    322322 
  • src/viewer/lib.c

    diff --git a/src/viewer/lib.c b/src/viewer/lib.c
    index f16618438..73fa4ace1 100644
    a b mcview_bol (WView * view, off_t current, off_t limit) 
    357357 */ 
    358358 
    359359off_t 
    360 mcview_eol (WView * view, off_t current, off_t limit) 
     360mcview_eol (WView * view, off_t current) 
    361361{ 
    362362    int c, prev_ch = 0; 
    363     off_t filesize; 
    364     filesize = mcview_get_filesize (view); 
    365363    if (current < 0) 
    366364        return 0; 
    367     if (current >= filesize) 
    368         return filesize; 
    369     while (current < filesize && current < limit) 
     365    while (TRUE) 
    370366    { 
    371367        if (!mcview_get_byte (view, current, &c)) 
    372368            break;