Re: [Geany-devel] [PATCH] Changebar port from codeblocks

2010-06-13 Thread Enrico Tröger
On Sat, 12 Jun 2010 20:23:56 +0200, Jiří wrote:

 2010/6/12 Enrico Tröger enrico.troe...@uvena.de:
  On Thu, 10 Jun 2010 09:29:18 +1000, Lex wrote:
 
  Hi Jiri,
 
  I'd recommend that you send your patches as attachments, putting
  them in the mail body can get them wrapped.
 
  +1, Nick also said this above.
 
 
 Sorry, I can resend them again, just tell me. (I don't want to spam
 the mailing list too much - I have already caused a nasty email storm
 on your list).

off-topic:
I know you used git send-email and so the patch got into the body. But
I didn't understand yet why git send-email does this by default at all.
Copying patches from the mail body is very error-prone due to various
mail clients and how they handle and display contents. Do the git guys
expect everyone to use mutt? :)
Seriously, this should not sound like a rant or something, I'm
seriously asking how such mails are meant to be handled.

on-topic:
As saying below, I personally don't want to get this feature into Geany
before it is in mainline Scintilla, so there is probably no need to
re-send the patch for now. But that's just me.


  And a bit more info would be cool, a short description and/or a
  screenshot. I hardly remember some new visual Scintilla features
  from the past which could be what the topic is about but I don't
  have the time to look it all up. And I don't know CodeBlocks.
  Thanks.
 
 OK, here's a screenshot:
 
 http://dl.dropbox.com/u/2554438/changebar.png
 
 (Notice the green and yellow lines.) When you load the document, there
 are no lines. The first time you modify a line, a yellow stripe
 appears next to it. If you save it, it becomes green. So the
 screenshot can be interpreted as:
 
 * lines 61-64 have been modified since document loading, but these are
 saved on the disk
 * lines 65-69 have been modified but have not yet been saved (have
 been modified after the last save)
 * the remaining lines haven't been edited at all
 
 I find it pretty useful for navigation in source code because you can
 quickly visually see the places you have been working on.

Thanks for the details.
I remember it now, I read about it on the Scintilla mailing list I
think.


 It has been introduced by Neil as an experimental feature for
 scintilla two years ago:
 
 http://groups.google.com/group/scintilla-interest/browse_thread/thread/2e5e1b82350886cc?pli=1
 
 I had a discussion with Neil whether this couldn't be merged to
 mainline scintilla, but he finds the current implementation not good
 enough:
 
 http://groups.google.com/group/scintilla-interest/browse_thread/thread/c63c3402a222d44b
 
 Despite its (in practice not visible) limitations, I find it so much
 useful that I decided to port it from codeblocks (which contains
 probably the most up-to-date version). I understand that it probably
 won't get merged to geany, but some people might find it useful too.

I also think this could be cool. But really, I'd wish to use it from
mainline Scintilla, so it needs to get in there before. So, maybe the
next step should be to get in touch with Neil (again) and/or fix the
code to be ready for the masses.

Regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.asc


signature.asc
Description: PGP signature
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] [PATCH] Changebar port from codeblocks

2010-06-13 Thread Jiří Techet
2010/6/13 Enrico Tröger enrico.troe...@uvena.de:
 On Sat, 12 Jun 2010 20:23:56 +0200, Jiří wrote:

 2010/6/12 Enrico Tröger enrico.troe...@uvena.de:
  On Thu, 10 Jun 2010 09:29:18 +1000, Lex wrote:
 
  Hi Jiri,
 
  I'd recommend that you send your patches as attachments, putting
  them in the mail body can get them wrapped.
 
  +1, Nick also said this above.
 

 Sorry, I can resend them again, just tell me. (I don't want to spam
 the mailing list too much - I have already caused a nasty email storm
 on your list).

 off-topic:
 I know you used git send-email and so the patch got into the body. But
 I didn't understand yet why git send-email does this by default at all.
 Copying patches from the mail body is very error-prone due to various
 mail clients and how they handle and display contents. Do the git guys
 expect everyone to use mutt? :)
 Seriously, this should not sound like a rant or something, I'm
 seriously asking how such mails are meant to be handled.

See here:

http://www.kernel.org/pub/software/scm/git/docs/git-am.html

As Frank said, it uses the mbox format supported by many mail clients.
There's a nice short git tutorial here:

http://www.kernel.org/pub/software/scm/git/docs/everyday.html

that shows typical git workflows.


 on-topic:
 As saying below, I personally don't want to get this feature into Geany
 before it is in mainline Scintilla, so there is probably no need to
 re-send the patch for now. But that's just me.


  And a bit more info would be cool, a short description and/or a
  screenshot. I hardly remember some new visual Scintilla features
  from the past which could be what the topic is about but I don't
  have the time to look it all up. And I don't know CodeBlocks.
  Thanks.

 OK, here's a screenshot:

 http://dl.dropbox.com/u/2554438/changebar.png

 (Notice the green and yellow lines.) When you load the document, there
 are no lines. The first time you modify a line, a yellow stripe
 appears next to it. If you save it, it becomes green. So the
 screenshot can be interpreted as:

 * lines 61-64 have been modified since document loading, but these are
 saved on the disk
 * lines 65-69 have been modified but have not yet been saved (have
 been modified after the last save)
 * the remaining lines haven't been edited at all

 I find it pretty useful for navigation in source code because you can
 quickly visually see the places you have been working on.

 Thanks for the details.
 I remember it now, I read about it on the Scintilla mailing list I
 think.


 It has been introduced by Neil as an experimental feature for
 scintilla two years ago:

 http://groups.google.com/group/scintilla-interest/browse_thread/thread/2e5e1b82350886cc?pli=1

 I had a discussion with Neil whether this couldn't be merged to
 mainline scintilla, but he finds the current implementation not good
 enough:

 http://groups.google.com/group/scintilla-interest/browse_thread/thread/c63c3402a222d44b

 Despite its (in practice not visible) limitations, I find it so much
 useful that I decided to port it from codeblocks (which contains
 probably the most up-to-date version). I understand that it probably
 won't get merged to geany, but some people might find it useful too.

 I also think this could be cool. But really, I'd wish to use it from
 mainline Scintilla, so it needs to get in there before. So, maybe the
 next step should be to get in touch with Neil (again) and/or fix the
 code to be ready for the masses.

I totally agree with you. I also think that this should be merged to
the mainline scintilla first. Unfortunately I won't have free time to
spend on proper implementation (which is trickier than it may seem if
you consider it should work well with undo) in the near future (and
neither Neil has) so all I can do right now is to provide a patch when
a new scintilla is used by geany if there are some people interested
in using it (I'll do that for myself anyway).

Regards,

Jiri
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


Re: [Geany-devel] [PATCH] Changebar port from codeblocks

2010-06-12 Thread Jiří Techet
2010/6/12 Enrico Tröger enrico.troe...@uvena.de:
 On Thu, 10 Jun 2010 09:29:18 +1000, Lex wrote:

 Hi Jiri,

 I'd recommend that you send your patches as attachments, putting them
 in the mail body can get them wrapped.

 +1, Nick also said this above.


Sorry, I can resend them again, just tell me. (I don't want to spam
the mailing list too much - I have already caused a nasty email storm
on your list).


 And a bit more info would be cool, a short description and/or a
 screenshot. I hardly remember some new visual Scintilla features from
 the past which could be what the topic is about but I don't have the
 time to look it all up. And I don't know CodeBlocks.
 Thanks.

OK, here's a screenshot:

http://dl.dropbox.com/u/2554438/changebar.png

(Notice the green and yellow lines.) When you load the document, there
are no lines. The first time you modify a line, a yellow stripe
appears next to it. If you save it, it becomes green. So the
screenshot can be interpreted as:

* lines 61-64 have been modified since document loading, but these are
saved on the disk
* lines 65-69 have been modified but have not yet been saved (have
been modified after the last save)
* the remaining lines haven't been edited at all

I find it pretty useful for navigation in source code because you can
quickly visually see the places you have been working on.

It has been introduced by Neil as an experimental feature for
scintilla two years ago:

http://groups.google.com/group/scintilla-interest/browse_thread/thread/2e5e1b82350886cc?pli=1

I had a discussion with Neil whether this couldn't be merged to
mainline scintilla, but he finds the current implementation not good
enough:

http://groups.google.com/group/scintilla-interest/browse_thread/thread/c63c3402a222d44b

Despite its (in practice not visible) limitations, I find it so much
useful that I decided to port it from codeblocks (which contains
probably the most up-to-date version). I understand that it probably
won't get merged to geany, but some people might find it useful too.

Regards,

Jiri
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel


[Geany-devel] [PATCH] Changebar port from codeblocks

2010-06-09 Thread Jiří Techet
This patch enables experimental scintilla changebar for geany. For testing only.

Signed-off-by: Jiří Techet tec...@gmail.com
---
 scintilla/CellBuffer.cxx  |  366 ++---
 scintilla/CellBuffer.h|   94 +-
 scintilla/Document.cxx|   48 +-
 scintilla/Document.h  |   13 ++-
 scintilla/Editor.cxx  |   76 -
 scintilla/RunStyles.cxx   |   42 +
 scintilla/RunStyles.h |6 +
 scintilla/include/Scintilla.h |   15 ++-
 scintilla/include/Scintilla.iface |9 +-
 src/editor.c  |2 +-
 src/highlighting.c|   21 ++-
 src/sciwrappers.c |   10 +-
 12 files changed, 649 insertions(+), 53 deletions(-)

diff --git a/scintilla/CellBuffer.cxx b/scintilla/CellBuffer.cxx
index 064ef1a..0a47249 100644
--- a/scintilla/CellBuffer.cxx
+++ b/scintilla/CellBuffer.cxx
@@ -21,6 +21,88 @@
 using namespace Scintilla;
 #endif
 
+/* CHANGEBAR begin */
+LineChanges::LineChanges() : collecting(0), edition(0) {
+}
+
+LineChanges::~LineChanges() {
+}
+
+void LineChanges::AdvanceEdition() {
+edition = (edition + 1) % 0x4000;
+}
+
+int LineChanges::GetEdition() const {
+return edition;
+}
+
+char *LineChanges::PersistantForm() const {
+if (collecting)
+return state.PersistantForm();
+else
+return 0;
+}
+
+void LineChanges::SetChanges(const char *changesState) {
+if (collecting  changesState) {
+state.FromPersistant(changesState);
+AdvanceEdition();
+}
+}
+
+void LineChanges::InsertText(int line, int edition, bool undoing) {
+if (collecting  !undoing) {
+int position = line;
+int fillLength = 1;
+if (state.FillRange(position, edition, fillLength)) {
+if (fillLength  0) {
+AdvanceEdition();
+}
+}
+}
+}
+
+void LineChanges::InsertLine(int line, int edition, bool undoing) {
+if (collecting  !undoing) {
+state.InsertSpace(line, 1);
+int linePosition = line;
+int fillLength = 1;
+if (state.FillRange(linePosition, edition, fillLength))
+AdvanceEdition();
+}
+}
+
+void LineChanges::RemoveLine(int line, bool undoing) {
+if (collecting  !undoing) {
+state.DeleteRange(line, 1);
+AdvanceEdition();
+}
+}
+
+void LineChanges::EnableChangeCollection(bool collecting_, int lines) {
+collecting = collecting_;
+if (collecting) {
+state.InsertSpace(0, lines);
+}
+}
+
+void LineChanges::ClearChanged() {
+if (collecting) {
+int position = 0;
+int length = state.Length();
+if (state.FillRange(position, 0, length))
+AdvanceEdition();
+}
+}
+
+int LineChanges::GetChanged(int line) const {
+if (collecting) {
+return state.ValueAt(line);
+}
+return 0;
+}
+/* CHANGEBAR end */
+
 LineVector::LineVector() : starts(256), perLine(0) {
Init();
 }
@@ -40,33 +122,78 @@ void LineVector::SetPerLine(PerLine *pl) {
perLine = pl;
 }
 
-void LineVector::InsertText(int line, int delta) {
+/* CHANGEBAR begin */
+void LineVector::InsertText(int line, int delta, int edition, bool undoing) {
+/* CHANGEBAR end */
starts.InsertText(line, delta);
+/* CHANGEBAR begin */
+changes.InsertText(line, edition, undoing);
+/* CHANGEBAR end */
 }
 
-void LineVector::InsertLine(int line, int position, bool lineStart) {
+/* CHANGEBAR begin */
+void LineVector::InsertLine(int line, int position, bool lineStart, int 
edition, bool undoing) {
+/* CHANGEBAR end */
starts.InsertPartition(line, position);
if (perLine) {
if ((line  0)  lineStart)
line--;
perLine-InsertLine(line);
}
+/* CHANGEBAR begin */
+changes.InsertLine(line, edition, undoing);
+/* CHANGEBAR end */
 }
 
 void LineVector::SetLineStart(int line, int position) {
starts.SetPartitionStartPosition(line, position);
 }
 
-void LineVector::RemoveLine(int line) {
+/* CHANGEBAR begin */
+void LineVector::RemoveLine(int line, bool undoing) {
+/* CHANGEBAR end */
starts.RemovePartition(line);
if (perLine) {
perLine-RemoveLine(line);
}
+/* CHANGEBAR begin */
+changes.RemoveLine(line, undoing);
+/* CHANGEBAR end */
 }
 
 int LineVector::LineFromPosition(int pos) const {
return starts.PartitionFromPosition(pos);
 }
+/* CHANGEBAR begin */
+void LineVector::EnableChangeCollection(bool changesCollecting_) {
+DeleteChangeCollection();
+changes.EnableChangeCollection(changesCollecting_, Lines());
+}
+
+void LineVector::DeleteChangeCollection() {
+changes.ClearChanged();
+}
+
+int LineVector::GetChanged(int line) const {
+return changes.GetChanged(line);
+}
+
+int LineVector::GetChangesEdition() const {
+return changes.GetEdition();
+}
+
+void LineVector::SetSavePoint() {
+

Re: [Geany-devel] [PATCH] Changebar port from codeblocks

2010-06-09 Thread Lex Trotman
Hi Jiri,

I'd recommend that you send your patches as attachments, putting them
in the mail body can get them wrapped.

Cheers
Lex
___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel