Ticket #2875: mc-4.8.4-supertab-short-v3.patch

File mc-4.8.4-supertab-short-v3.patch, 3.8 KB (added by sknaumov, 12 years ago)

I decided not to overcomplicate this feature, so I just refurbished the patch a bit and adopt it for mc 4.8.6.

  • src/editor/edit.c

    diff -uNr mc-4.8.6.orig/src/editor/edit.c mc-4.8.6/src/editor/edit.c
    old new  
    9090int option_cursor_beyond_eol = 0; 
    9191int option_line_state = 0; 
    9292int option_line_state_width = 0; 
     93int option_supertab = 0; 
    9394 
    9495int option_edit_right_extreme = 0; 
    9596int option_edit_left_extreme = 0; 
     
    39223923                edit_mark_cmd (edit, FALSE); 
    39233924            edit_move_block_to_right (edit); 
    39243925        } 
     3926        //if we are neither at the bol nor after space characters 
     3927        else if (option_supertab && !isspace (edit_get_byte (edit, edit->curs1 - 1))) 
     3928            edit_complete_word_cmd (edit); 
    39253929        else 
    39263930        { 
     3931ck_tab: 
    39273932            if (option_cursor_beyond_eol) 
    39283933                edit_insert_over (edit); 
    39293934            edit_tab_cmd (edit); 
     
    41114116        /* if text marked shift block */ 
    41124117        if (edit->mark1 != edit->mark2 && !option_persistent_selections) 
    41134118            edit_move_block_to_left (edit); 
     4119        else if (option_supertab) 
     4120            goto ck_tab; 
    41144121        else 
    41154122            edit_complete_word_cmd (edit); 
    41164123        break; 
  • src/editor/edit.h

    diff -uNr mc-4.8.6.orig/src/editor/edit.h mc-4.8.6/src/editor/edit.h
    old new  
    4545extern int option_save_position; 
    4646extern int option_syntax_highlighting; 
    4747extern int option_group_undo; 
     48extern int option_supertab; 
    4849extern char *option_backup_ext; 
    4950 
    5051extern int edit_confirm_save; 
  • src/editor/editoptions.c

    diff -uNr mc-4.8.6.orig/src/editor/editoptions.c mc-4.8.6/src/editor/editoptions.c
    old new  
    4646 
    4747/*** file scope macro definitions ****************************************************************/ 
    4848 
    49 #define OPT_DLG_H 17 
     49#define OPT_DLG_H 18 
    5050#define OPT_DLG_W 74 
    5151 
    5252/*** file scope type declarations ****************************************************************/ 
     
    127127    QuickWidget quick_widgets[] = { 
    128128        /*  0 */ QUICK_BUTTON (6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), B_CANCEL, NULL), 
    129129        /*  1 */ QUICK_BUTTON (2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), B_ENTER, NULL), 
    130         /*  2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 12, OPT_DLG_H, 
     130        /*  2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 13, OPT_DLG_H, 
    131131                              N_("Word wrap line length:")), 
    132         /*  3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 12, OPT_DLG_H, 
     132        /*  3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 13, OPT_DLG_H, 
    133133                              wrap_length, OPT_DLG_W / 2 - 4 - 24, 0, "edit-word-wrap", &p), 
     134                 QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 12, OPT_DLG_H, 
     135                                 N_("&Tab completion"), &option_supertab), 
    134136        /*  4 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 11, OPT_DLG_H, 
    135137                                 N_("&Group undo"), &option_group_undo), 
    136138        /*  5 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 10, OPT_DLG_H, 
  • src/setup.c

    diff -uNr mc-4.8.6.orig/src/setup.c mc-4.8.6/src/setup.c
    old new  
    307307    { "editor_option_save_position", &option_save_position }, 
    308308    { "editor_option_auto_para_formatting", &option_auto_para_formatting }, 
    309309    { "editor_option_typewriter_wrap", &option_typewriter_wrap }, 
     310    { "editor_option_supertab", &option_supertab }, 
    310311    { "editor_edit_confirm_save", &edit_confirm_save }, 
    311312    { "editor_syntax_highlighting", &option_syntax_highlighting }, 
    312313    { "editor_persistent_selections", &option_persistent_selections },