Using Scintilla in a diff tool

239 views
Skip to first unread message

EMauro

unread,
Jan 28, 2009, 5:09:45 PM1/28/09
to scintilla-interest
I think it is not possible but let's ask anyway. I would like to use
Scintilla to show the differences between two texts. I need to hide
the line number of some lines and show a different line number for
others. It should be clear what I envision since everyone here might
use a diff program sometimes. Is it possible?

Best regards,
Eduardo Mauro

Armel Asselin

unread,
Jan 28, 2009, 5:18:41 PM1/28/09
to scintilla...@googlegroups.com
From: "EMauro" <ema...@gmail.com>
Sent: Wednesday, January 28, 2009 11:09 PM

we do ECMerge, a diff program using Scintilla for its text viewer, we chose
to use a 'dense' presentation, synchronization of the lines is a bit harder
but there is no need to hack Scintilla.

Armel

Neil Hodgson

unread,
Jan 29, 2009, 7:33:36 AM1/29/09
to scintilla...@googlegroups.com
EMauro:

> I need to hide
> the line number of some lines and show a different line number for
> others.

An arbitrary text margin has been suggested before and I'll accept
a good implementation.

Neil

Jason Oster

unread,
Jan 29, 2009, 9:14:53 AM1/29/09
to scintilla...@googlegroups.com

It would also be useful for hex editors and disassemblers; A line number
margin that does not simply increment by a static number, or increments
by a number other than 1.

EMauro

unread,
Jan 29, 2009, 4:38:14 PM1/29/09
to scintilla-interest
Perhaps a new event in order to fetch the line number. I think it is
the easiest solution.

Neil Hodgson

unread,
Jan 30, 2009, 4:28:09 PM1/30/09
to scintilla...@googlegroups.com
EMauro:

> Perhaps a new event in order to fetch the line number. I think it is
> the easiest solution.

In general I prefer not to use callbacks for functionality but
instead have a way to set the data up so that Scintilla can control
and optimize it. There is a fairly high cost to events, particularly
on Windows where they go through SendMessage. This may not appear a
problem for the ~60 lines in a window but I could see this expanding
into features like searching for a particular virtual line number.

I also worry about event handlers that take the opportunity to
perform other actions which have caused bugs in the past. Some
developers would see a per-line callback as a great time to, for
example, change the colours of styles.

Neil

EMauro

unread,
Jan 31, 2009, 4:52:22 AM1/31/09
to scintilla-interest
Neil. I see your point and I agree.

I think that the only viable solution is adding a new property for
getting/setting line numbers. Scintilla would show the line number in
the gutter using this property. A -1 value would show nothing. By
default the property would have the current values. It would be
necessary just an integer per line.

Definitely I am not a C++ expert, far from that, but I could try to
add it to Scintilla.

Eduardo Mauro
ConnectedText

Neil Hodgson

unread,
Jan 31, 2009, 6:46:34 AM1/31/09
to scintilla...@googlegroups.com
EMauro:

> It would be necessary just an integer per line.

Other use cases are for a string per line and for there to be
multiple styles. An example is for 'blame' text as used in version
control systems to show the most recent author of each line along with
a colour to indicate age. Just an integer isn't difficult (although
there should be only a single pointer until the feature is invoked)
but the more complex it has to be the more design needs to be done.

Neil

mptorney

unread,
Apr 6, 2012, 10:31:18 AM4/6/12
to scintilla...@googlegroups.com
I was about to ask this question, but since the discussion in here looks productive and hasn't been updated in a while, I thought I'd bump it. 

Has anything like this been added?
Reply all
Reply to author
Forward
0 new messages