1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-12-29 16:25:35 +01:00

35834: strip a final newline from pasted text: inserting is hard to tell apart from accepting it

This commit is contained in:
Oliver Kiddle 2015-08-12 17:53:03 +02:00
parent b386bbaf29
commit f17eb26a34
2 changed files with 11 additions and 0 deletions

View file

@ -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,

View file

@ -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;