68924Re: [patch] Handle files with mixed LF - CRLF line endings when doing tag search
- Apr 1, 2013On 01-Apr-2013 Bram Moolenaar <Bram@...> wrote:
>This is an answer I would have never anticipated. In the last 4 years
> Lech Lorens wrote:
> > People using ctags while working on code which is edited by multiple
> > people in various editors will be familiar with this situation: the code
> > ends up with a mix of line endings – some of them are Unix-style, some
> > of them are DOS-style.
> > The problem is that if Vim reads such a file with ff=unix, it will fail
> > to find tags if the tag pattern searched should match on a DOS-style
> > line. The attached patch handles the problem in a naïve but surprisingly
> > effective way: if a pattern search fails, Vim will try putting "\r\*"
> > before the last "$" in the pattern and will retry the search.
> I wonder how many users actually run into files where only some lines
> end in a CR. I would consider such a file broken, and first thing would
> be to strip them all off.
> I suppose you can't do this because others don't see the problem and
> object to have such a change in version control?
> Although the solution would work, I hesitate including this in Vim.
> It's a small audience, and when the pattern indeed can't be found it
> takes twice as long to fail.
I worked at 3 different places and even when I worked in a group of
4 programmers and there was an agreement that we would be using Unix
line endings, there would always appear stray carriage returns in source
code before the issue got solved by setting the source versioning system
In other words, I was absolutely sure that this was an ubiquitous
problem much like the one with indenting with tabs vs spaces.
And yes, you are right, although I would prefer to fix the files, it is
not an option. I think it should have been handled at the version
control level but it wasn't and now it is not going to happen.
> How about this alternative: Filter your tags file to change the patternsThis is something I would prefer to avoid. My current situation is that
> to include an optional CR before the $: \r\=$
to prepare a tags file I process a few millions lines of code (this is
after filtering only the relevant parts from about 80 millions LOC) and
it takes ages to run ctags and cscope. I would rather not cause this
step to take longer and would prefer a 200 ms search instead of a 100 ms
one whenever I execute ":tag foo".
I wonder if others will want to express their opinion.
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 vim_dev+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic Next post in topic >>