Ticket #3261: mc-3261-hex-extra-column-for.patch

File mc-3261-hex-extra-column-for.patch, 1.7 KB (added by egmont, 4 years ago)

Fix

  • src/viewer/display.c

    diff --git a/src/viewer/display.c b/src/viewer/display.c
    index 00c6ec0..225938b 100644
    a b mcview_update_bytes_per_line (mcview_t * view) 
    325325    const screen_dimen cols = view->data_area.width; 
    326326    int bytes; 
    327327 
    328     if (cols < 8 + 17) 
     328    if (cols < 9 + 17) 
    329329        bytes = 4; 
    330330    else 
    331         bytes = 4 * ((cols - 8) / ((cols < 80) ? 17 : 18)); 
     331        bytes = 4 * ((cols - 9) / ((cols <= 80) ? 17 : 18)); 
    332332#ifdef HAVE_ASSERT_H 
    333333    assert (bytes != 0); 
    334334#endif 
  • src/viewer/hex.c

    diff --git a/src/viewer/hex.c b/src/viewer/hex.c
    index ff7d501..e355cfb 100644
    a b mcview_display_hex (mcview_t * view) 
    137137    const screen_dimen height = view->data_area.height; 
    138138    const screen_dimen width = view->data_area.width; 
    139139    const int ngroups = view->bytes_per_line / 4; 
    140     const screen_dimen text_start = 8 + 13 * ngroups + ((width < 80) ? 0 : (ngroups - 1 + 1)); 
    141140    /* 8 characters are used for the file offset, and every hex group 
    142      * takes 13 characters. On "big" screens, the groups are separated 
    143      * by an extra vertical line, and there is an extra space before the 
    144      * text column. 
     141     * takes 13 characters. Starting at width of 80 columns, the groups 
     142     * are separated by an extra vertical line. Starting at width of 81, 
     143     * there is an extra space before the text column. There is always a 
     144     * mostly empty column on the right, to allow overflowing CJKs. 
    145145     */ 
     146    const screen_dimen text_start = 8 + 13 * ngroups + 
     147        ((width < 80) ? 0 : (width == 80) ? (ngroups - 1) : (ngroups - 1 + 1)); 
    146148 
    147149    screen_dimen row; 
    148150    off_t from;