diff options
author | Andy Williams <andy@andywilliams.me> | 2015-08-29 14:46:18 +0100 |
---|---|---|
committer | Andy Williams <andy@andywilliams.me> | 2015-08-29 14:46:18 +0100 |
commit | 7455ec0f08ab68387892dcf96169015bcd0b9c2c (patch) | |
tree | 85b8127bdda23cf63aeef2e900813d502f42e882 | |
parent | 9f96fa0c00fe569ad5fbb5746f60c940c8fe9f8e (diff) | |
download | efl-7455ec0f08ab68387892dcf96169015bcd0b9c2c.tar.gz |
[editor] Make whitespace trimming an option
Add a global setting to turn off the behaviour
-rw-r--r-- | legacy/elm_code/src/lib/elm_code_common.h | 7 | ||||
-rw-r--r-- | legacy/elm_code/src/lib/elm_code_file.c | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/legacy/elm_code/src/lib/elm_code_common.h b/legacy/elm_code/src/lib/elm_code_common.h index 9c8ec5ab2e..5efe685d27 100644 --- a/legacy/elm_code/src/lib/elm_code_common.h +++ b/legacy/elm_code/src/lib/elm_code_common.h @@ -61,11 +61,18 @@ extern "C" { * @brief Common data structures and constants. */ +struct _Elm_Code_Config +{ + Eina_Bool trim_whitespace; +}; + struct _Elm_Code { Elm_Code_File *file; Eina_List *widgets; Eina_List *parsers; + + struct _Elm_Code_Config config; }; /** diff --git a/legacy/elm_code/src/lib/elm_code_file.c b/legacy/elm_code/src/lib/elm_code_file.c index 07ff643953..5db1bfa9f2 100644 --- a/legacy/elm_code/src/lib/elm_code_file.c +++ b/legacy/elm_code/src/lib/elm_code_file.c @@ -158,6 +158,7 @@ EAPI Elm_Code_File *elm_code_file_open(Elm_Code *code, const char *path) EAPI void elm_code_file_save(Elm_Code_File *file) { Eina_List *item; + Elm_Code *code; Elm_Code_Line *line_item; const char *path, *content, *crchars; char *tmp; @@ -165,6 +166,7 @@ EAPI void elm_code_file_save(Elm_Code_File *file) short crlength; FILE *out; + code = file->parent; path = elm_code_file_path_get(file); tmp = _elm_code_file_tmp_path_get(file); crchars = elm_code_file_line_ending_chars_get(file, &crlength); @@ -178,7 +180,8 @@ EAPI void elm_code_file_save(Elm_Code_File *file) EINA_LIST_FOREACH(file->lines, item, line_item) { - if (!elm_code_line_contains_widget_cursor(line_item)) + if (code && code->config.trim_whitespace && + !elm_code_line_contains_widget_cursor(line_item)) elm_code_line_text_trailing_whitespace_strip(line_item); content = elm_code_line_text_get(line_item, &length); |