> On Nov 12, 2019, at 2:26 PM, Bram Moolenaar <b...@moolenaar.net> wrote:
> 
> 
> I wrote:
> 
>> Brennan Vincent wrote:
>> 
>>> When joining a line that is followed by an empty line (or one with only 
>>> spaces), POSIX specifies that it should be deleted without the current 
>>> line being affected. See the section "Join" in 
>>> https://pubs.opengroup.org/onlinepubs/9699919799/ .
>>> 
>>> However, vim appends a space to the current line in this case. For 
>>> example, if line 1 is "foo", and line 2 is blank, after executing :1j 
>>> line 1 will be "foo ", as can be seen by executing the following (`ex` 
>>> is provided by `vi` on my system)
>>> 
>>> $ echo -e 'foo\n' > test.txt && echo -e '1j\nwq' | ex test.txt && wc -c 
>>> test.txt
>>> 5 test.txt
>>> 
>>> nvi/nex give the POSIX behavior:
>>> 
>>> $ echo -e 'foo\n' > test.txt && echo -e '1j\nwq' | nex test.txt && wc -c 
>>> test.txt
>>> 4 test.txt
>>> 
>>> Is this a bug, or intentional?
>> 
>> I can't think of a reason why it works this way.  And the trailing space
>> is useless.  So we should call it a bug.
>> 
>> What should happen if the second line is blank, not empty?
> 
> The spec apparently says that blank lines are also not resulting in a
> trailing space:
> 
> 1. Discard leading <space> characters from the line to be joined.
> 2. If the line to be joined is now empty, delete it, and skip steps 3 through 
> 5.
> 
> -- 
> hundred-and-one symptoms of being an internet addict:
> 78. You find yourself dialing IP numbers on the phone.
> 
> /// Bram Moolenaar -- b...@moolenaar.net <mailto:b...@moolenaar.net> -- 
> http://www.Moolenaar.net <http://www.moolenaar.net/>   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ 
> <http://www.vim.org/sponsor/> \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org 
> <http://www.zimbu.org/>        ///
> \\\            help me help AIDS victims -- http://ICCF-Holland.org 
> <http://iccf-holland.org/>    ///

Tony: Thanks for the tip. I have tried with `VIM_POSIX=1 vim -u NONE` and I get 
the same undocumented un-POSIX-like behavior.

Bram: Thanks for confirming. If we are agreed that this is a bug, is there some 
Vim bug tracker I should enter it on?

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/C5B4034B-5C32-46B6-AEF5-1FDBDBC64FBA%40umanwizard.com.

Reply via email to