diff -urN a/src/common.h b/src/common.h --- a/src/common.h Sat Jan 7 20:23:30 2006 +++ b/src/common.h Sat Jan 7 21:03:20 2006 @@ -259,6 +259,8 @@ extern int bytes_to_read; extern int bytes_per_row; +extern int bytes_per_row_pad; +extern int bytes_per_row_max; extern int bytes_per_row_hex; extern int vc_case_sensitive; diff -urN a/src/edit.c b/src/edit.c --- a/src/edit.c Sat Jan 7 20:23:30 2006 +++ b/src/edit.c Sat Jan 7 21:17:13 2006 @@ -245,7 +245,7 @@ */ ay = hy; - ax = ex + vc_cols - bytes_per_row; + ax = ex + vc_cols - bytes_per_row - bytes_per_row_pad; posxyh = 4 + 2 *( hy * vc_cols + hx); posxya = 4 + 2 *( ay * vc_cols + ax); diff -urN a/src/hex.c b/src/hex.c --- a/src/hex.c Sat Jan 7 20:23:30 2006 +++ b/src/hex.c Sat Jan 7 21:18:57 2006 @@ -51,6 +51,8 @@ int bytes_to_read; /* Quantity of bytes to read */ int bytes_per_row; /* Quantity of ascii bytes per row */ +int bytes_per_row_pad; /* Quantity of unused ascii bytes per row */ +int bytes_per_row_max = 0; /* Quantity of ascii bytes per row */ int bytes_per_row_hex; /* Quantity of hex bytes per row */ void hex_mainloop( int view_or_edit) @@ -300,7 +302,7 @@ int line; int pos; - startxy = vc_cols - bytes_per_row; + startxy = vc_cols - bytes_per_row - bytes_per_row_pad; draw_offset_n_perc( fpos); diff -urN a/src/main.c b/src/main.c --- a/src/main.c Tue Aug 17 01:09:48 1999 +++ b/src/main.c Sat Jan 7 21:27:15 2006 @@ -35,8 +35,9 @@ char *progname; progname = *argv++; + argc--; - if( argc < 2) { + if( argc < 1) { usage( progname); return 1; } @@ -53,12 +54,19 @@ lib_save_screen(); #endif + while (argc > 0 && **argv == '-') { + if (argc > 1 && !strcmp(*argv, "-c")) { + argc--; argv++; + bytes_per_row_max = atol(*argv); + } + argc--; argv++; + } + #if defined(VCHE_NC) w = #endif lib_message( " Loading filelist... ", 0); - argc--; while( argc-- > 0) ll_file_insert( *argv++); @@ -94,6 +102,6 @@ #elif defined(VCHE_NC) "-NC (Virtual Console Hex Editor - NCURSES Version) " #endif - "Release " VCHE_VERSION "\n\nUsage:\n\t%s [filename ..]\n\n", progname); + "Release " VCHE_VERSION "\n\nUsage:\n\t%s [ -c cols ] [filename ..]\n\n", progname); } diff -urN a/src/misc.c b/src/misc.c --- a/src/misc.c Sat Jan 7 20:23:30 2006 +++ b/src/misc.c Sat Jan 7 21:24:37 2006 @@ -297,11 +297,18 @@ void set_hexmode_variables( void) { - bytes_per_row = vc_cols - 12; + bytes_per_row_pad = bytes_per_row = vc_cols - 12; if( !flags.nohex) { bytes_per_row = bytes_per_row * 4 / 17; + if (bytes_per_row_max && bytes_per_row > bytes_per_row_max) + bytes_per_row = bytes_per_row_max; + bytes_per_row_pad = ((bytes_per_row_pad * 4 / 17 - bytes_per_row)) * 17 / 4; bytes_per_row_hex = bytes_per_row * 13 / 4; + } else { + if (bytes_per_row_max && bytes_per_row > bytes_per_row_max) + bytes_per_row = bytes_per_row_max; + bytes_per_row_pad -= bytes_per_row; } bytes_to_read = bytes_per_row * (vc_lines - 2); diff -urN a/src/search.c b/src/search.c --- a/src/search.c Sat Jan 7 20:23:30 2006 +++ b/src/search.c Sat Jan 7 21:19:59 2006 @@ -363,7 +363,7 @@ ay = ey + 1; - ax = ex + vc_cols - bytes_per_row; + ax = ex + vc_cols - bytes_per_row - bytes_per_row_pad; posxya = 4 + 2 *( ay * vc_cols + ax); posa = posxya - (4 + 2 * vc_cols);