# HG changeset patch
# User David Pope <d.e.pope@gmail.com>
# Date 1334521481 14400
# Node ID df163f8a1c7f2aec494d70d0a6481ab9a17b2cc3
# Parent  cf6e51d14b1fd858dac1589ca69ff3a585693971
Fix Windows console has("filterpipe") and 'binary' option handling w.r.t.
EOL.

This patch does three things, all of them related and necessary:

1. Revert the only not-100%-straightforward change that was in patch 124.

Patch 124 was mainly about moving the "did-i-have-an-eol-when-i-loaded"
setting from global to per-buffer, but it also changed the point at which
the setting was reset.  This patch undoes that last part.  There was a
comment about the line number becoming invalid due to edits, which I
didn't follow up on.

2. Correctly sets has("filterpipe") as "false" on the Windows console,
   leaving it enabled in the GUI as intended by patch 240.

Almost all the code in patch 240 was guarded with FEAT_GUI_W32; for some
reason the change to add has("filterpipe") wasn't.  I took a look at
generalizing the pipe code to cover the console, but it's very GUI-specific
as written.  For the time being the console doesn't do pipes.

3. In test11, set shelltemp before filtering through gzip if
   has("filterpipe") is false.

diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -12080,7 +12080,7 @@
 #ifdef FEAT_SEARCHPATH
 	"file_in_path",
 #endif
-#if (defined(UNIX) && !defined(USE_SYSTEM)) || defined(WIN3264)
+#if (defined(UNIX) && !defined(USE_SYSTEM)) || (defined(WIN3264) && defined(FEAT_GUI_W32))
 	"filterpipe",
 #endif
 #ifdef FEAT_FIND_ID
diff --git a/src/fileio.c b/src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2655,10 +2655,6 @@
     }
 #endif
 
-    /* Reset now, following writes should not omit the EOL.  Also, the line
-     * number will become invalid because of edits. */
-    curbuf->b_no_eol_lnum = 0;
-
     if (recoverymode && error)
 	return FAIL;
     return OK;
@@ -5098,6 +5094,8 @@
     {
 	aco_save_T	aco;
 
+	curbuf->b_no_eol_lnum = 0;  /* in case it was set by the previous read */
+
 	/*
 	 * Apply POST autocommands.
 	 * Careful: The autocommands may call buf_write() recursively!
diff --git a/src/testdir/test11.in b/src/testdir/test11.in
--- a/src/testdir/test11.in
+++ b/src/testdir/test11.in
@@ -24,6 +24,9 @@
 :let $GZIP = ""
 :au FileChangedShell * echo "caught FileChangedShell"
 :set bin
+:if !has("filterpipe")
+: set shelltemp
+:endif
 :au FileWritePre    *.gz   '[,']!gzip
 :au FileWritePost   *.gz   undo
 :/^start of testfile/,/^end of testfile/w! Xtestfile.gz
exporting patch:
<fdopen>
