Hi Bram,
On Tue, May 2, 2023 at 12:54 PM Bram Moolenaar <[email protected]>
wrote:
>
> > I have updated the PR to include the "count" item to "from" and "to".
> > It indicates the number of items added or modified.
>
> The help for this is:
>
> count number of items added/removed/modified in this diff
> hunk.
>
> I'm afraid this doesn't really help. First of al, I would expect the
> info not inside the "from" and "to" Dicts, but besides them. And I
> would expect a separate number for items added/deleted and items
> modified. Something like:
>
> Each item in the returned List is a Dict containing
> information about a diff hunk. Each Dict contains the
> following items:
> from Dict with {list1} diff hunk information
> to Dict with {list2} diff hunk information
> extra Number of items added (positive) or
> removed (negative)
> modified Number of items that were modified
>
I have updated the PR to add the "added" and "modified" items for every
diff hunk.
The "added" item will be positive if new strings are added to the original
List
and will be negative if strings are removed from the original List. The
"modified"
item indicates the number of strings modified from the original List.
I have also removed the "count" item.
Regards,
Yegappan
> > The way to interpret the "from" and "to" items is:
> > The text beginning at the "start" item and ending at the "end" item in
> > "from" is replaced by the text beginning at the "start" item and ending
> > at the "end" item in "to" in a diff hunk.
>
> This needs the addition that the "to" item refers to the index and byte
> in {list2}. This is important, since previous hunks may have added and
> removed items.
>
> This part of the help is confusing and probably not right:
>
> The "byte" is -1 if text is added or removed.
>
> In the "from" dict this doesn't make sense. If text is added (and
> nothing modified) then "start" and "end should be equal, the position
> where the text is inserted. If text is removed then "start" gives the
> start of the removed text and "end" the end. The text exists, thus
> there is no reason to use -1.
>
> It's important to get this right. We had similar issues to solve with
> the listener callback function. See the help for listner_add(). It
> might actually be helpful if the information is in the same form.
>
>
>
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DQfhyN%3DtnHSOVhgSxLQKdmCfuWa84OOmRRykfBu9wtBA%40mail.gmail.com.