summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-08-12 17:53:03 +0200
committerOliver Kiddle <opk@zsh.org>2015-08-12 18:05:59 +0200
commitf17eb26a34af69a2238a3d8b46079445e09c096e (patch)
tree899d99253e5e09f03e5da0ca277d13efae795c5f
parentb386bbaf29399b7845a546eae16af32af3cc9205 (diff)
downloadzsh-f17eb26a34af69a2238a3d8b46079445e09c096e.tar.gz
zsh-f17eb26a34af69a2238a3d8b46079445e09c096e.zip
35834: strip a final newline from pasted text: inserting is hard to tell apart from accepting it
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_misc.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 03e2b0953..556a137da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-12 Oliver Kiddle <opk@zsh.org>
+
+ * 35834 (tweaked): Src/Zle/zle_misc.c: strip a final newline from
+ pasted text: inserting is hard to tell apart from accepting it
+
2015-08-12 Mikael Magnusson <mikachu@gmail.com>
* 36077: Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr,
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;