On Thu, Mar 14, 2013 at 6:15 PM, Kai Willadsen <[email protected]> wrote:
> I'm actually surprised how well that works! I think we need to figure
> out a way of doing what other diff tools do, and indicating the areas
> that have been inserted to get the alignment right. I'm not sure
> whether GtkTextView will let us do that easily, but we can see.
>
> I've just had an alternative crazy idea. If tags don't give us the
> flexibility we need, we could always insert a custom GTK widget after
> each chunk, and give allocation to the widget based on required
> padding. That should allow us to use whatever presentation we like.
>
> ...don't do that though. That's a crazy idea.

I've just managed to indicate the inserted areas with a nice hatch
pattern. I think it is actually very close to what I imagined before.
Please take a look:

https://github.com/pedrox/meld/commit/92974e0754da4e45dd9f111c6bc8cd06cafc9157

But there is still a problem that might be solved by your crazy idea.
There is a particular case that we cannot fix the alignment with
pixel-below-lines. We can't add a space before line 1 with
pixel-below-lines. It is the case when there is change in the form
DiffChunk(tag='insert', start_a=0, end_a=0, start_b=0, end_b=X).

We can't use pixel-above-lines as well, because the displayed line
numbers would be aligned at the beginning of the padding not where the
text line really begins

We actually want to add a space _between_ lines, not below nor above.
Can we do that with your trick?

>> I have some questions:
>>
>> 1. Where is a good place to do the tag creation? I tried somewhere in
>> the constructor but it seems that the linediffer was not ready to
>> iterate over changes yet.
>
> I can't see any way of getting away from having a tag per chunk, which
> means that there's no way to do it in the constructor. You can do this
> is many places, but FileDiff._diff_files() is the first place where
> we're guaranteed to have the diffs. Of course, those diffs can change,
> and if they do then we'll get a callback to
> FileDiff.on_diffs_changed(), which would probably be the right place
> to update and revalidate tags.
>
>> 2. How about 3 way filediffs? I would need to iterate over chunks on
>> the 3 panes.
>
> Exactly. Things are always complicated by 3-way diffs, but in this
> case I think it's just a matter of adapting your code to use
> linediffer.all_changes() instead of single_changes() and taking the
> max of three offsets rather than of two.

Ok, I'll try to do that next.

ızznɹpǝԀ oɹpǝԀ
_______________________________________________
meld-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/meld-list

Reply via email to