On 19 March 2013 03:57, Pedro Pedruzzi <[email protected]> wrote: > 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
That actually looks really good, and as a nice side-effect, avoids the fact that the previous version highlighted the pixel-below-lines space as part of the current line! > 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'm honestly not sure. I suspect not, since as far as the Textview is concerned, the line extents include the inserted child widget. However, I personally could certainly live with the line number for the first line being misaligned. It's unfortunately noticeable, but I certainly don't think it's a show-stopper. It should be possible to use a different workaround by replacing the line-number display. This has been something I've wanted to do for ages, but requires an upgrade to our minimum supported version of PyGtkSourceview. Honestly, this is more likely to happen in a Gtk3 port than anywhere else. Anyway, this is starting to look really nice! cheers, Kai _______________________________________________ meld-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/meld-list
