Code::Blocks

User forums => Using Code::Blocks => Topic started by: colski on September 30, 2008, 02:23:15 pm

Title: Incremental Search
Post by: colski on September 30, 2008, 02:23:15 pm
Unless I've missed something, CB is still lacking incremental search.

Please consider this, I use it all the time and it's hard to be without.

colski
Title: Re: Incremental Search
Post by: MortenMacFly on September 30, 2008, 03:06:41 pm
Unless I've missed something, CB is still lacking incremental search.
It never did. Just hit "F3" to continue searching the term from the last position.
Title: Re: Incremental Search
Post by: colski on September 30, 2008, 03:14:18 pm
That's not incremental search, you're describing repeat search.

Incremental search means that the search is performed as you type the keys.

In VC++, for example, Ctrl+I begins incremental search. Then key 's' would search forward to the first instance of 's', then 'e' would search forward to the first instance of 'se' and so on. F3 would then find the next instance.

Seeing the results as you type is the major benefit. You can stop typing as soon as you've found what you want, or discover that there are no matches much faster.

When performing incremental search, the backspace key should remove the last character from the search string, not delete the selection.

colski
Title: Re: Incremental Search
Post by: MortenMacFly on September 30, 2008, 03:19:53 pm
That's not incremental search, you're describing repeat search.
Although I don't see any major benefit in this search method you might want to try the ThreadSearch plugin. It does not do the incremental stuff but has similar features. Probably you can enhance it in a way that it would work as you like.
Title: Re: Incremental Search
Post by: colski on September 30, 2008, 04:03:16 pm
The benefit is obvious to me, since I use it all the time.

Let me see if I can make a convincing argument to you. Incremental search is the search method in firefox and chrome, vc++, emacs and eclipse; whereas the dialog box is the search method in Code::Blocks and internet explorer.

I guess that threadsearch has done most of the work (ie, a non-modal input). It's not in my build, so I'll have to investigate that. Perhaps someone who knows the code base will read this and think it's worth doing.

colski
Title: Re: Incremental Search
Post by: mariocup on September 30, 2008, 04:17:14 pm
Hi,

I agree that the ThreadSearch is a great plug-in for searching strings, but an incremental search would be nice. For example if you use Firefox and use the search shortcut the focus is put in a search command line where you type your search string. The advantage is that the editor/browser view remains visible and you do not have a search window that pops up. I think that together with the highlight occurrence feature the incremental search would be cool in Code::Blocks. The incremental search could also have a scope like: search in current file or search in all opened files.

Bye,

Mario

Title: Re: Incremental Search
Post by: dje on September 30, 2008, 05:01:26 pm
It is true that going from Firefox incremental search to IE modal popup is quite disgusting.
I find this feature nice even if not absolutely required.

I'm not sure it would be a good idea to implement it in ThreadSearch plugin, because (I have to check but) I think, files are searched in file path or file name ascending order, not by active or open.

Don't also forget than when a search is running, the text box is disabled... and you need to stop it before edition.

Dje
Title: Re: Incremental Search
Post by: Barking_Mad on October 02, 2008, 04:20:23 pm
That's not incremental search, you're describing repeat search.
Although I don't see any major benefit in this search method you might want to try the ThreadSearch plugin. It does not do the incremental stuff but has similar features. Probably you can enhance it in a way that it would work as you like.

If its not incremental, its excremental :P

This would be something that falls under the remit of code completion, id expect it a requirement for good code completion to also include incremental search, so hopefully it will be included when the CC is done.
Title: Re: Incremental Search
Post by: jens on October 02, 2008, 04:57:01 pm
This would be something that falls under the remit of code completion, id expect it a requirement for good code completion to also include incremental search, so hopefully it will be included when the CC is done.

I don't think that it's really needed for that.

Incremental search for one file is easy to implement.
In fact I just created this as plugin (with a really ugly modal dialog at the moment).
It might be a better idea to use a toolbar instead, but that's another thing (and I might work on it the next days).

I'm not sure if incremental search in more then one file is really needed.
I think that's something ThreadSearch-plugin can do better (even if it not searches incremental).
Title: Re: Incremental Search
Post by: mariocup on October 02, 2008, 09:14:03 pm
Hi jens,

I agree that incremental search for one file is better then in all opened files. I think a search bar with the options like Firefox 3 would be sufficient.

Bye,

Mario
Title: Re: Incremental Search
Post by: Barking_Mad on October 03, 2008, 03:13:40 pm

I don't think that it's really needed for that.

Incremental search for one file is easy to implement.
In fact I just created this as plugin (with a really ugly modal dialog at the moment).
It might be a better idea to use a toolbar instead, but that's another thing (and I might work on it the next days).

I'm not sure if incremental search in more then one file is really needed.
I think that's something ThreadSearch-plugin can do better (even if it not searches incremental).


I have been researching code completion recently, incremental search methods are certainly one of the best methods for parsing user input for code completion as far as i can see.

Just type into the google chrome Ctrl-F search or google search bar to see why, they know a thing or two about search, its one of the best methods for reducing solution sets in realtime for Function lists and the autocomplete method afaik.

If you want ill post my notes, which are incomplete at the moment so id rather not.

For one reason why i believe its superior, see this comment: http://forums.codeblocks.org/index.php/topic,8346.msg61758.html#msg61758

Resolving to individual symbols on input is afaik best done incrementally.
Title: Re: Incremental Search
Post by: thomas on October 03, 2008, 03:35:53 pm
Incremental search for one file is easy to implement.
In fact I just created this as plugin (with a really ugly modal dialog at the moment).
It might be a better idea to use a toolbar instead, but that's another thing (and I might work on it the next days).
The already implemented "show occurences" feature does just that. It's hard/impossible to implement it properly for all project files though, due to the sheer (im)possible number of files and hits. Imagine a project with 15,000 files.
Title: Re: Incremental Search
Post by: jens on October 07, 2008, 11:57:57 am
I created a plugin that does incremental search from a toolbar.

You can download the sorces from http://apt.jenslody.de/patches/IncrementalSearch_0.2.tar.bz2 (http://apt.jenslody.de/patches/IncrementalSearch_0.2.tar.bz2).

The archive contains the folder "IncrementalSearch", that has to be copied to "src/plugins/contrib", and a patch file for the contrib-plugins workspace and the autoconf-files.
The patch is against svn r5243.

It works, without conflicting with Highlight occurences.
The only thing I really don't like is that the highlighting (as with Highlight occurences) is not really colourful.

If anybody can test it and give a feedback, I would be glad.

Title: Re: Incremental Search
Post by: mandrav on October 07, 2008, 02:42:07 pm
I created a plugin that does incremental search from a toolbar.

...

If anybody can test it and give a feedback, I would be glad.

Looks good, though highlighting didn't work for me at all.
Title: Re: Incremental Search
Post by: mariocup on October 07, 2008, 04:01:19 pm
Hi jens,

I tried it on windows and that is exactly how incremental search should look like :D. Nice job.

The hint for "Select only" should be changed to "Selected text" to be consistent with the search dialogue. The highlight colour is very decent, so it is not easy to see the highlighting on a laptop screen, perhaps it should be customizable.

Thx to jens.

Mario
Title: Re: Incremental Search
Post by: jens on October 07, 2008, 06:39:19 pm
Looks good, though highlighting didn't work for me at all.
Might be the same problem taht Mario has (and me with XP on my Laptop as I just found out).

The hint for "Select only" should be changed to "Selected text" to be consistent with the search dialogue. The highlight colour is very decent, so it is not easy to see the highlighting on a laptop screen, perhaps it should be customizable.

It's no problem to make it customizable, the only problem is the method for highlighting (scintillas indicators).
It's never really colourful.
That also happens to Highlight occurences.
If anybody knows a better method to highlight text in (wx)Scintilla, please post it.

I have to sleep in a hotel this night (because of work), so I have (hopefully) time enough to do the changes.

I can commit it as contrib-plugin later, if no errors or problems with other parts of C::B come up.
Title: Re: Incremental Search
Post by: MortenMacFly on October 08, 2008, 02:55:07 pm
... I splitted the topic about wxScintilla in an own thread, available via:
http://forums.codeblocks.org/index.php/topic,9335.0.html
Title: Re: Incremental Search
Post by: jens on October 10, 2008, 06:36:19 pm
I commited Incremental search this afternoon.
I also patched (wx)scintilla, to add a new more colourful indicator.
Highlight occurences also uses it now.

In "Settings -> Editor" there is a configuration panel for IncSearch, where you can change the used colours and chose, whether the found text should be centered on screen (if possible) or not.
Title: Re: Incremental Search
Post by: rhf on October 10, 2008, 06:50:09 pm
rhf : the thread is splitted, please post here: http://forums.codeblocks.org/index.php/topic,9289.0.html (http://forums.codeblocks.org/index.php/topic,9289.0.html).
OK. Repeat of previous post: I just updated with SVN 5253 and experimented with Incremental Search. It appears to work properly; however, the toolbar buttons for Prev, Next, etc do not appear. There is just a single large button with no icons.  This is on Windows XP.
Thanks for adding a nice feature.
Title: Re: Incremental Search
Post by: jens on October 10, 2008, 08:39:28 pm
rhf : the thread is splitted, please post here: http://forums.codeblocks.org/index.php/topic,9289.0.html (http://forums.codeblocks.org/index.php/topic,9289.0.html).
OK. Repeat of previous post: I just updated with SVN 5253 and experimented with Incremental Search. It appears to work properly; however, the toolbar buttons for Prev, Next, etc do not appear. There is just a single large button with no icons.  This is on Windows XP.
Thanks for adding a nice feature.
I tested it on Linux, w2k and winxp sp2, and it works on all platforms.

How did you compile it.
Did you use clean svn-version or did you patch the code manually before.

Maybe a screenshot would be helpful.
Title: Re: Incremental Search
Post by: killerbot on October 10, 2008, 09:32:41 pm
well it seems it doesn't even build :-(

Quote
IncrementalSearch.cpp: In member function 'virtual void IncrementalSearch::BuildMenu(wxMenuBar*)':
IncrementalSearch.cpp:115: error: 'class wxMenuItem' has no member named 'GetLabelText'
IncrementalSearch.cpp:115: error: 'class wxMenuItem' has no member named 'GetItemLabelText'
make[4]: *** [IncrementalSearch.lo] Error 1
make[4]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib/IncrementalSearch'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src'
make: *** [all-recursive] Error 1
Though I haven't find the cause yet, I committed already a first part of a fix wrt includes. Don't include pch's in header files. There's more to follow ...

EDIT : on one linux box I got it already working (did make clean and brand new ./configure), trying that recipe on the failing linux box ...

EDIT2 : this issue remains, the only difference between my 2 linux boxes is :32 bit versus 64 bit. On the 64 bit it does NOT build.

Anyone else who is able to  build it on linux 64 bit ??
Title: Re: Incremental Search
Post by: rhf on October 10, 2008, 11:05:01 pm
How did you compile it.
Did you use clean svn-version or did you patch the code manually before.
I just updated to SVN 5258 and built CodeBlocks.cbp and ContribPlugins.workspace and ran update.bat.
The icons still do not show in the IncrementalSearch toolbar.
I am using tdm-mingw-1.808.3 which uses gcc 4.3.2. (There could of course be a bug with this compiler.)

Maybe a screenshot would be helpful.
Well I tried but couldn't figure out how to insert a screenshot. I have attached (I hope) the file ScnShot.jpg which shows the effect.
Even though the toolbar buttons do not show, when I move the mouse over the toolbar the various hints do appear.



[attachment deleted by admin]
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 12:53:15 pm
@killerbot:

I build on 64-bit linux without problems, in any versions (mine, the one changed by you and the versions I just committed).

Before I commited the plugin I tested it on linux (64-bit and 32-bit), w2k and winxp with clean svn-versions from inside a clean svn-tree.
What I did not test is compiling without precompiled-headers.
That, and maybe the use of "wxprec.h" in a header, are in my opinion the only real mistakes I made.

Inspite of not changing the debian-files and the .spec-file. (I use a patched debian version for my nightlies, so I just forgot it, and I don't know anything about rpm-building, because I did not use rpm-based linuxes since more then five years now).

Leaving the virtual declaration in the header-files is not an error, even if it is unneded. But if you don't like it, why didn't you remove it from both header-files ?

I did it and removed some comments from the headers, I also removed includes that are not needed, neither for compiled with, nor without precompiled headers (tested on linux and winxp).

I wonder why you cannot compile on 64-bit.
I compiled it with wxWidgets 2.8.7  and 2.8.9 on win, and 2.8.9 on linux.

EDIT:
I use gcc 4.2 on linux and win.
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 01:00:21 pm
How did you compile it.
Did you use clean svn-version or did you patch the code manually before.
I just updated to SVN 5258 and built CodeBlocks.cbp and ContribPlugins.workspace and ran update.bat.
The icons still do not show in the IncrementalSearch toolbar.
I am using tdm-mingw-1.808.3 which uses gcc 4.3.2. (There could of course be a bug with this compiler.)

Maybe a screenshot would be helpful.
Well I tried but couldn't figure out how to insert a screenshot. I have attached (I hope) the file ScnShot.jpg which shows the effect.
Even though the toolbar buttons do not show, when I move the mouse over the toolbar the various hints do appear.



Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.

Do you have an image in the "Search -> Incremental Search" MenuItem ? It is in the same zip-file.
Have you tried to remove the zip from "src/devel/share/CodeBlocks"  and "src/output/share/CodeBlocks" before building ?
Title: Re: Incremental Search
Post by: killerbot on October 11, 2008, 02:51:24 pm
Quote
Leaving the virtual declaration in the header-files is not an error, even if it is unneded. But if you don't like it, why didn't you remove it from both header-files ?
No that's not an error. But I think it is preferred to have people no longer derive from this class, since it is a concrete class. The fact I didn't remove them all, sloppy me  :oops:

As a last resort I will try with a clean svn checkout, because I still does not build :-(
Title: Re: Incremental Search
Post by: killerbot on October 11, 2008, 04:25:37 pm
no luck :fresh checkout from svn repo

Quote
g++ -DHAVE_CONFIG_H -I. -I. -I../../../../src/include -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../../../src/include -I../../../../src/include/wxscintilla/include -Ulinux -Uunix -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT IncrementalSearch.lo -MD -MP -MF .deps/IncrementalSearch.Tpo -c IncrementalSearch.cpp  -fPIC -DPIC -o .libs/IncrementalSearch.o
IncrementalSearch.cpp: In member function 'virtual void IncrementalSearch::BuildMenu(wxMenuBar*)':
IncrementalSearch.cpp:127: error: 'class wxMenuItem' has no member named 'GetLabelText'
IncrementalSearch.cpp:127: error: 'class wxMenuItem' has no member named 'GetItemLabelText'
make[4]: *** [IncrementalSearch.lo] Error 1
make[4]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib/IncrementalSearch'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins/contrib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/killerbot/Documents/CodeBlocksDev/trunk/src'
make: *** [all-recursive] Error 1

g++ (GCC) 4.1.2
wx : 2.8.4
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 04:35:16 pm
wx : 2.8.4

That's the problem "GetLabelText" and "GetItemLabelText" are in wxWidgets since 2.8.5.

I can add a version-guard and use the older functions if wxGtk is too old.

EDIT:
That means you have a more recent version on 32-bit linux, right?

EDIT2:
It would be nice if you could test the following code instead the original one:
Code: [Select]
#if wxCHECK_VERSION(2,8,5)
if (items[i]->GetLabelText(items[i]->GetItemLabelText()) == _("Find previous"))
#else
if (items[i]->GetLabelFromText(items[i]->GetLabel()) == _("Find previous"))
#endif

I can't test it, because I do not have wxWidgets 2.8.4 anymore.
I it works I will commit it.
Title: Re: Incremental Search
Post by: rhf on October 11, 2008, 05:08:31 pm
Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.
No, the images are not there.

Do you have an image in the "Search -> Incremental Search" MenuItem ? It is in the same zip-file.
No. The icon does not show up in the Menu either.

Have you tried to remove the zip from "src/devel/share/CodeBlocks"  and "src/output/share/CodeBlocks" before building ?
Well I use the standard update.bat file obtained via SVN. The images appear to be unzipped in the two dirs
C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch\images  and
C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch\images\16x16,
but apparently they are not getting copied to the appropriate devel\share\CodeBlocks\... and output\share\CodeBlocks\... sub-directories.
The update.bat file in C:\CodeBlocks_SVN\src\plugins\contrib\IncrementalSearch does copy two .png files to the \share\CodeBlocks\settings directories. I don't know if the other image .png files are copied somewhere else.
Title: Re: Incremental Search
Post by: Biplab on October 11, 2008, 05:31:06 pm
Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.
No, the images are not there.

Compile IncrementalSearch with the attached project file. I suspect recursive addition of image file is not working here (this was affecting Linux builds, too).  :)

[attachment deleted by admin]
Title: Re: Incremental Search
Post by: killerbot on October 11, 2008, 05:44:42 pm
wx : 2.8.4

That's the problem "GetLabelText" and "GetItemLabelText" are in wxWidgets since 2.8.5.

I can add a version-guard and use the older functions if wxGtk is too old.

EDIT:
That means you have a more recent version on 32-bit linux, right?

EDIT2:
It would be nice if you could test the following code instead the original one:
Code: [Select]
#if wxCHECK_VERSION(2,8,5)
if (items[i]->GetLabelText(items[i]->GetItemLabelText()) == _("Find previous"))
#else
if (items[i]->GetLabelFromText(items[i]->GetLabel()) == _("Find previous"))
#endif

I can't test it, because I do not have wxWidgets 2.8.4 anymore.
I it works I will commit it.

I can test it either, since I have upgraded my wx to 2.8.9 on my 64-bit linux box. And now it builds correctly :-)
Title: Re: Incremental Search
Post by: rhf on October 11, 2008, 05:51:48 pm
Compile IncrementalSearch with the attached project file. I suspect recursive addition of image file is not working here (this was affecting Linux builds, too).  :)
That did it!  Thanks.
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 05:52:20 pm
Are the images inside "IncrementalSearch.zip" (it should be in "share/CodeBlocks").
The images are in the subfolder "images" and "images/16x16" inside the zip-file.
No, the images are not there.

Compile IncrementalSearch with the attached project file. I suspect recursive addition of image file is not working here (this was affecting Linux builds, too).  :)
In Linux the problem was, that I only included "images/*.png" (I don't want the conf-dialog images inside the zip-file, because they don't belong there) with "-R"-switch for recursion. That can only find images with path "images/*.png", but not "images/16x16/*.png".
I use "22x22", so I did not stumble over it.

On windows I use only "*.png" and of course the "-R"-switch.
That works for me on w2k and XP without problems and includes the whole "images" folder with all subfolders containing png-images.

But it might be a problem with different behaviour of different zip-versions.
I use "Zip 2.32" from June 19th 2006.
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 05:58:18 pm
@Biplab:
thanks for the fixes to the autoconf-files.

I hopefully will learn how it works some days, but until now I did not find a good readable and easy to understand documentation.
So it's still more or less trial and error.
Title: Re: Incremental Search
Post by: jens on October 11, 2008, 06:03:54 pm
I can test it either, since I have upgraded my wx to 2.8.9 on my 64-bit linux box. And now it builds correctly :-)

I tested it without version-guard and the deprecated (older) functions and it also works.
So I think it's secure to commit the version with the "wxCHECK_VERSION".
I will also update the windows cbp-file, because that will not break anything, but the cbp-file that's in svn now, seems not to work reliably.

Sorry for the inconvenience.
Title: Re: Incremental Search
Post by: Biplab on October 11, 2008, 06:12:52 pm
@Biplab:
thanks for the fixes to the autoconf-files.

I hopefully will learn how it works some days, but until now I did not find a good readable and easy to understand documentation.
So it's still more or less trial and error.

Honestly speaking I'm also not good at it. You can try the tutorial at the following link. :)

Quote
http://www-src.lip6.fr/homepages/Alexandre.Duret-Lutz/autotools.html
Title: Re: Incremental Search
Post by: rhf on October 11, 2008, 06:49:23 pm
But it might be a problem with different behaviour of different zip-versions.  I use "Zip 2.32" from June 19th 2006.
Ouch! My zip version was Zip 2.3 dated November 29th 1999!  Think I'll upgrade now - sorry to cause you problems.
Title: Re: Incremental Search
Post by: fabrizio.benedetti on October 16, 2008, 11:50:26 am
I commited Incremental search this afternoon.

I built the last version from SVN with the incremental search plugin yesterday. Thanks! That was really missing!

I'd like to suggest some refinements in its behaviour:

 - there should be a way to exit from incremental search mode using the keyboard, and go back to typing; pressing Esc or the assigned shortcut (Ctrl+I) seems the most intuitive way (now seems that the only way is to press the [x> icon on the toolbar near the search text);

 - search options for incremental search could have their shortcut, active during incremental search (VS does i.e. ctrl-c for case sense);

 - the searched text should be selected when exiting from incremental search (as in the case of normal search);

  Now, given I'm a VS6 guy, there's another search feature I'm missing. It's not related to incremental search but I'm reporting it here... it's the Ctrl-F3 shortcut, which starts searching for the word under the cursor - if no text is selected, otherwise it searches for the selected text. That's very quick, no search dialog is shown, you just jump to the next result. Whooa! (and yes, Shift-Ctrl-F3 does it backward). Anyone else liking it out there?

  Ciao
    Fabrizio
Title: Re: Incremental Search
Post by: jens on October 16, 2008, 12:57:36 pm
I commited Incremental search this afternoon.

I built the last version from SVN with the incremental search plugin yesterday. Thanks! That was really missing!
Thanks.  :)
- there should be a way to exit from incremental search mode using the keyboard, and go back to typing; pressing Esc or the assigned shortcut (Ctrl+I) seems the most intuitive way (now seems that the only way is to press the [x> icon on the toolbar near the search text);

 - search options for incremental search could have their shortcut, active during incremental search (VS does i.e. ctrl-c for case sense);
That make sonly sense, if both is implemented.
I will think about it.
- the searched text should be selected when exiting from incremental search (as in the case of normal search);
If the first will be implemented, this would be easy (but should be configurable)

  Now, given I'm a VS6 guy, there's another search feature I'm missing. It's not related to incremental search but I'm reporting it here... it's the Ctrl-F3 shortcut, which starts searching for the word under the cursor - if no text is selected, otherwise it searches for the selected text. That's very quick, no search dialog is shown, you just jump to the next result. Whooa! (and yes, Shift-Ctrl-F3 does it backward). Anyone else liking it out there?

Maybe this can also be implemented inside the plugin.
Title: Re: Incremental Search
Post by: Biplab on October 16, 2008, 05:09:30 pm
- there should be a way to exit from incremental search mode using the keyboard, and go back to typing; pressing Esc or the assigned shortcut (Ctrl+I) seems the most intuitive way (now seems that the only way is to press the [x> icon on the toolbar near the search text);

I've already implemented this feature. I prefer Escape Key. I'll commit it later. :)
Title: Re: Incremental Search
Post by: jens on October 18, 2008, 10:35:49 am
- there should be a way to exit from incremental search mode using the keyboard, and go back to typing; pressing Esc or the assigned shortcut (Ctrl+I) seems the most intuitive way (now seems that the only way is to press the [x> icon on the toolbar near the search text);

I've already implemented this feature. I prefer Escape Key. I'll commit it later. :)

I also implemented it.

I did not find a way to catch all key-events from all windows, I'm not sure if it is possible, or even if it would be very good (because of the overhead it and the possible slowdown of the whole app).

I catch the key events of the text-control inside the toolbar, and (re)set the on it, when using any of the  toolbar-buttons (and of course with Ctrl-I like now).

If you then press ESC everything looks like as if you empty the textcontrol.
You can select the last found phrase if you have checked the appropriate ooption on the configuration dialog.

ALT-DELETE will erase the content of the text-control.

I did not apply any other shortcuts, because they interfere with the normal keyboard-shortcuts, or the other accelerators.


If you know another (better) way to catch the key-events, please post a patch, or send it me with a pm or mail, or commit it, if it not slows down the whole C::B.
I wait until I commit my changes.


I also fixed the problem if the found text is in a column outside the actual editor-window, because the line is too ling.
Title: Re: Incremental Search
Post by: jens on October 19, 2008, 09:24:44 pm
I just commited the changes to trunk (r5277).
I also included a bugfix, see here: http://forums.codeblocks.org/index.php/topic,9402.msg66771.html#msg66771 (http://forums.codeblocks.org/index.php/topic,9402.msg66771.html#msg66771)
Title: Re: Incremental Search
Post by: mmkider on October 25, 2008, 07:26:48 am
it is good plugin for codeblocks.
Incremental Search is reasonable to Show this ability. :D

Title: Re: Incremental Search
Post by: mmkider on October 27, 2008, 01:35:01 pm
I have a idea, but I don't know that is it good .

before                after
wxTextctrl => wxComboBox


So I can reuse  some keyword by myself.
Title: Re: Incremental Search
Post by: dje on October 27, 2008, 01:38:17 pm
Hi !

I developped an history combo box that stores searched expressions and sorts them by recent search order.
The class is available in ThreadSearch classes; it may be useful.

Dje
Title: Re: Incremental Search
Post by: mmkider on October 27, 2008, 02:11:55 pm
Thank you for your response.
I now Interest in IncrementalSearch.
it's easy to use(ThreadSearch  is too professional, if i have some time i will research it  :P)


Arrow icon in the IncrementalSearch is left and right direction.
Why not to change up and down direction ?
Seem to be to match behavior more.
Title: Re: Incremental Search
Post by: dje on October 27, 2008, 02:18:48 pm
I just wanted to say that replacing a wxTextCtrl by a wxComboBox is very easy.
I customised wxComboBox to my needs to make an history of the searched patterns for ThreadSearch plugin; I think the class name is something like HistoryComboBox or something like that.
It can be directly used in incremental search plugin without redeveloping the history behaviour
So I can reuse  some keyword by myself.
. That's all !

But ThreadSearch  is too professional
Just right click on a word and click on "Find occurrences"; not too complicated isn't it ?  :wink:

Dje
Title: Re: Incremental Search
Post by: mmkider on October 27, 2008, 05:20:45 pm
I modify image
I will study HistoryComboBox  and try to modify Incremental Search(thx for dje ).

http://mmkider.googlepages.com/IncrementalSearch.zip (http://mmkider.googlepages.com/IncrementalSearch.zip)
(http://mmkider.googlepages.com/arrow.JPG)

Title: Re: Incremental Search
Post by: dje on October 27, 2008, 08:38:33 pm
In fact, I had to integrate this class in ThreadSearch but I didn't have time.

The files are joined in this post.
A very simple and useful class. It is derived from wxComboBox and stores all entered text in the combo history.
List is updated and sorted at each activation.
Event is skipped for other processing.

BR,

Dje

[attachment deleted by admin]
Title: Re: Incremental Search
Post by: mmkider on October 30, 2008, 01:58:54 pm
 :D
I understand what is ThreadSearch(ThreadSearch is good for search  :D)
I think it's good for ThreadSearch  optional that default is " search in workspace file".

I am more familiar with the vs2005.
In recent days, I made a stupid thing to post codeblocks code to vs2005 prj.
last, I get a crash ,as follow:

wxASSERT_MSG( stringSrc.GetStringData()->IsValid(),
                  _T("did you forget to call UngetWriteBuf()?") );

because I use codeblocks ,I can't use dll call from codeblocks.exe.

Maybe,my methods are wrong.