Ticket #1652: 0002-added-options-editor_autodetect_linebreak.patch

File 0002-added-options-editor_autodetect_linebreak.patch, 4.4 KB (added by angel_il, 13 years ago)
  • src/editor/edit.c

    From 8aab29c1c7d25d0c31b725eeab7c105349b62d4e Mon Sep 17 00:00:00 2001
    From: Ilia Maslakov <il.smind@gmail.com>
    Date: Tue, 29 Mar 2011 13:29:31 +0000
    Subject: [PATCH 2/2] added options editor_autodetect_linebreak
    
    Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
    ---
     src/editor/edit.c        |    7 ++++++-
     src/editor/edit.h        |    1 +
     src/editor/editoptions.c |   16 +++++++++-------
     src/setup.c              |    1 +
     4 files changed, 17 insertions(+), 8 deletions(-)
    
    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index 0d854f9..4ab612a 100644
    a b int option_persistent_selections = 1; 
    8383int option_cursor_beyond_eol = 0; 
    8484int option_line_state = 0; 
    8585int option_line_state_width = 0; 
     86int option_autodetect_lb = 0; 
    8687 
    8788int option_edit_right_extreme = 0; 
    8889int option_edit_left_extreme = 0; 
    edit_load_file (WEdit * edit) 
    484485        /* If we are dealing with a real file, check that it exists */ 
    485486        if (check_file_access (edit, edit->filename, &edit->stat1)) 
    486487            return 1; 
    487         lb_type = detect_lb_type(edit->filename); 
     488 
     489        if (option_autodetect_lb) 
     490            lb_type = detect_lb_type(edit->filename); 
     491        else 
     492            lb_type = LB_UNIX; 
    488493 
    489494        if (lb_type != LB_ASIS && lb_type != LB_UNIX) 
    490495            fast_load = 0; 
  • src/editor/edit.h

    diff --git a/src/editor/edit.h b/src/editor/edit.h
    index d6b8344..09c3350 100644
    a b extern int option_auto_para_formatting; 
    5555extern int option_fill_tabs_with_spaces; 
    5656extern int option_return_does_auto_indent; 
    5757extern int option_backspace_through_tabs; 
     58extern int option_autodetect_lb; 
    5859extern int option_fake_half_tabs; 
    5960extern int option_persistent_selections; 
    6061extern int option_cursor_beyond_eol; 
  • src/editor/editoptions.c

    diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c
    index ece015c..11993ee 100644
    a b edit_options_dialog (WEdit * edit) 
    107107                                 N_("Confir&m before saving"), &edit_confirm_save), 
    108108        /* 12 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H, 
    109109                                 N_("&Return does autoindent"), &option_return_does_auto_indent), 
    110         /* 13 */ QUICK_LABEL (3, OPT_DLG_W, 11, OPT_DLG_H, N_("Tab spacing:")), 
    111         /* 14 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 11, OPT_DLG_H, 
     110        /* 13 */ QUICK_LABEL (3, OPT_DLG_W, 12, OPT_DLG_H, N_("Tab spacing:")), 
     111        /* 14 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 12, OPT_DLG_H, 
    112112                              tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q), 
    113         /* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H, 
     113        /* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 11, OPT_DLG_H, 
    114114                                 N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces), 
    115         /* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H, 
     115        /* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H, 
    116116                                 N_("&Backspace through tabs"), &option_backspace_through_tabs), 
    117         /* 17 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H, 
     117        /* 17 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H, 
    118118                                 N_("&Fake half tabs"), &option_fake_half_tabs), 
    119         /* 18 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode), 
    120         /* 19 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")), 
     119        /* 18 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H, 
     120                                 N_("&Autodetect line break"), &option_autodetect_lb), 
     121        /* 19 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode), 
     122        /* 20 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")), 
    121123        QUICK_END 
    122124    }; 
    123125 
  • src/setup.c

    diff --git a/src/setup.c b/src/setup.c
    index 2d7dad7..9d7b042 100644
    a b static const struct 
    292292    { "editor_word_wrap_line_length", &option_word_wrap_line_length }, 
    293293    { "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces }, 
    294294    { "editor_return_does_auto_indent", &option_return_does_auto_indent }, 
     295    { "editor_autodetect_linebreak", &option_autodetect_lb }, 
    295296    { "editor_backspace_through_tabs", &option_backspace_through_tabs }, 
    296297    { "editor_fake_half_tabs", &option_fake_half_tabs }, 
    297298    { "editor_option_save_mode", &option_save_mode },