Comment #10 on issue 287 by [email protected]: Newline substitution behaviour
https://code.google.com/p/vim/issues/detail?id=287

However your patch does not compile because of the lowercase true.

Sorry for that. I'm a contributor to the neovim project, and I compiled / tested my patch there (where that parameter has been refactored into a bool), before transplanting it onto the last version of vim's corresponding file, just to generate the patch.

Vim 7.4 reported "<addresscount> substitutions on 1 line", vim 7.4.232 reports "<addresscount> substitutions on <addresscount> lines" Which I personally think is correct, since this is the number of substitions performed.

If by <addresscount> you mean the number of lines within the range, please notice it's not always true that the number of substitutions is equal to that. That's only true when range doesn't include last line. When it does, number of substitutions equals <addresscount> - 1. As that difference is already included in the definition of joined_lines_count, what's always true is that the number of subsitutions is equal to joined_lines_count - 1. Both last two patches are correct in this sense.

Regarding the number of lines affected, I think what should be considered correct depends on the intended meaning of the message. I mean, whether it refers to lines as they were before the change, or after it. I can only make sense of vim 7.4's behaviour if the "after" interpretation is taken. On the other hand, I personally think the "before" interpretation is more logical. And in that case, reported lines should be equal to reported substitutions. So, I think message meaning should be clarified to reach an agreement on this.

And since we are skipping the join command for the :$s/\n// anyhow, Vim should also skip the message reporting the number of substitutions.

I think reporting user in the no-op edge case would be in fact good ui practice, as that can signal a user misunderstanding of the intended behaviour. But I do agree that, with current code, call to do_sub_msg with sub_nlines and sub_nsubs being 0, no output gets generated anyway, so it can be saved.

Not so sure about not updating sub_nlines and sub_nsubs, though:
- On one hand, given the operation is a no-op, it should have no side-effects. So, it would be ok leaving those globals reflecting the last no-op substitution result. - On the other hand, I don't know if any other code can depend on those globals being updated to reflect the result of the last substitution, be it a no-op or not. I suppose if you opt for not updating them, it's because no such reliance on those globals exists.

So, in essence, I'm ok with the last version of the patch, except for the sub_nlines = 1 thing, until meaning of message is clarified.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
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.

Raspunde prin e-mail lui