This file is indexed.

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

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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 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 2 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/.

A copy of the license is included in the section entitled
"GNU General Public License". -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Using the GNAT Programming Studio: Searching and Replacing</title>

<meta name="description" content="Using the GNAT Programming Studio: Searching and Replacing">
<meta name="keywords" content="Using the GNAT Programming Studio: Searching and Replacing">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index-table.html#Index-table" rel="index" title="Index table">
<link href="index.html#Top" rel="up" title="Top">
<link href="Compilation_002fBuild.html#Compilation_002fBuild" rel="next" title="Compilation/Build">
<link href="The-Project-Browser.html#The-Project-Browser" rel="previous" title="The Project Browser">
<style type="text/css">
<!--
   

a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
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 lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Searching-and-Replacing"></a>
<div class="header">
<p>
Next: <a href="Compilation_002fBuild.html#Compilation_002fBuild" accesskey="n" rel="next">Compilation/Build</a>, Previous: <a href="Project-Handling.html#Project-Handling" accesskey="p" rel="previous">Project Handling</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Index-table.html#Index-table" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Searching-and-Replacing-1"></a>
<h2 class="chapter">8 Searching and Replacing</h2>
<a name="index-find-2"></a>
<a name="index-search-3"></a>
<a name="index-replace-1"></a>

<p>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), &hellip;
<a name="index-project-view-6"></a>
</p>
<a name="index-menu-6"></a>
<a name="index-key-5"></a>
<a name="index-search-context"></a>
<p>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 <tt class="key">Ctrl-F</tt>.
</p>
<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>
<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-27"></a>
<img src="search-hide.jpg" alt="search-hide">

<p>On this screen shot, you can see three entry fields:
</p>
<dl compact="compact">
<dt><code>Search for</code></dt>
<dd><a name="index-search-for"></a>
<p>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>
<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, &hellip;
<a name="index-C_002b_002b-2"></a>
<a name="index-Ada-4"></a>
</p>
</dd>
<dt><code>Replace with</code></dt>
<dd><a name="index-replace-with"></a>
<p>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.
</p>
</dd>
<dt><code>Look in</code></dt>
<dd><a name="index-look-in"></a>
<p>This field defines the context in which the search should
occur.
<a name="index-search-context-1"></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 &quot;Current_File&quot;, &quot;Files from Project&quot;, &quot;Files...&quot; and &quot;Open Files&quot;),
then the last one you&rsquo;ve been using will be selected. You can of course change
the context to another one if needed.
</p>
<p>Clicking on the arrow on the right will display the list of all
possible contexts. This list includes:
</p>
<dl compact="compact">
<dt><code>Project View</code></dt>
<dd><p>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.
</p>
</dd>
<dt><code>Open Files</code></dt>
<dd><p>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.
</p>
</dd>
<dt><code>Files...</code></dt>
<dd><p>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>
<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.
</p>
</dd>
<dt><code>Files From Project</code></dt>
<dd><p>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.
</p>
</dd>
<dt><code>Current File</code></dt>
<dd><p>Search in the current source editor.
The <i>Scope</i> entry is described in the <code>Files...</code> section above.
</p>
</dd>
<dt><code>Project Browser</code></dt>
<dd><p>Search in the project browser (see <a href="The-Project-Browser.html#The-Project-Browser">The Project Browser</a>).
</p>
</dd>
</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>
<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.
</p>
</dd>
</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-28"></a>
<img src="search-options.jpg" alt="search-options">

<p>There are five check boxes in this options box.
</p>
<dl compact="compact">
<dt><b><code>&quot;Regexp&quot;</code></b></dt>
<dd><a name="index-regular-expression"></a>
<p>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>g-regpat.ads</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="Menu-Items.html#Open-From-Project">Open From Project</a> for more information on this dialog.
</p>
</dd>
<dt><b><code>&quot;Whole Word&quot;</code></b></dt>
<dd><a name="index-whole-word"></a>
<p>If activated, this check box will force the search engine to ignore
substrings. &quot;sensitive&quot; will no longer match &quot;insensitive&quot;.
</p>
</dd>
<dt><b><code>Select on Match</code></b></dt>
<dd><a name="index-select-window-on-match"></a>
<p>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.
</p>
</dd>
<dt><b><code>Close on Match</code></b></dt>
<dd><a name="index-close-dialog-on-match"></a>
<p>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.
</p>
</dd>
<dt><b><code>&quot;Case Sensitive Search&quot;</code></b></dt>
<dd><a name="index-case-sensitive"></a>
<p>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.
</p>
</dd>
<dt><b><code>&quot;Case Preserving Replace&quot;</code></b></dt>
<dd><a name="index-case-preserving"></a>
<p>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.
</p>
</dd>
</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
<tt class="key">Ctrl-N</tt>) to go to the next occurrence.
</p>
<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>
<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&rsquo;t want to replace the current
occurence, you can jump directly to the next one by pressing <code>Next</code>.
</p>
<p>The <code>Repl all</code> button will replace all the occurences found. By default,
a popup is displayed and ask for confirmation. It&rsquo;s possible to disable this
popup by either checking the box &quot;Do not ask this question again&quot;, or by going
in the Search pannel of the preferences pages, and unchecking &quot;Confirmation for
&rsquo;Replace all&rsquo;&quot;. The confirmation popup can be reenabled through this checkbox.
</p>
<a name="index-MDI-2"></a>
<a name="index-Multiple-Document-Interface-2"></a>
<p>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-7"></a>
<p>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>
<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.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Compilation_002fBuild.html#Compilation_002fBuild" accesskey="n" rel="next">Compilation/Build</a>, Previous: <a href="Project-Handling.html#Project-Handling" accesskey="p" rel="previous">Project Handling</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Index-table.html#Index-table" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>