We already have a test-branch including Scintilla 2.01:
svn co svn://svn.berlios.de/codeblocks/branches/scintilla
should work for anonymous svn-access.
You should use this to determine whether you got a selection (the below code works for multiple selection as well as for rectangular selections):
bool wxScintilla::HasSelection() {
return SendMsg (SCI_GETSELTEXT, 0, 0) > 0;
}
Its the safest and correct way to do it:
http://www.scintilla.org/ScintillaDoc.html#SCI_GETSELTEXT (http://www.scintilla.org/ScintillaDoc.html#SCI_GETSELTEXT)
Eran
Hi, just noticed, GetSelectionNStart and GetSelectionNEnd are missing an argument
Changed another 2 lines too
edit:
I see in ScintillaWX::Paste() you added some code at the start of function but without below code the computed firstPosition is not usable
Index: C:/Projects/scintilla-test-brach/src/sdk/wxscintilla/src/ScintillaWX.cpp
===================================================================
--- C:/Projects/scintilla-test-brach/src/sdk/wxscintilla/src/ScintillaWX.cpp (revision 5834)
+++ C:/Projects/scintilla-test-brach/src/sdk/wxscintilla/src/ScintillaWX.cpp (working copy)
@@ -587,10 +587,9 @@
int newPos = 0;
int caretMain = CurrentPosition();
if (rectangular) {
- SelectionPosition selStart = sel.Range(sel.Main()).Start();
int newLine = pdoc->LineFromPosition (caretMain) + wxCountLines (buf, pdoc->eolMode);
int newCol = pdoc->GetColumn(caretMain);
- PasteRectangular (selStart, buf, len);
+ PasteRectangular (firstPosition, buf, len);
newPos = pdoc->FindColumn (newLine, newCol);
} else {
pdoc->InsertString (caretMain, buf, len);
About the SCNotification initializations (memset ... ) well it could be just not initialized at all, SCNotification scn; without {0} nor memset(...
All relevant values for an specific notification are set and no other values are used by the notification receiver, it should be asumed for any non relevant values just to be unintialized.
[attachment deleted by admin]
I'm not positive that this is related, but it seems possible.
Ubuntu 8.10 x86_64
gcc 4.3.2
I updated to SVN 5862 (from 574X). The editor was completely unusable. It was as if "Select All" was constantly pressed. The text of the entire file in the editor was highlighted. If I clicked with the mouse, the highlighted text briefly flashed to un-highlighted, then immediately back to highlighted. If I typed anything, of course it replaced the highlighted text. So, at most I could have one character on the screen while typing.
I checked out several intermediate SVN versions to try and find where this was introduced. I did a very simple test -- if the first file opened was highlighted, it had the bug. If the file was not highlighted, I gave it a pass. Eventually I found:
5843 - ok
5844 - "select all" bug
The dates for these are 2009-10-05, which matches up with reports on this thread. I thought I could just use 5843 for now and report the bug. But then I noticed that if I selected any text whatsoever, the selected text was immediately and forever pasted into the editor. For example, if I selected a line with the mouse -- that line was pasted repeatedly into the text file until I closed codeblocks. If I selected text using shift+arrow, I could only get one letter selected (or one line) before that single letter (or line) was pasted over and over -- until I closed codeblocks. Even if I selected text in a different app -- then that text was pasted over and over into the the codeblocks editor until I closed codeblocks.
I tried rolling back several more revisions to find the source of that error, but after too many crashes I was getting inconsistent results. So, rebooted and checked out a pristine SVN tree (now 5864).
svn status --no-ignore | grep '^\?' | sed 's/^\? //' | xargs rm -rf
make clean
make distclean
./bootstrap
./configure --with-contrib-plugins=all
make -j 8
make install
Now, when I launch CB I get the message that
"One or more plugins were not loaded.
This usually happens when a plugin is built for
a different version of the Code::Blocks SDK.
Check the application log for more info.
List of failed plugins:
libwxSmithAui.so
libwxsmith.so
libwxsmithcontribitems.so"
(by the way, where is the application log saved?) Not sure if my issue is related to the changes mentioned in this thread, or if I just forgot to update a library or something. Anyway, without those plugins at least I can use the editor again.