mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -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". | /// ":mkexrc", ":mkvimrc", ":mkview", ":mksession". | ||||||
| static void ex_mkrc(exarg_T *eap) | static void ex_mkrc(exarg_T *eap) | ||||||
| { | { | ||||||
| @@ -8142,12 +8137,6 @@ static void ex_mkrc(exarg_T *eap) | |||||||
|     else |     else | ||||||
|       flagp = &ssop_flags; |       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 */ |     /* Write the version command for :mkvimrc */ | ||||||
|     if (eap->cmdidx == CMD_mkvimrc) |     if (eap->cmdidx == CMD_mkvimrc) | ||||||
|       (void)put_line(fd, "version 6.0"); |       (void)put_line(fd, "version 6.0"); | ||||||
| @@ -8236,9 +8225,6 @@ static void ex_mkrc(exarg_T *eap) | |||||||
|       } |       } | ||||||
|       xfree(tbuf); |       xfree(tbuf); | ||||||
|     } |     } | ||||||
| #ifdef MKSESSION_NL |  | ||||||
|     mksession_nl = FALSE; |  | ||||||
| #endif |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   xfree(viewFile); |   xfree(viewFile); | ||||||
| @@ -9964,19 +9950,11 @@ static char *get_view_file(int c) | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /// TODO(justinmk): remove this. Formerly used to choose CRLF or LF for session | ||||||
|  * Write end-of-line character(s) for ":mkexrc", ":mkvimrc" and ":mksession". | // files, but that's useless--instead we always write LF. | ||||||
|  * Return FAIL for a write error. |  | ||||||
|  */ |  | ||||||
| int put_eol(FILE *fd) | 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) { |   if (putc('\n', fd) < 0) { | ||||||
| #endif |  | ||||||
|     return FAIL; |     return FAIL; | ||||||
|   } |   } | ||||||
|   return OK; |   return OK; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes