This file is indexed.

/usr/share/doc/gnat-gps/html/Searching-and-Replacing.html is in gnat-gps-doc 5.0-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<html lang="en">
<head>
<title>Searching and Replacing - Using the GNAT Programming Studio</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using the GNAT Programming Studio">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Project-Handling.html#Project-Handling" title="Project Handling">
<link rel="next" href="Compilation_002fBuild.html#Compilation_002fBuild" title="Compilation/Build">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 2002-2010 AdaCore.

This document is free; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, see `http://www.gnu.org/licenses/'.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
pre.smallexample {background-color:rgb(240,240,240);
                     font-family: courier new,courier,fixed;
                     font-size: 14px;
                     margin: 0px 40px 0px 40px;
                     border-width: 1px 2px 2px 1px;
                     border-top-style: dotted;
                     border-left-style: dotted;
                     border-right-style: solid;
                     border-bottom-style: solid;
                     border-color: black;}
   code             {color:black;
                     font-family: courier new,courier,fixed;
                     font-size: 14px;}
   body             {font-family: arial,helvetica,sans-serif;
                     font-size: 16px;
                     max-width: 800px;
                     text-align: justify}
   samp             {font-family: courier new,courier,fixed;
                     font-size: 14px}
                    
--></style>
</head>
<body>
<div class="node">
<a name="Searching-and-Replacing"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Compilation_002fBuild.html#Compilation_002fBuild">Compilation/Build</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Project-Handling.html#Project-Handling">Project Handling</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">8 Searching and Replacing</h2>

<p><a name="index-find-396"></a><a name="index-search-397"></a><a name="index-replace-398"></a><!--  -->

<p class="noindent">GPS provides extensive search capabilities among its different
elements. For instance, it is possible to search in the currently
edited source file, or in all the source files belonging to the
project, even those that are not currently open. It is also possible
to search in the project view (on the left side of the main GPS
window), <small class="dots">...</small>
<a name="index-project-view-399"></a>
<a name="index-menu-400"></a><a name="index-key-401"></a><a name="index-search-context-402"></a>All these search contexts are grouped into a single graphical window,
that you can open either through the menu <code>Navigate-&gt;Find/Replace...</code>, or
the shortcut &lt;Ctrl-F&gt;.

   <p>By default, the search window is floating, ie appears as a dialog on top of
GPS. You can choose to put it inside the multiple document interface
permanently for easier access. This can be done by selecting the menu
<code>Window-&gt;Floating</code>, and then drag-and-dropping the search window in a
new location if you wish (for instance above the Project View).

   <p>Selecting either of these two options will pop up a dialog on the
screen, similar to the following:

   <p><a name="index-screen-shot-403"></a><img src="search-hide.jpg" alt="search-hide.jpg">

   <p>On this screen shot, you can see three entry fields:

     <dl>
<dt><samp><span class="command">Search for</span></samp><dd><a name="index-search-for-404"></a>This is the location where you type the string or pattern you are
looking for. The search widget supports two modes, either fixed strings
or regular expressions. You can commute between the two modes by
either clicking on the <code>Options</code> button and selecting the
appropriate check box, or by opening the combo box (click on the arrow
on the right of the entry field).

     <p>In this combo box, a number of predefined patterns are provided. The
top two ones are empty patterns, that automatically set up the
appropriate fixed strings/regular expression mode. The other regular
expressions are language-specific, and will match patterns like Ada
type definition, C++ method declaration, <small class="dots">...</small>
<a name="index-C_002b_002b-405"></a><a name="index-Ada-406"></a>
<br><dt><samp><span class="command">Replace with</span></samp><dd><a name="index-replace-with-407"></a>This field should contain the string that will replace the occurrences
of the pattern defined above. 
The combo box provides a history of previously used replacement
strings.

     <br><dt><samp><span class="command">Look in</span></samp><dd><a name="index-look-in-408"></a>This field defines the context in which the search should
occur. 
<a name="index-search-context-409"></a>GPS will automatically select the most appropriate context when you
open the search dialog, depending on which component currently has the
focus. If several contexts are possible for one component (for example, the
editor has "Current_File", "Files from Project", "Files..." and "Open Files"),
then the last one you've been using will be selected. You can of course change
the context to another one if needed.

     <p>Clicking on the arrow on the right will display the list of all
possible contexts. This list includes:

          <dl>
<dt><code>Project View</code><dd>Search in the project view. An extra <i>Scope</i> box will be displayed
where you can specify the scope of your search, which can be a set of:
<code>Projects, Directories, Files, Entities</code>. The search in entities
may take a long time, search each file is parsed during the search.

          <br><dt><code>Open Files</code><dd>Search in all the files that are currently open in the source editor. The
<i>Scope</i> entry is described in the <code>Files...</code> section below.

          <br><dt><code>Files...</code><dd>Search in a given set of files. An extra <i>Files</i> box will be displayed
where you can specify the files by using standard shell (Unix or Windows)
regular expression, e.g. <code>*.ad?</code> for all files ending with .ad and any
trailing character. The directory specified where the search starts, and
the <i>Recursive search</i> button whether sub directories will be searched
as well.

          <p>The <i>Scope</i> entry is used to restrict the search to a set of language
constructs, e.g. to avoid matching on comments when you
are only interested in actual code, or to only search strings and
comments, and ignore the code.

          <br><dt><code>Files From Project</code><dd>Search in all the files from the project, including files from project
dependencies. The <i>Scope</i> entry is described in the <code>Files...</code>
section above.

          <br><dt><code>Current File</code><dd>Search in the current source editor. 
The <i>Scope</i> entry is described in the <code>Files...</code> section above.

          <br><dt><code>Project Browser</code><dd>Search in the project browser (see <a href="The-Project-Browser.html#The-Project-Browser">The Project Browser</a>).

     </dl>

     <p>The default value for <code>Look In</code> is set through various means: by
default, GPS will select a context that matches the currently selected
window. For instance, if you are in an editor and open the search dialog,
the context will be set to <code>Current File</code>. But if the project view is
the active window, the context will be set to <code>Project View</code>. 
Optionally, GPS can remember the last context that was set (see the preference
<code>Search/Preserve Search Context</code>. If this is set, and an editor is
selected, GPS will remember whether the last time you started a search from
an editor you decided to search in <code>Current File</code> or <code>Files From
Project</code> for instance.

     <p>Finally, you can create key shortcuts (through the <code>/Edit/Key Shortcuts</code>
menu, in the <code>Search</code> category) to open the search dialog and set the
context to a specific value.

   </dl>

   <p>The second part of the window is a row of buttons, to start the search
(or continue to the next occurrence), and to display the options.

   <p><a name="index-screen-shot-410"></a><img src="search-options.jpg" alt="search-options.jpg">

   <p>There are five check boxes in this options box.

     <dl>
<dt><code>"Regexp"</code><dd><a name="index-regular-expression-411"></a>This button commutes between fixed string patterns and regular
expressions. You can also commute between these two modes
by selecting the arrow on the right of the <code>Search for:</code> field. 
The grammar followed by the regular expressions is similar to the Perl and
Python regular expressions grammar, and is documented in the GNAT run time file
<samp><span class="file">g-regpat.ads</span></samp>. To open it from GPS, you can use the open from project
dialog (<code>File-&gt;Open From Project...</code>) and type g-regpat.ads. See
<a href="Open-From-Project.html#Open-From-Project">Open From Project</a> for more information on this dialog.

     <br><dt><code>"Whole Word"</code><dd><a name="index-whole-word-412"></a>If activated, this check box will force the search engine to ignore
substrings. "sensitive" will no longer match "insensitive".

     <br><dt><code>Select on Match</code><dd><a name="index-select-window-on-match-413"></a>When this button is selected, the focus is given to the editor that contains
the match, so that you can start editing the text immediatly. If the button is
not selected, the focus is left on the search window, so that you can press
Enter to search for the next occurrence.

     <br><dt><code>Close on Match</code><dd><a name="index-close-dialog-on-match-414"></a>This button only appears if the search window is floating. If this button is
enabled, the search window will be automatically closed when an
occurrence of the search string is found.

     <br><dt><code>"Case Sensitive Search"</code><dd><a name="index-case-sensitive-415"></a>By default, patterns are case insensitive (upper-case letters and
lower-case letters are considered as equivalent). You can change this
behavior by clicking on this check box.

     <br><dt><code>"Case Preserving Replace"</code><dd><a name="index-case-preserving-416"></a>When this is checked, replacements preserve casing. Three casings are detected
and preserved: all lower, all UPPER, and Mixed_Case where the first character
of each word is capitalized. Note that when the replace pattern is not all
lower case, replacement is never case-preserving, the original casing of the
replace pattern is used.

   </dl>

   <p>Pressing the <code>Find</code> / <code>Previous</code> buttons performs an interactive
search. 
It stops as soon as one occurrence of the pattern is found. 
search. Once a first occurrence has been found, the <code>Find</code> button is
renamed to <code>Next</code>. 
You then have to press the <code>Next</code> button (or the equivalent shortcut
&lt;Ctrl-N&gt;) to go to the next occurrence.

   <p>If you use the <code>Find all</code> button, the search widget will start
searching for all occurrences right away, and put the results in a new
window called <code>Locations</code>, See <a href="The-Locations-View.html#The-Locations-View">The Locations View</a>.

   <p>The <code>Replace</code> and <code>Replace &amp; Find</code> buttons are grayed out as long as
no occurence of the pattern is found. In order to enable them, you have to
start a search, e.g. by pressing the <code>Find</code> button. Pressing <code>Replace</code>
will replace the current occurence (and therefore the two buttons will be
grayed out), and <code>Replace &amp; Find</code> will replace the occurence and then
jump to the next one, if any. If you don't want to replace the current
occurence, you can jump directly to the next one by pressing <code>Next</code>.

   <p>The <code>Repl all</code> button will replace all the occurences found. By default,
a popup is displayed and ask for confirmation. It's possible to disable this
popup by either checking the box "Do not ask this question again", or by going
in the Search pannel of the preferences pages, and unchecking "Confirmation for
'Replace all'". The confirmation popup can be reenabled through this checkbox.

   <p><a name="index-MDI-417"></a><a name="index-Multiple-Document-Interface-418"></a>As most GPS components, the search window is under control of the
multiple document interface, and can thus be integrated into the main
GPS window instead of being an external window.

   <p><a name="index-menu-419"></a>To force this behavior, open the menu <code>Window</code>, select
<code>Search</code> in the list at the bottom of the menu, and then select
either <code>Floating</code> or <code>Docked</code>.

   <p>If you save the desktop (<code>File-&gt;Save More-&gt;Desktop</code>, GPS will
automatically reopen the search dialog in its new place when it is
started next time.

<!--  -->
   </body></html>