Am 2016-01-01 16:53, schrieb Bram Moolenaar:
I wrote:
Ken Takata wrote:
> 2016/1/1 Fri 4:10:22 UTC+9 Bram Moolenaar wrote:
> > > 1. About diff.exe
> > >
> > > diff.exe from gnuwin32 is 32-bit binary, and it uses gettext and libiconv.
> > > Doesn't it conflict with 64-bit builds? diff.exe bundled with the
official
> > > Vim 7.4 installer doesn't depend on gettext and libiconv, so I think using
> > > diff.exe from gvim74.exe is safer.
> > >
> > > Additionally, diff.exe is installed under the GvimExt directory, but it
> > > should be installed to the same directory as gvim.exe.
> > >
> > >
https://github.com/k-takata/vim/commit/3624185df8c304669a6ad4a50d58dea6147cc0ac
> >
> > It's important that the diff program can handle different line endings.
> > There are many that won't work nicely. The diff.exe included in the
> > installer is an older version of GNU diffutils.
>
> Sorry, I don't understand well...
> Does the diff.exe included in the installer can handle different line endings?
> Is the diff.exe enough for our purpose? Or do we need more up-to-date GNU
> diffutils?
The diff.exe I have included works well. I don't expect useful
improvements from later versions. When building it with another
compiler or libraries it's possible to make it behave worse.
BTW: If someone wants to spend time on this, the best solution would be
not to use an external diff program. Writing the temp files, invoking
diff and parsing the result has a lot of overhead.
There is a C# implementation that has a lot of comments, should be
possible to turn this into a C implementation that we can include in
Vim: http://www.mathertel.de/Diff/ViewSrc.aspx
Rewriting it means we can apply the Vim license and have no problems
distributing it. There are C implementations of diff, but they all
appear to be either hard to include in Vim or have license issues.
A few remarks:
- The Item struct has its equivalent as diff_T in Vim.
- The core algorithm works with an array of numbers. If done properly
we can use this for lines of text AND for differences between two
lines. This can improve the diff highlighting for changed lines.
- The Vim ex_diffupdate() function, where it calls diff_file() and
diff_read(), is where the algorithm would be invoked.
- The code can compare two files at a time, the code for handling 3 and
4 files already exists in Vim.
- We can probably drop all the code for writing the temp files and
reading back the diff. I don't think there is a diff program that
produces better results (and if there is, we should be able to update
the code).
- For short files or files with few differences we could run the
algorithm on every change to keep the diff updated, instead of the
workarounds that are currently in place. A simple solution would
measure the time it takes to run the algorithm and abort if it's
taking too long (with an option to set the timeout). And abort if
the
user types.
Anyone who would like to work on this?
I don't think, I have time to work on this, but this could be a possible
GSoC (google summer of code project, if we ever participate on one
again).
And I have suggested other ideas here:
https://groups.google.com/d/msg/vim_dev/AmMWxM0dIIA/CAwEplRRBM0J
Such ideas should be documented somewhere, so that people will find it
easier,
e.g. something like this:
http://vim.wikia.com/wiki/Vim_GSoC_2011_Ideas
(much of this still holds)
I have tried to log in to create a new page, but it seems wikia login
links do
not currently work. This is getting more and more unusable.
BTW: git has something similar:
https://git.wiki.kernel.org/index.php/SmallProjectsIdeas
Best,
Christian
--
--
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.