mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #2196: editor hangup if editor_tab_spacing is equalt to 0.
Check and correct value of option_tab_spacing during options loading. Check and correct value of option_word_wrap_line_length during options loading and after editor options changing. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d146ab8661
commit
0485ae5026
@ -63,8 +63,7 @@
|
||||
#include "editlock.h"
|
||||
#include "edit-widget.h"
|
||||
|
||||
|
||||
int option_word_wrap_line_length = 72;
|
||||
int option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
|
||||
int option_typewriter_wrap = 0;
|
||||
int option_auto_para_formatting = 0;
|
||||
int option_fill_tabs_with_spaces = 0;
|
||||
|
@ -39,6 +39,8 @@
|
||||
struct WEdit;
|
||||
typedef struct WEdit WEdit;
|
||||
|
||||
#define DEFAULT_WRAP_LINE_LENGTH 72
|
||||
|
||||
extern int option_word_wrap_line_length;
|
||||
extern int option_typewriter_wrap;
|
||||
extern int option_auto_para_formatting;
|
||||
|
@ -141,14 +141,17 @@ edit_options_dialog (WEdit *edit)
|
||||
if (!option_cursor_beyond_eol)
|
||||
edit->over_col = 0;
|
||||
|
||||
if (p) {
|
||||
if (p != NULL) {
|
||||
option_word_wrap_line_length = atoi (p);
|
||||
if (option_word_wrap_line_length <= 0)
|
||||
option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
|
||||
g_free (p);
|
||||
}
|
||||
if (q) {
|
||||
|
||||
if (q != NULL) {
|
||||
option_tab_spacing = atoi (q);
|
||||
if (option_tab_spacing <= 0)
|
||||
option_tab_spacing = 8;
|
||||
option_tab_spacing = DEFAULT_TAB_SPACING;
|
||||
g_free (q);
|
||||
}
|
||||
|
||||
|
@ -244,9 +244,6 @@ int update_prompt = 0;
|
||||
/* The home directory */
|
||||
const char *home_dir = NULL;
|
||||
|
||||
/* Tab size */
|
||||
int option_tab_spacing = 8;
|
||||
|
||||
/* Only used at program boot */
|
||||
int boot_current_is_left = 1;
|
||||
|
||||
|
@ -56,6 +56,8 @@ extern int use_internal_view;
|
||||
extern int use_internal_edit;
|
||||
extern int clear_before_exec;
|
||||
|
||||
/* TAB length for editor and viewer */
|
||||
#define DEFAULT_TAB_SPACING 8
|
||||
extern int option_tab_spacing;
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
|
14
src/setup.c
14
src/setup.c
@ -87,6 +87,9 @@ panel_view_mode_t startup_right_mode;
|
||||
|
||||
int setup_copymove_persistent_attr = 1;
|
||||
|
||||
/* Tab size */
|
||||
int option_tab_spacing = DEFAULT_TAB_SPACING;
|
||||
|
||||
/* Ugly hack to allow panel_save_setup to work as a place holder for */
|
||||
/* default panel values */
|
||||
int saving_setup;
|
||||
@ -225,9 +228,10 @@ static const struct
|
||||
{ "fish_directory_timeout", &fish_directory_timeout },
|
||||
#endif /* USE_NETCODE */
|
||||
#endif /* ENABLE_VFS */
|
||||
/* option_tab_spacing is used in internal viewer */
|
||||
{ "editor_tab_spacing", &option_tab_spacing },
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
{ "editor_word_wrap_line_length", &option_word_wrap_line_length },
|
||||
{ "editor_tab_spacing", &option_tab_spacing },
|
||||
{ "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces },
|
||||
{ "editor_return_does_auto_indent", &option_return_does_auto_indent },
|
||||
{ "editor_backspace_through_tabs", &option_backspace_through_tabs },
|
||||
@ -744,6 +748,14 @@ load_setup (void)
|
||||
mc_config_get_int (mc_main_config, CONFIG_APP_SECTION, int_options[i].opt_name,
|
||||
*int_options[i].opt_addr);
|
||||
|
||||
if (option_tab_spacing <= 0)
|
||||
option_tab_spacing = DEFAULT_TAB_SPACING;
|
||||
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
if (option_word_wrap_line_length <= 0)
|
||||
option_word_wrap_line_length = DEFAULT_WRAP_LINE_LENGTH;
|
||||
#endif /* USE_INTERNAL_EDIT */
|
||||
|
||||
/* overwrite old_esc_mode_timeout */
|
||||
kt = getenv ("KEYBOARD_KEY_TIMEOUT_US");
|
||||
if ((kt != NULL) && (kt[0] != '\0'))
|
||||
|
Loading…
Reference in New Issue
Block a user