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; |
83 | 83 | int option_cursor_beyond_eol = 0; |
84 | 84 | int option_line_state = 0; |
85 | 85 | int option_line_state_width = 0; |
| 86 | int option_autodetect_lb = 0; |
86 | 87 | |
87 | 88 | int option_edit_right_extreme = 0; |
88 | 89 | int option_edit_left_extreme = 0; |
… |
… |
edit_load_file (WEdit * edit) |
484 | 485 | /* If we are dealing with a real file, check that it exists */ |
485 | 486 | if (check_file_access (edit, edit->filename, &edit->stat1)) |
486 | 487 | 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; |
488 | 493 | |
489 | 494 | if (lb_type != LB_ASIS && lb_type != LB_UNIX) |
490 | 495 | fast_load = 0; |
diff --git a/src/editor/edit.h b/src/editor/edit.h
index d6b8344..09c3350 100644
a
|
b
|
extern int option_auto_para_formatting; |
55 | 55 | extern int option_fill_tabs_with_spaces; |
56 | 56 | extern int option_return_does_auto_indent; |
57 | 57 | extern int option_backspace_through_tabs; |
| 58 | extern int option_autodetect_lb; |
58 | 59 | extern int option_fake_half_tabs; |
59 | 60 | extern int option_persistent_selections; |
60 | 61 | extern int option_cursor_beyond_eol; |
diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c
index ece015c..11993ee 100644
a
|
b
|
edit_options_dialog (WEdit * edit) |
107 | 107 | N_("Confir&m before saving"), &edit_confirm_save), |
108 | 108 | /* 12 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H, |
109 | 109 | 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, |
112 | 112 | 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, |
114 | 114 | 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, |
116 | 116 | 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, |
118 | 118 | 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")), |
121 | 123 | QUICK_END |
122 | 124 | }; |
123 | 125 | |
diff --git a/src/setup.c b/src/setup.c
index 2d7dad7..9d7b042 100644
a
|
b
|
static const struct |
292 | 292 | { "editor_word_wrap_line_length", &option_word_wrap_line_length }, |
293 | 293 | { "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces }, |
294 | 294 | { "editor_return_does_auto_indent", &option_return_does_auto_indent }, |
| 295 | { "editor_autodetect_linebreak", &option_autodetect_lb }, |
295 | 296 | { "editor_backspace_through_tabs", &option_backspace_through_tabs }, |
296 | 297 | { "editor_fake_half_tabs", &option_fake_half_tabs }, |
297 | 298 | { "editor_option_save_mode", &option_save_mode }, |