diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2020-01-26 03:18:45 -0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2020-01-26 17:13:00 -0800 |
commit | 2c1d12d0beda7b359fec94c00746b7206ae8fedd (patch) | |
tree | 912cbd6b2dd0d4e390e9afa27018988a99958989 /src | |
parent | 598a1cd7c5b9b0f4e4b175f55b58bdb0e1a398eb (diff) | |
download | rneovim-2c1d12d0beda7b359fec94c00746b7206ae8fedd.tar.gz rneovim-2c1d12d0beda7b359fec94c00746b7206ae8fedd.tar.bz2 rneovim-2c1d12d0beda7b359fec94c00746b7206ae8fedd.zip |
mksession: always write LF "\n" line-endings
- remove `MKSESSION_NL`, `mksession_nl`
- deprecate the "unix" flag of 'sessionoptions'
There is no reason to choose CRLF or LF for session files. Instead just
always write LF.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 6791bbd34c..2950b2950c 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8085,11 +8085,6 @@ static void close_redir(void) } } -#ifdef USE_CRNL -# define MKSESSION_NL -static int mksession_nl = FALSE; /* use NL only in put_eol() */ -#endif - /// ":mkexrc", ":mkvimrc", ":mkview", ":mksession". static void ex_mkrc(exarg_T *eap) { @@ -8142,12 +8137,6 @@ static void ex_mkrc(exarg_T *eap) else flagp = &ssop_flags; -#ifdef MKSESSION_NL - /* "unix" in 'sessionoptions': use NL line separator */ - if (view_session && (*flagp & SSOP_UNIX)) - mksession_nl = TRUE; -#endif - /* Write the version command for :mkvimrc */ if (eap->cmdidx == CMD_mkvimrc) (void)put_line(fd, "version 6.0"); @@ -8236,9 +8225,6 @@ static void ex_mkrc(exarg_T *eap) } xfree(tbuf); } -#ifdef MKSESSION_NL - mksession_nl = FALSE; -#endif } xfree(viewFile); @@ -9964,19 +9950,11 @@ static char *get_view_file(int c) } -/* - * Write end-of-line character(s) for ":mkexrc", ":mkvimrc" and ":mksession". - * Return FAIL for a write error. - */ +/// TODO(justinmk): remove this. Formerly used to choose CRLF or LF for session +// files, but that's useless--instead we always write LF. int put_eol(FILE *fd) { -#if defined(USE_CRNL) && defined(MKSESSION_NL) - if ((!mksession_nl && putc('\r', fd) < 0) || putc('\n', fd) < 0) { -#elif defined(USE_CRNL) - if (putc('\r', fd) < 0 || putc('\n', fd) < 0) { -#else if (putc('\n', fd) < 0) { -#endif return FAIL; } return OK; |