Search Results Window

The Search Results window is created whenever you use a search feature that searches across multiple files, such as the Search Project, Search Files, or Lookup References commands. Each line in the Search Results window corresponds to a match in some file at some line number. Matches listed in the Search Results win­dow contain source links, which are hypertext-like links to the locations where the matches were found.

The Search Results is a text file buffer that you can also edit.

Navigation Using Source Links

Source Links connect two locations in two different text files. They connect a line of text in a "link source" file to a location in a "link target" file. Links are associated with individual lines.

To traverse a link, use the Jump To Link command (Ctrl+L), which takes you to the other end of the source link at the current line. A link can be traversed as long as the link source file is open. If the link target file is not open, the Jump To Link command will open the file automatically.



Figure 3.14  The Search Results window has a source link on each listed match. Each source link corresponds to a location in a file at some line number. The window above the Search Results is the target location of one of the source links.

Source Links are bi-directional, so you can use the Jump To Link command to go from the link source to the target, or from the target back to the source.

In addition, the link information is maintained as you edit your files, just as bookmarks are. A link is only removed if you delete its link source line, or close the link source file.

Searching and Source Links

The search results placed in the Search Results window by the Search, Search Files, and Lookup References commands contain Source Links. The link source file is the Search Results temporary file, and the link target for each link is the location of the matching patterns in the various files that were searched.

Source links are part of the current workspace, which means it is part of the session state. If you save the Search Results to a new file name, the Source links will be retained in the current workspace. For example, you could search for one pattern, save the Search Results to S1.OUT, do a second search, and both S1.OUT and Search Results will have their source links. If you close the Search Results window, the source links are deleted.

Creating Source Links

The Parse Source Links command creates source links in the current file. You specify a search pattern which is used to parse file names and line numbers from a file. Each time a pattern matches, a new source link is inserted into the current file.

The Parse Source Links command is useful if you have a "log" or "output" file that contains compiler output and error messages. You just open the log file, and run the Parse Source Links command. A link will be setup for each line in the log file containing an error message.

Source Links from Custom Command Output

You can create source links from the output of a custom command. When defining the custom command, the "Parse Source Links" option should be on in Custom Command dialog. You must specify a search pattern to be used to parse file names and line numbers. When the command terminates, Source Insight automatically invokes the Go To First Link command.

This is the recommended way to invoke a compiler or build tool from Source Insight. This runs the compiler, and Source Insight will position you to at each erroneous source line.

Source Link Commands

Source Insight provides the following commands for moving between link locations.

Table 3.6: Source Link Commands




Jump To Link


Moves to the other end of the source link at the cur­rent line.

Go To First Link


Selects the first link line in the link source file, and selects the associated link line in the link target file, and ensures both files are visible on the screen in win­dows.

Go To Next Link


Same as above, except with the next link in the link source file.

Go To Previous Link


Jumps to the previous link in the source file.

Search Results Text


Each set of matches in the Search Results window has a search heading that lists the pattern that was used to search, followed by a match count. The search headings are parsed by Source Insight and each search pat­tern appears in the symbol window on the left side of the Search Results window to provide an overview.

For example, a typical search heading might look like:

---- GetStockObject (23) -----

meaning that 23 occurrences where found.

The Search Results window is actually just another file buffer that you can edit. You may freely delete lines from the window to trim down the results. The Search Results buffer is automatically saved when you exit Source Insight.