diff options
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/misc2.c b/src/misc2.c index 65fc61e7ab..452535d46e 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1147,41 +1147,41 @@ get_fileformat_force ( return EOL_DOS; } -/* - * Set the current end-of-line type to EOL_DOS, EOL_UNIX or EOL_MAC. - * Sets both 'textmode' and 'fileformat'. - * Note: Does _not_ set global value of 'textmode'! - */ -void -set_fileformat ( - int t, - int opt_flags /* OPT_LOCAL and/or OPT_GLOBAL */ -) -{ - char *p = NULL; - - switch (t) { - case EOL_DOS: - p = FF_DOS; - curbuf->b_p_tx = TRUE; - break; - case EOL_UNIX: - p = FF_UNIX; - curbuf->b_p_tx = FALSE; - break; - case EOL_MAC: - p = FF_MAC; - curbuf->b_p_tx = FALSE; - break; +/// Set the current end-of-line type to EOL_UNIX, EOL_MAC, or EOL_DOS. +/// +/// Sets 'fileformat'. +/// +/// @param eol_style End-of-line style. +/// @param opt_flags OPT_LOCAL and/or OPT_GLOBAL +void set_fileformat(int eol_style, int opt_flags) +{ + char *p = NULL; + + switch (eol_style) { + case EOL_UNIX: + p = FF_UNIX; + break; + case EOL_MAC: + p = FF_MAC; + break; + case EOL_DOS: + p = FF_DOS; + break; + } + + // p is NULL if "eol_style" is EOL_UNKNOWN. + if (p != NULL) { + set_string_option_direct((char_u *)"ff", + -1, + (char_u *)p, + OPT_FREE | opt_flags, + 0); } - if (p != NULL) - set_string_option_direct((char_u *)"ff", -1, (char_u *)p, - OPT_FREE | opt_flags, 0); - /* This may cause the buffer to become (un)modified. */ + // This may cause the buffer to become (un)modified. check_status(curbuf); redraw_tabline = TRUE; - need_maketitle = TRUE; /* set window title later */ + need_maketitle = TRUE; // Set window title later. } /* |