On 28/11/14 09:53, Eliseo Martínez wrote:
Since patch 7.4.232 (http://markmail.org/message/vo7ruair5raccawp), vim
recognizes 's/\n//' as a special case, and transforms it into a join command.
The generated join command involves lines in command line-range. Thus,
'1,3s/\n//' joins lines 1, 2, and 3, which implies it only deletes 2 newlines
(not 3). Also, for the particular case of just one line, 's/\n//' does nothing.
I mean, do_join gets invoked, but it does nothing in that case.
Now, another interpretation would be possible, in which the generated join
should involve lines in rage plus one. This is, '1,3s/\n//' would join 4 lines,
effectively deleting 3 newlines, and 's/\n//' would join current line with the
next one, deleting 1 newline.
Then, my question is: Is current behaviour the canonical one, or is it a bug?
Div vim previous to 7.4.232 behave the same?
Thanks.
If replacing \n by something else (or by nothing) in a :substitute is
done by invoking the :join code, then it is normal that :123,123j does
nothing (it is documented under :help :join). Similarly, 1,3j joins
lines 1 to 3, removing only two ends-of-lines.
Alternately, the behaviour might be changed, deleting an end-of-line
even at the very end of the :substitute range, but this would break
existing behaviour, and every Vim old-timer knows that Bram is extremely
reluctant to lose backward compatibility.
I believe that the present behaviour should be kept, but documented
somewhere near the help for :substitute.
Best regards,
Tony.
--
“Be yourself: all others are already taken.”
-- Oscar Wilde
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.