about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_misc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 502e41e35..6f58af626 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -787,6 +787,12 @@ bracketedpaste(char **args)
 	    zmult = 1;
 	    if (region_active)
 		killregion(zlenoargs);
+	    /* chop a final newline if it's insertion would be hard to
+	     * distinguish by the user from the line being accepted */
+	    else if (n > 1 && zlecontext != ZLCON_VARED &&
+		    (zlecs + (insmode ? 0 : n - 1)) >= zlell &&
+		    wpaste[n-1] == ZWC('\n'))
+		n--;
 	    yankcs = yankb = zlecs;
 	    doinsert(wpaste, n);
 	    yanke = zlecs;