Ticket #1480: mc.1480.diff
File mc.1480.diff, 5.7 KB (added by szaszg, 12 years ago) |
---|
-
doc/man/mcedit.1.in
diff --git a/doc/man/mcedit.1.in b/doc/man/mcedit.1.in index d451cf6..192304a 100644
a b deleting, navigating, typing) 588 588 Search autocomplete candidates in entire of file or just from 589 589 begin of file to cursor position (0) 590 590 .TP 591 .I editor_smart_home_end 592 when option switched on: 593 the Home key go to the first column on first press, and after second 594 press go to the beginning of non-whitespace char and 595 the End key go to the last column on first press, and after second 596 press go to the end of non-whitespace char. 597 .TP 591 598 .I spell_language 592 599 Spelling language (en, en\-variant_0, ru, etc) installed with aspell 593 600 package (a full list can be get using 'aspell' utility). -
src/editor/edit.c
diff --git a/src/editor/edit.c b/src/editor/edit.c index 2cd91c9..b281e64 100644
a b int option_cursor_beyond_eol = 0; 90 90 int option_line_state = 0; 91 91 int option_line_state_width = 0; 92 92 gboolean option_cursor_after_inserted_block = FALSE; 93 int option_smart_home_end = 0; 93 94 94 95 int option_edit_right_extreme = 0; 95 96 int option_edit_left_extreme = 0; … … edit_move_to_bottom (WEdit * edit) 942 943 } 943 944 } 944 945 946 /** returns index of first char on line or the first nonspace char */ 947 948 static long 949 edit_bol_var (WEdit * edit, long current) 950 { 951 long tmp; 952 int b; 953 954 if (!option_smart_home_end) 955 return edit_bol (edit, current); 956 957 if (current < 0) 958 current = 0; 959 960 if (edit_get_byte (edit, current - 1) != '\n') /* not at BOL */ 961 return edit_bol (edit, current); 962 963 if (edit_get_byte (edit, current) == '\n') /* on an empty line */ 964 return current; 965 966 for (tmp = current; (b = edit_get_byte (edit, tmp)) != '\n'; tmp++) 967 { 968 if (!isspace (b)) 969 return tmp; 970 } 971 return current; 972 } 973 974 /* --------------------------------------------------------------------------------------------- */ 975 /** returns index of last char on line or the last nonspace char */ 976 static long 977 edit_eol_var (WEdit * edit, long current) 978 { 979 long tmp; 980 int b; 981 982 if (!option_smart_home_end) 983 return edit_eol (edit, current); 984 985 if (current >= edit->last_byte) 986 current = edit->last_byte; 987 988 if (edit_get_byte (edit, current) != '\n') /* not at BOL */ 989 return edit_eol (edit, current); 990 991 if (edit_get_byte (edit, current - 1) == '\n') /* on an empty line */ 992 return current; 993 994 for (tmp = current - 1; (b = edit_get_byte (edit, tmp)) != '\n'; tmp--) 995 { 996 if (!isspace (b)) 997 return tmp + 1; 998 } 999 return current; 1000 } 1001 945 1002 /* --------------------------------------------------------------------------------------------- */ 946 1003 /** goto beginning of line */ 947 1004 948 1005 static void 949 1006 edit_cursor_to_bol (WEdit * edit) 950 1007 { 951 edit_cursor_move (edit, edit_bol (edit, edit->curs1) - edit->curs1);1008 edit_cursor_move (edit, edit_bol_var (edit, edit->curs1) - edit->curs1); 952 1009 edit->search_start = edit->curs1; 953 1010 edit->prev_col = edit_get_col (edit); 954 1011 edit->over_col = 0; … … edit_cursor_to_bol (WEdit * edit) 960 1017 static void 961 1018 edit_cursor_to_eol (WEdit * edit) 962 1019 { 963 edit_cursor_move (edit, edit_eol (edit, edit->curs1) - edit->curs1);1020 edit_cursor_move (edit, edit_eol_var (edit, edit->curs1) - edit->curs1); 964 1021 edit->search_start = edit->curs1; 965 1022 edit->prev_col = edit_get_col (edit); 966 1023 edit->over_col = 0; -
src/editor/edit.h
diff --git a/src/editor/edit.h b/src/editor/edit.h index 3ff1860..0b9ebe3 100644
a b extern int visible_tws; 56 56 extern int simple_statusbar; 57 57 extern int option_check_nl_at_eof; 58 58 extern int show_right_margin; 59 extern int option_smart_home_end; 59 60 60 61 /*** declarations of public functions ************************************************************/ 61 62 -
src/editor/editoptions.c
diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c index 4ab2aea..4e7195c 100644
a b edit_options_dialog (WDialog * h) 151 151 QUICK_STOP_GROUPBOX, 152 152 QUICK_SEPARATOR (FALSE), 153 153 QUICK_SEPARATOR (FALSE), 154 QUICK_SEPARATOR (FALSE), 154 155 QUICK_START_GROUPBOX (N_("Tabulation")), 155 156 QUICK_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL), 156 157 QUICK_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs, … … edit_options_dialog (WDialog * h) 168 169 QUICK_CHECKBOX (N_("Save file &position"), &option_save_position, NULL), 169 170 QUICK_CHECKBOX (N_("&Visible trailing spaces"), &visible_tws, NULL), 170 171 QUICK_CHECKBOX (N_("Visible &tabs"), &visible_tabs, NULL), 172 QUICK_CHECKBOX (N_("Smart &Home/End key behavior"), &option_smart_home_end, NULL), 171 173 QUICK_CHECKBOX (N_("Synta&x highlighting"), &option_syntax_highlighting, NULL), 172 174 QUICK_CHECKBOX (N_("C&ursor after inserted block"), &option_cursor_after_inserted_block, NULL), 173 175 QUICK_CHECKBOX (N_("Pers&istent selection"), &option_persistent_selections, -
src/setup.c
diff --git a/src/setup.c b/src/setup.c index 1e5e8c6..bf44a74 100644
a b static const struct 344 344 { "editor_option_auto_para_formatting", &option_auto_para_formatting }, 345 345 { "editor_option_typewriter_wrap", &option_typewriter_wrap }, 346 346 { "editor_edit_confirm_save", &edit_confirm_save }, 347 { "editor_smart_home_end", &option_smart_home_end }, 347 348 { "editor_syntax_highlighting", &option_syntax_highlighting }, 348 349 { "editor_persistent_selections", &option_persistent_selections }, 349 350 { "editor_cursor_beyond_eol", &option_cursor_beyond_eol },