Embarcadero RAD Studio 2010

Posted by on in Blogs
We have been given the green light to talk about some things that we've been working on for Embarcadero RAD Studio 2010 (and Delphi 2010 and C++Builder 2010). I figured that was a good excuse to get started here since I do have a couple new code editor features that I'd like to show off.

Search Highlighting

The search function of the code editor is one of those workhorse features that gets used all the time. While it does its job well, sometimes it seems that it could be a bit smarter. For example, if my cursor is past the instance that I'm really looking for, I often end up invoking to search a couple times to find it. This is because the search only shows one match at a time and it only searches in one direction at a time.

One of the first features I worked on for RAD Studio 2010 was to make the code editor find all the matches all at once. So performing a code search now looks something like this:

Here the "primary" search match is highlighted, just as it always has been (in black here). But now all the other matches are shown as well (highlighted in orange). You can scroll up and down with the scrollbar or scroll wheel and if any other matches become visible, they'll show up right away.

Each color scheme has an appropriate default color for the additional search matches and the color can be customized as well.

Search Bar

In RAD Studio 2010, we've replaced the modal search dialog with a search bar at the bottom of the code editor:

When search is invoked, this bar pops up. It is modeless, so it's easy to switch back to the editor, for example to copy a search term from the editor. Forward and backward searching is as easy as clicking on the down or up arrows (there are keyboard shortcuts for each, too). The third arrow button restarts the search from the beginning of the file. As before, the search box maintains a history of searches. All the search options can be set by using the checkboxes on the search bar.

Since the search highlighting feature knows where all the matches are, the search bar also shows a count of how many matches exist within the entire file.

Between these two changes, I hope you find the code editor search to be even more useful than ever.


  • Guest
    Anon Tuesday, 4 August 2009

    Just quick question... How well does this feature work with very large files, say 20,000 - 30,000 (or maybe even more) and there are many thousands of matching search words - will everything slow down to a crawl or will the IDE still be responsive while it's finding & highlighting all the matches???

    Otherwise I like the features very much :)

  • Guest
    Xepol Tuesday, 4 August 2009

    Any chance the regular expression syntax has been updated to something more modern (ie: http://www.regular-expressions.info/)?

    Honestly, if it hasn't been updated and there are no plans to do so soon, consider dropping it entirely. As the feature currently stands, the RegEx pattern matching syntax hasn't been updated in any meaninful way since the days of Turbo Pascal (and I just fired up BPW 7.0 to confirm that)

  • Guest
    xiaoyi zhang Tuesday, 4 August 2009

    Would you have the syntax-relayed-highlighting function beyond the Search Highlighting?

    Such that when i want to know the use of a local variable which may have a common name, can you highlight it in it's local scope with the other same-named-variable unchanged.

  • Guest
    Jon Tuesday, 4 August 2009

    xiaoyi zhang: that is indeed a very good feature. notepad++ has that.

    you can accomplish the same highlighting in delphi via "Sync Edit" (without actually using the "Edit" functionality). Select a block of code (or the entire proc/func) then hit Ctrl+Shift+J. Now you can click the identifier you are inspecting. All instances of the identifier will be highlighted. Duplicated items are initially underlined.

  • Guest
    Darren Kosinski (Embarcadero) Wednesday, 5 August 2009

    @Anon: Even in large files, the IDE remains reasonably responsive. It takes the highlighter longer to find all the matches, naturally, and it is most noticeable when using incremental search. Even then, the IDE doesn't hang or freeze though.

    @Xepol: The regex engine has not been updated in RAD Studio 2010. I encourage you to make a feature request in Quality Central for this.

    @xiaoyi zhang: The new highlighting is strictly based on a text match, so it will not make a distinction between a symbol of the same name from a different scope. The Find References feature will give you a list of the matches, but it will not highlight them in the code editor. Combining these two would make for an interesting feature. If it is not already in Quality Central then please report it there as a feature request.

  • Guest
    Xepol Thursday, 6 August 2009

    @Darren -> It has been in QC for 2 years now as QC # 10359

    Sadly, every time it comes up in any forum, people point to GExperts and dismiss the entire topic. This is hardly a good general solution, and since the search has become non-modal, it is now even less "the same thing" more than ever (ouch, english just died a little there!)

  • Guest
    Darren Kosinski Friday, 7 August 2009

    @Xepol: At the beginning of each development cycle, we always query QC to look for feature requests. The more votes a feature request has, the more likely it is get the product manager's attention.

    I'll forward your comment to him and you might want to note that he has a blog, too: http://blogs.embarcadero.com/michaelrozlog/

  • Guest
    Delphi 2010 Preview! | 4DotNet Developers Blog Monday, 17 August 2009

    [...] Search: highlighting & searchbar [...]

  • Guest
    Личная записная Tuesday, 25 August 2009

    [...] Подсветка поисковой строки в коде и новый Searchbar. Об этом пишет Darren Kosinski; [...]

  • Guest
    Tamsir Wednesday, 2 September 2009

    I noticed that the modeless search bar does not include the option to search for a given text within the current project, or across multiple directories. Is that functionality still available? If so, where is it hidden? Thank you.

  • Guest
    Darren Kosinski (Embarcadero) Wednesday, 2 September 2009

    @Tamsir: The option to search within the project or across directories is in the Find in Files feature. That feature still exists and received some enhancements in RAD Studio 2010 as well. As in previous versions, Find in Files will pop up a familiar dialog to collect the search options.

  • Guest
    Jürgen Krämer Sunday, 20 September 2009

    Is there any way to disable the search bar? I really dislike the way it behaves, because I had always set up the find dialog to search whole words from the start and had used incremental search for searching partial word or from the current cursor position. Now I have to press , , and instead of and .

    Also it seems the search bar sometimes loses track of the "Whole words" flag and I have to set it again.

  • Guest
    Jürgen Krämer Sunday, 20 September 2009

    // Seems the text between lower-than and greater-than signs got lost:

    Is there any way to disable the search bar? I really dislike the way it behaves, because I had always set up the find dialog to search whole words from the start and had used incremental search for searching partial word or from the current cursor position. Now I have to press Ctrl-F, Enter, Ctrl-Home and F3 instead of Ctrl-F and Enter.

    Also it seems the search bar sometimes loses track of the "Whole words" flag and I have to set it again.

  • Guest
    Darren Kosinski (Embarcadero) Sunday, 20 September 2009

    @Jürgen Krämer: There is not a way to disable the search bar. Note that the third button the search bar is to search from the beginning of the file.

    If you can find any steps that make the search bar lose track of the "Whole words" flag, please report it in QC so we can fix it. Thanks.

  • Guest
    Jürgen Krämer Monday, 21 September 2009

    @Darren: Is there a hot key/accelerator for the third button? I didn't see one and having to use the mouse is slowing me down even more than pressing two additional key combinations.

    Regarding the "Whole words" flag: it is cleared after using incremental search. I will create a QC report.

  • Guest
    Darren Kosinski (Embarcadero) Monday, 21 September 2009

    @Jürgen Krämer: There not a hot key for initiating the search with the restart from beginning. Please put this in QC as well and I'll see if I can find an appropriate key combination for it.

  • Guest
    Ray Konopka Monday, 16 November 2009

    Darren, I agree with Jurgen, but PLEASE DO NOT CREATE NEW KEYSTROKE TO HANDLE THIS! This is not correct solution.

    In previous versions of Delphi I always set the old "Entire Scope" flag in the Find Options dialog to true. Pressing Ctrl+F and then Enter would find the first occurrance of the text under the cursor in the source file. As Jurgen notes, this is not possible in the new Find Panel.

    Yes, there is "the 3rd button" that allows you to restart the search from the beginning, but this is not the same as the old "Entire Scope" option (which is still present in the Replace dialog). In fact, the FromCursor/Global registry entries are still in the Registry, but even if you change FromCursor to False, the IDE no longer picks it up and then resets it to True the next time you do a search.

    There does NOT need to be a new hot key combination added to handle this situation. The easiest solution is to simply bring back the option that has been in every single version of Delphi since Delphi 1. If the Find Panel would honor the Entire Scope setting, then a user could still press Ctrl+F to invoke the panel, the current text under the cursor would be inserted in the edit field, and then pressing Enter would take you to the first occurrance in the file. Done.

    I am extremely frustrated with this change in behavior in the Find panel in Delphi 2010. I run into this all the time. This particular issue really needs to be taken care of in the next update of Delphi 2010.

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: