Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c
- index 11fd79caa..ffdc13b30 100644
- --- a/src/editor/editoptions.c
- +++ b/src/editor/editoptions.c
- @@ -117,8 +117,8 @@ edit_reload_syntax (void *data, void *user_data)
- void
- edit_options_dialog (WDialog * h)
- {
- - char wrap_length[16], tab_spacing[16];
- - char *p, *q;
- + char wrap_length[16], tab_spacing[16], bytes_per_line[16];
- + char *p, *q, *r;
- int wrap_mode = 0;
- gboolean old_syntax_hl;
- @@ -134,6 +134,7 @@ edit_options_dialog (WDialog * h)
- g_snprintf (wrap_length, sizeof (wrap_length), "%d", option_word_wrap_line_length);
- g_snprintf (tab_spacing, sizeof (tab_spacing), "%d", option_tab_spacing);
- + g_snprintf (bytes_per_line, sizeof (bytes_per_line), "%d", option_bytes_per_line);
- if (option_auto_para_formatting)
- wrap_mode = 1;
- @@ -177,6 +178,8 @@ edit_options_dialog (WDialog * h)
- QUICK_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL),
- QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left, wrap_length,
- "edit-word-wrap", &p, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
- + QUICK_LABELED_INPUT (N_("Hex viewer bytes per line:"), input_label_left, bytes_per_line,
- + "view-bytes-per-line", &r, NULL, FALSE, FALSE, INPUT_COMPLETE_NONE),
- QUICK_STOP_GROUPBOX,
- QUICK_STOP_COLUMNS,
- QUICK_BUTTONS_OK_CANCEL,
- @@ -215,6 +218,14 @@ edit_options_dialog (WDialog * h)
- g_free (q);
- }
- + if (r != NULL)
- + {
- + option_bytes_per_line = atoi (r);
- + if (option_bytes_per_line <= 0)
- + option_bytes_per_line = -1;
- + g_free (r);
- + }
- +
- if (wrap_mode == 1)
- {
- option_auto_para_formatting = TRUE;
- diff --git a/src/setup.c b/src/setup.c
- index 085b1d15b..fc761a7c4 100644
- --- a/src/setup.c
- +++ b/src/setup.c
- @@ -122,6 +122,9 @@ gboolean copymove_persistent_attr = TRUE;
- /* Tab size */
- int option_tab_spacing = DEFAULT_TAB_SPACING;
- +/* Hex viewer bytes per line (0 to disable) */
- +int option_bytes_per_line = 0;
- +
- /* Ugly hack to allow panel_save_setup to work as a place holder for */
- /* default panel values */
- int saving_setup;
- @@ -393,6 +396,7 @@ static const struct
- #ifdef USE_INTERNAL_EDIT
- { "editor_word_wrap_line_length", &option_word_wrap_line_length },
- { "editor_option_save_mode", &option_save_mode },
- + { "viewer_bytes_per_line", &option_bytes_per_line },
- #endif /* USE_INTERNAL_EDIT */
- { NULL, NULL }
- };
- @@ -533,6 +537,8 @@ load_config (void)
- #ifdef USE_INTERNAL_EDIT
- if (option_word_wrap_line_length <= 0)
- option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
- + if (option_bytes_per_line < 0)
- + option_bytes_per_line = 0;
- #else
- /* Reset forced in case of build without internal editor */
- use_internal_edit = FALSE;
- diff --git a/src/setup.h b/src/setup.h
- index b43420f63..cfa6d754f 100644
- --- a/src/setup.h
- +++ b/src/setup.h
- @@ -91,6 +91,7 @@ extern gboolean copymove_persistent_attr;
- extern gboolean classic_progressbar;
- extern gboolean easy_patterns;
- extern int option_tab_spacing;
- +extern int option_bytes_per_line;
- extern gboolean auto_save_setup;
- extern gboolean only_leading_plus_minus;
- extern int cd_symlinks;
- diff --git a/src/viewer/display.c b/src/viewer/display.c
- index be6d60eb7..2f9d386ce 100644
- --- a/src/viewer/display.c
- +++ b/src/viewer/display.c
- @@ -324,7 +324,10 @@ mcview_update_bytes_per_line (WView * view)
- g_assert (bytes != 0);
- - view->bytes_per_line = bytes;
- + view->bytes_per_line =
- + (option_bytes_per_line > 0) && (bytes > option_bytes_per_line) ?
- + option_bytes_per_line :
- + bytes;
- view->dirty = mcview_max_dirt_limit + 1; /* To force refresh */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement