PageRenderTime 61ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/jEdit/tags/jedit-4-5-pre1/doc/users-guide/text-edit.xml

#
XML | 1252 lines | 1013 code | 235 blank | 4 comment | 0 complexity | 4e33600f9808cb6e8ce8da380db6628c MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <chapter id="editing">
  3. <title>Editing Text</title>
  4. <!-- jEdit buffer-local properties:
  5. :tabSize=1:indentSize=1:noTabs=true:wrap=soft:maxLineLen=80:
  6. :xml.root=users-guide.xml: -->
  7. <section id="caret">
  8. <title>Moving The Caret</title>
  9. <para>The simplest way to move the caret is to click the mouse at the
  10. desired location in the text area. The caret can also be moved using the
  11. keyboard.</para>
  12. <para>The <keycap>LEFT</keycap>, <keycap>RIGHT</keycap>,
  13. <keycap>UP</keycap> and <keycap>DOWN</keycap> keys move the caret in the
  14. respective direction, and the <keycap>PAGE_UP</keycap> and
  15. <keycap>PAGE_DOWN</keycap> keys move the caret up and down one
  16. screen-full, respectively.</para>
  17. <para>When pressed once, the <keycap>HOME</keycap> key moves the caret
  18. to the first non-whitespace character of the current screen line.
  19. Pressing it a second time moves the caret to the beginning of the
  20. current buffer line. Pressing it a third time moves the caret to the
  21. first visible line.</para>
  22. <para>The <keycap>END</keycap> key behaves in a similar manner, going to
  23. the last non-whitespace character of the current screen line, the end of
  24. the current buffer line, and finally to the last visible line.</para>
  25. <para>If soft wrap is disabled, a <quote>screen line</quote> is the same
  26. as a <quote>buffer line</quote>. If soft wrap is enabled, a screen line
  27. is a section of a newline-delimited buffer line that fits within the
  28. wrap margin width. See <xref linkend="word-wrap" />.</para>
  29. <para><keycap>C+HOME</keycap> and <keycap>C+END</keycap> move the caret
  30. to the beginning and end of the buffer, respectively.</para>
  31. <para>More advanced caret movement is covered in <xref
  32. linkend="words" />, <xref linkend="lines" /> and <xref
  33. linkend="paragraphs" />.</para>
  34. <sidebar>
  35. <title>The Home and End keys</title>
  36. <para>If you prefer more traditional behavior for the
  37. <keycap>HOME</keycap> and <keycap>END</keycap> keys, you can
  38. reassign the respective keyboard shortcuts in the
  39. <guibutton>Shortcuts</guibutton> pane of the
  40. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  41. Options</guimenuitem>; see <xref linkend="shortcuts-pane" />.</para>
  42. <para>By default, the shortcuts are assigned as follows:</para>
  43. <itemizedlist>
  44. <listitem>
  45. <para><keycap>HOME</keycap> is bound to <guimenuitem>Smart
  46. Home</guimenuitem>.</para>
  47. </listitem>
  48. <listitem>
  49. <para><keycap>END</keycap> is bound to <guimenuitem>Smart
  50. End</guimenuitem>.</para>
  51. </listitem>
  52. <listitem>
  53. <para><keycap>S+HOME</keycap> is bound to
  54. <guimenuitem>Select to Smart Home
  55. Position</guimenuitem>.</para>
  56. </listitem>
  57. <listitem>
  58. <para><keycap>S+END</keycap> is bound to <guimenuitem>Select
  59. to Smart End Position</guimenuitem>.</para>
  60. </listitem>
  61. </itemizedlist>
  62. <para>However you can rebind them to anything you want, for example,
  63. various combinations of the following, or indeed any other command
  64. or macro:</para>
  65. <itemizedlist>
  66. <listitem>
  67. <para><guimenuitem>Go to Start/End of White
  68. Space</guimenuitem>.</para>
  69. </listitem>
  70. <listitem>
  71. <para><guimenuitem>Go to Start/End of
  72. Line</guimenuitem>.</para>
  73. </listitem>
  74. <listitem>
  75. <para><guimenuitem>Go to Start/End of
  76. Buffer</guimenuitem>.</para>
  77. </listitem>
  78. <listitem>
  79. <para><guimenuitem>Select to Start/End of White Space
  80. </guimenuitem>.</para>
  81. </listitem>
  82. <listitem>
  83. <para><guimenuitem>Select to Start/End of
  84. Line</guimenuitem>.</para>
  85. </listitem>
  86. <listitem>
  87. <para><guimenuitem>Select to Start/End of
  88. Buffer</guimenuitem>.</para>
  89. </listitem>
  90. </itemizedlist>
  91. </sidebar>
  92. </section>
  93. <section id="selection">
  94. <title>Selecting Text</title>
  95. <para>A <firstterm>selection</firstterm> is a block of text marked for
  96. further manipulation. Range selections are equivalent to selections in
  97. most other text editors; they cover text between two points in a buffer.
  98. In addition to the standard text-selection mode, jEdit also allows
  99. <emphasis role="bold">rectangular selections</emphasis> that cover a
  100. rectangular area (some text editors refer to these as <quote>column
  101. selections</quote>). Furthermore, several chunks of text can be selected
  102. and operated on simultaneously.</para>
  103. <section>
  104. <title>Range Selection</title>
  105. <para>Dragging the mouse creates a range selection from where the
  106. mouse was pressed to where it was released. Holding down
  107. <keycap>Shift</keycap> while clicking a location in the buffer will
  108. create a selection from the caret position to the clicked
  109. location.</para>
  110. <para>Holding down <keycap>Shift</keycap> in addition to a caret
  111. movement key (<keycap>LEFT</keycap>, <keycap>UP</keycap>,
  112. <keycap>HOME</keycap>, etc) will extend a selection in the specified
  113. direction.</para>
  114. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Select
  115. All</guimenuitem> (shortcut: <keycap>C+a</keycap>) selects the
  116. entire buffer.</para>
  117. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  118. Selection</guisubmenu>&gt;<guimenuitem>Select None</guimenuitem>
  119. (shortcut: <keycap>ESCAPE</keycap>) deactivates the
  120. selection.</para>
  121. </section>
  122. <section id="rect-select">
  123. <title>Rectangular Selection</title>
  124. <para>Dragging with the <keycap>Control</keycap> key held down will
  125. create a rectangular selection. Holding down <keycap>Shift</keycap>
  126. and <keycap>Control</keycap> while clicking a location in the buffer
  127. will create a rectangular selection from the caret position to the
  128. clicked location.</para>
  129. <para>Alternatively, invoking
  130. <guimenu>Edit</guimenu>&gt;<guisubmenu>More
  131. Selection</guisubmenu>&gt;<guimenuitem>Rectangular
  132. Selection</guimenuitem> (shortcut: <keycap>A+\</keycap>) toggles
  133. rectangular selection mode. In rectangular selection mode, dragging
  134. the mouse always creates a rectangular selection, and keyboard
  135. commands that would normally create a range selection create a
  136. rectangular selection instead. A status bar indicator is shown when
  137. this mode is enabled.</para>
  138. <para>It is possible to select a rectangle with zero width but
  139. non-zero height. This can be used to insert a new column between two
  140. existing columns, for example. Such zero-width selections are shown
  141. as a thin vertical line.</para>
  142. <para>Inserting text into a rectangular selection repeats the text
  143. going down as many times as necessary, and shifts the selection to
  144. the right. This makes it behave like a <quote>tall</quote>
  145. caret.</para>
  146. <para>Rectangles can be deleted, copied, pasted, and operated on
  147. using ordinary editing commands. If necessary, rectangular
  148. selections are automatically filled in with whitespace to maintain
  149. alignment.</para>
  150. <para>Rectangular selections can extend beyond the end of a line
  151. into <quote>virtual space</quote>. Furthermore, if keyboard
  152. rectangular selection mode is on or if the <keycap>Control</keycap>
  153. key is being held down, clicking beyond the end of a line will
  154. insert the appropriate amount of whitespace in order to position the
  155. cursor at the clicked location.</para>
  156. <note>
  157. <para>Rectangular selections are implemented using character
  158. offsets, not absolute screen positions, so they might not behave
  159. as you might expect if a proportional-width font is being used
  160. or if soft wrap is enabled. The text area font can be changed in
  161. the <guibutton>Text Area</guibutton> pane of the
  162. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  163. Options</guimenuitem> dialog box. For information about soft
  164. wrap, see <xref linkend="word-wrap" />.</para>
  165. </note>
  166. </section>
  167. <section id="multi-select">
  168. <title>Multiple Selection</title>
  169. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  170. Selection</guisubmenu>&gt;<guimenuitem>Multiple
  171. Selection</guimenuitem> (keyboard shortcut: <keycap>C+\</keycap>)
  172. turns multiple selection mode on and off. In multiple selection
  173. mode, multiple fragments of text can be selected and operated on
  174. simultaneously, and the caret can be moved independently of the
  175. selection. The status bar indicates if multiple selection mode is
  176. active; see <xref linkend="status-bar" />.</para>
  177. <para>Various jEdit commands behave differently with multiple
  178. selections:</para>
  179. <itemizedlist>
  180. <listitem>
  181. <para>Commands that copy text place the contents of each
  182. selection, separated by line breaks, in the specified
  183. register.</para>
  184. </listitem>
  185. <listitem>
  186. <para>Commands that insert (or paste) text replace each
  187. selection with the entire text that is being
  188. inserted.</para>
  189. </listitem>
  190. <listitem>
  191. <para>Commands that filter text (such as <guimenuitem>Spaces
  192. to Tabs</guimenuitem>, <guimenuitem>Range
  193. Comment</guimenuitem>, <guimenuitem>Replace in
  194. Selection</guimenuitem>, and so on) behave as if each block
  195. was selected independently, and the command invoked on each
  196. in turn.</para>
  197. </listitem>
  198. <listitem>
  199. <para>Line-based commands (such as <guimenuitem>Shift Indent
  200. Left</guimenuitem>, <guimenuitem>Shift Indent
  201. Right</guimenuitem>, and <guimenuitem>Line
  202. Comment</guimenuitem>) operate on each line that contains at
  203. least one selection.</para>
  204. </listitem>
  205. <listitem>
  206. <para>Caret movement commands that would normally deactivate
  207. the selection (such as the arrow keys, while
  208. <keycap>Shift</keycap> is not being held down), move the
  209. caret, leaving the selection as-is.</para>
  210. </listitem>
  211. <listitem>
  212. <para>Some older plugins may not support multiple selection
  213. at all.</para>
  214. </listitem>
  215. </itemizedlist>
  216. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  217. Selection</guisubmenu>&gt;<guimenuitem>Select None</guimenuitem>
  218. (shortcut: <keycap>ESCAPE</keycap>) deactivates the selection
  219. containing the caret, if there is one. Otherwise it deactivates all
  220. active selections.</para>
  221. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  222. Selection</guisubmenu>&gt;<guimenuitem>Invert
  223. Selection</guimenuitem> (shortcut: <keycap>C+e C+i</keycap>) selects
  224. a set of text chunks such that all text that was formerly part of a
  225. selection is now unselected, and all text that wasn't, is
  226. selected.</para>
  227. <note>
  228. <para>Deactivating multiple selection mode while multiple blocks
  229. of text are selected will leave the selections in place, but you
  230. will not be able to add new selections until multiple selection
  231. mode is reactivated.</para>
  232. </note>
  233. </section>
  234. </section>
  235. <section id="entering-text">
  236. <title>Inserting and Deleting Text</title>
  237. <para>Text entered at the keyboard is inserted into the buffer. In
  238. overwrite mode, which can be toggled by pressing
  239. <keycap>INSERT</keycap>, one character is deleted from in front of the
  240. caret position for every character that is inserted. The caret is drawn
  241. as a horizontal line while overwrite mode is active. The status bar also
  242. indicates if overwrite mode is active; see <xref linkend="status-bar" />
  243. for details.</para>
  244. <para>Inserting text while there is a selection will replace the
  245. selection with the inserted text.</para>
  246. <para>When inserting text, the <keycap>TAB</keycap> and
  247. <keycap>ENTER</keycap> keys might not behave entirely like you expect
  248. because of various indentation features; see <xref linkend="indent" />
  249. for details.</para>
  250. <para>The simplest way to delete text is with the
  251. <keycap>BACKSPACE</keycap> and <keycap>DELETE</keycap> keys. If nothing
  252. is selected, they delete the character before or after the caret,
  253. respectively. If a selection exists, both delete the selection.</para>
  254. <para>More advanced deletion commands are described in <xref
  255. linkend="words" />, <xref linkend="lines" /> and <xref
  256. linkend="paragraphs" />.</para>
  257. </section>
  258. <section id="undo-redo">
  259. <title>Undo and Redo</title>
  260. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Undo</guimenuitem>
  261. (shortcut: <keycap>C+z</keycap>) reverses the most recent editing
  262. command. For example, this can be used to restore unintentionally
  263. deleted text. More complicated operations, such as a search and replace,
  264. can also be undone.</para>
  265. <para>If you undo too many changes,
  266. <guimenu>Edit</guimenu>&gt;<guimenuitem>Redo</guimenuitem> (shortcut:
  267. <keycap>C+e C+z</keycap>) can restore the changes again. For example, if
  268. some text was inserted, <guimenuitem>Undo</guimenuitem> will remove it
  269. from the buffer. <guimenuitem>Redo</guimenuitem> will insert it
  270. again.</para>
  271. <para>By default, the last 100 edits is retained; older edits cannot be
  272. undone. The maximum number of undos and whether undos are reset when a
  273. buffer is saved can be changed in the <guibutton>Editing</guibutton>
  274. pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  275. Options</guimenuitem> dialog box; see <xref
  276. linkend="editing-pane" />.</para>
  277. </section>
  278. <section id="words">
  279. <title>Working With Words</title>
  280. <para><keycap>C+LEFT</keycap> and <keycap>C+RIGHT</keycap> move the
  281. caret a word at a time. Holding down <keycap>Shift</keycap> in addition
  282. to the above extends the selection a word at a time.</para>
  283. <para>A single word can be selected by double-clicking with the mouse,
  284. or using the <guimenu>Edit</guimenu>&gt;<guisubmenu>More
  285. Selection</guisubmenu>&gt;<guimenuitem>Select Word</guimenuitem> command
  286. (shortcut: <keycap>C+e w</keycap>). A selection that begins and ends on
  287. word boundaries can be created by double-clicking and dragging.</para>
  288. <para><keycap>C+BACKSPACE</keycap> and <keycap>C+DELETE</keycap> delete
  289. the word before or after the caret, respectively.</para>
  290. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Complete
  291. Word</guimenuitem> (shortcut: <keycap>C+b</keycap>) locates possible
  292. completions for the word at the caret, first by looking in the current
  293. edit mode's syntax highlighting keyword list, and then in the current
  294. buffer for words that begin with the word at the caret. This serves as a
  295. very basic code completion feature.</para>
  296. <para>If there is only one completion, it will be inserted into the
  297. buffer immediately.</para>
  298. <para>If multiple completions were found, the longest common prefix is
  299. inserted into the buffer, and a popup is shown below the caret position
  300. listing the completions.</para>
  301. <para>To insert a completion from the list, either select it using the
  302. <keycap>UP</keycap> and <keycap>DOWN</keycap> keys and press
  303. <keycap>ENTER</keycap>, press a digit to insert one of the first ten
  304. completions (1 is the first completion; 9 is the 9th; 0 is the 10th), or
  305. click the desired completion with the mouse. To close the popup without
  306. inserting a completion, press <keycap>ESCAPE</keycap>.</para>
  307. <para>Typing while the popup is visible will automatically update the
  308. popup and narrow the set of completions as necessary.</para>
  309. <para>The default word completion uses the visible buffers (buffers
  310. being shown in an EditPane) to find completions. The set of possible
  311. words can be expanded by enabling the <guimenuitem>Global Options - Text
  312. Area - Complete words from all open buffers</guimenuitem> option.
  313. Setting this option will use all open buffers to search for possible
  314. completions. Note, this can degrade completion performance if many
  315. buffers are open.</para>
  316. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Word Count</guimenuitem>
  317. displays a dialog box with the number of characters, words and lines in
  318. the current buffer.</para>
  319. <section>
  320. <title>What's a Word?</title>
  321. <para>The default behavior of the <keycap>C+LEFT</keycap>,
  322. <keycap>C+RIGHT</keycap>, <keycap>C+BACKSPACE</keycap> and
  323. <keycap>C+DELETE</keycap> commands is to stop both at the beginning
  324. and the end of each word. Normally, a word is a sequence of
  325. alphanumerics, but you can add other characters as part of
  326. what jEdit considers to be a 'word', set on a global or mode basis
  327. from <guimenuitem>Global Options - Editing - Extra Word
  328. Characters</guimenuitem>.
  329. In addition, this behavior can be changed by remapping
  330. these keystrokes to alternative actions whose names end with
  331. <guimenuitem>(Eat Whitespace)</guimenuitem> in the
  332. <guibutton>Shortcuts</guibutton> pane of the
  333. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  334. Options</guimenuitem> dialog box; see <xref
  335. linkend="shortcuts-pane" />.</para>
  336. </section>
  337. </section>
  338. <section id="lines">
  339. <title>Working With Lines</title>
  340. <para>An entire line can be selected by triple-clicking with the mouse,
  341. or using the <guimenu>Edit</guimenu>&gt;<guisubmenu>More
  342. Selection</guisubmenu>&gt;<guimenuitem>Select Line</guimenuitem> command
  343. (shortcut: <keycap>C+e l</keycap>). A selection that begins and ends on
  344. line boundaries can be created by triple-clicking and dragging.</para>
  345. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Go to Line</guimenuitem>
  346. (shortcut: <keycap>C+l</keycap>) prompts for a line number and moves the
  347. caret there.</para>
  348. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  349. Selection</guisubmenu>&gt;<guimenuitem>Select Line Range</guimenuitem>
  350. (shortcut: <keycap>C+e C+l</keycap>) prompts for two line numbers and
  351. selects all text between them.</para>
  352. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  353. Line</guimenuitem> (shortcut: <keycap>C+d</keycap>) deletes the current
  354. line.</para>
  355. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  356. to Start Of Line</guimenuitem> (shortcut:
  357. <keycap>CS+BACK_SPACE</keycap>) deletes all text from the start of the
  358. current line to the caret.</para>
  359. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  360. to End Of Line</guimenuitem> (shortcut: <keycap>CS+DELETE</keycap>)
  361. deletes all text from the caret to the end of the current line.</para>
  362. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Join
  363. Lines</guimenuitem> (shortcut: <keycap>C+j</keycap>) removes any
  364. whitespace from the start of the next line and joins it with the current
  365. line. The caret is moved to the position where the two lines were
  366. joined. For example, if you invoke <guimenuitem>Join Lines</guimenuitem>
  367. with the caret on the first line of the following Java code:</para>
  368. <screen>new Widget(Foo
  369. .createDefaultFoo());</screen>
  370. <para>It will be changed to:</para>
  371. <screen>new Widget(Foo.createDefaultFoo());</screen>
  372. </section>
  373. <section id="paragraphs">
  374. <title>Working With Paragraphs</title>
  375. <para>As far as jEdit is concerned, <quote>paragraphs</quote> are
  376. delimited by double newlines. This is also how
  377. <application>TeX</application> defines a paragraph. Note that jEdit
  378. doesn't parse HTML files for <quote>&lt;P&gt;</quote> tags, nor does it
  379. support paragraphs delimited only by a leading indent.</para>
  380. <para><keycap>C+UP</keycap> and <keycap>C+DOWN</keycap> move the caret
  381. to the previous and next paragraph, respectively. Holding down
  382. <keycap>Shift</keycap> in addition to the above extends the selection a
  383. paragraph at a time.</para>
  384. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  385. Selection</guisubmenu>&gt;<guimenuitem>Select Paragraph</guimenuitem>
  386. (shortcut: <keycap>C+e p</keycap>) selects the paragraph containing the
  387. caret.</para>
  388. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Format
  389. Paragraph</guimenuitem> (shortcut: <keycap>C+e f</keycap>) splits and
  390. joins lines in the current selection to make it fit within the wrap
  391. column position. If nothing is selected, the paragraph containing the
  392. caret is formatted instead. See <xref linkend="word-wrap" /> for
  393. information about word wrap and changing the wrap column.</para>
  394. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  395. Paragraph</guimenuitem> (shortcut: <keycap>C+e d</keycap>) deletes the
  396. paragraph containing the caret.</para>
  397. </section>
  398. <section id="word-wrap">
  399. <title>Wrapping Long Lines</title>
  400. <para>The <firstterm>word wrap</firstterm> feature splits lines at word
  401. boundaries in order to fit text within a specified wrap margin. A word
  402. boundary, for the purposes of word wrap, means whitespace. Long lines
  403. without whitespace are currently not wrapped by jEdit. The wrap margin
  404. position is indicated in the text are as a faint blue vertical line.
  405. There are two <quote>wrap modes</quote>, <quote>soft</quote> and
  406. <quote>hard</quote>; they are described below. The current wrap mode is
  407. shown in the status bar; see <xref linkend="status-bar" />. The wrap
  408. mode can be changed in one of the following ways:</para>
  409. <itemizedlist>
  410. <listitem>
  411. <para>On a global or mode-specific basis in the
  412. <guibutton>Editing</guibutton> pane of the
  413. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  414. Options</guimenuitem> dialog box. See <xref
  415. linkend="editing-pane" />.</para>
  416. </listitem>
  417. <listitem>
  418. <para>In the current buffer for the duration of the editing
  419. session,</para>
  420. <itemizedlist>
  421. <listitem>
  422. <para>By clicking the status bar indicator.</para>
  423. </listitem>
  424. <listitem>
  425. <para>In the
  426. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Buffer
  427. Options</guimenuitem> dialog box. See <xref
  428. linkend="buffer-opts" />.</para>
  429. </listitem>
  430. <listitem>
  431. <para>From the keyboard, if a keyboard shortcut has been
  432. assigned to the <guimenuitem>Toggle Word
  433. Wrap</guimenuitem> command in the
  434. <guibutton>Shortcuts</guibutton> pane of the
  435. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  436. Options</guimenuitem> dialog box. By default, this
  437. command does not have a keyboard shortcut.</para>
  438. </listitem>
  439. </itemizedlist>
  440. </listitem>
  441. <listitem>
  442. <para>In the current buffer for future editing sessions by
  443. placing the following in one of the first or last 10 lines of
  444. the buffer, where <replaceable>mode</replaceable> is either
  445. <quote>none</quote>, <quote>soft</quote> or <quote>hard</quote>,
  446. and <replaceable>column</replaceable> is the desired wrap
  447. margin:</para>
  448. <screen>:wrap=<replaceable>mode</replaceable>:maxLineLen=<replaceable>column</replaceable>:</screen>
  449. </listitem>
  450. </itemizedlist>
  451. <section>
  452. <title>Soft Wrap</title>
  453. <para>In soft wrap mode, lines are automatically wrapped when
  454. displayed on screen. Newlines are not inserted at the wrap
  455. positions, and the wrapping is automatically updated when text is
  456. inserted or removed.</para>
  457. <para>If the margin is set to 0, then the width of the text area
  458. window is used to determine where to wrap lines.</para>
  459. <para>If end of line markers are enabled in the <guibutton>Text
  460. Area</guibutton> pane of the
  461. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  462. Options</guimenuitem> dialog box, a colon (<quote>:</quote>) is
  463. painted at the end of wrapped lines. See <xref
  464. linkend="text-area-pane" />.</para>
  465. </section>
  466. <section>
  467. <title>Hard Wrap</title>
  468. <para>In hard wrap mode, inserting text at the end of a line will
  469. automatically break the line if it extends beyond the wrap margin.
  470. Inserting or removing text in the middle of a line has no effect,
  471. however text can be re-wrapped using the
  472. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Format
  473. Paragraph</guimenuitem> command. See <xref
  474. linkend="paragraphs" />.</para>
  475. <para>Hard wrap is implemented using character offsets, not screen
  476. positions, so it might not behave like you expect if a
  477. proportional-width font is being used. The text area font can be
  478. changed in the <guibutton>Text Area</guibutton> pane of the
  479. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  480. Options</guimenuitem> dialog box.</para>
  481. </section>
  482. </section>
  483. <section id="scrolling">
  484. <title>Scrolling</title>
  485. <para>If you have a mouse with a scroll wheel, you can use the wheel to
  486. scroll up and down in the text area. Various modifier keys change the
  487. action of the wheel:</para>
  488. <itemizedlist>
  489. <listitem>
  490. <para><keycap>Shift</keycap> - moves the horizontal scrollbar.
  491. time.</para>
  492. </listitem>
  493. <listitem>
  494. <para><keycap>Control</keycap> - scrolls a single line at a
  495. time.</para>
  496. </listitem>
  497. <listitem>
  498. <para><keycap>Alt</keycap> - moves the caret up and down instead
  499. of scrolling.</para>
  500. </listitem>
  501. <listitem>
  502. <para><keycap>CTRL+SHIFT</keycap> - scroll a page at a time. </para>
  503. </listitem>
  504. <listitem>
  505. <para><keycombo>
  506. <keycap>Alt</keycap>
  507. <keycap>Shift</keycap>
  508. </keycombo> - extends the selection up and down instead of
  509. scrolling.</para>
  510. </listitem>
  511. </itemizedlist>
  512. <para>Keyboard commands for scrolling the text area are also
  513. available.</para>
  514. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Scroll
  515. to Current Line</guimenuitem> (shortcut: <keycap>C+e C+j</keycap>)
  516. scrolls the text area in order to make the caret visible, if necessary.
  517. It does nothing if the caret is already visible.</para>
  518. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Center
  519. Caret on Screen</guimenuitem> (shortcut: <keycap>C+e C+n</keycap>) moves
  520. the caret to the line in the middle of the screen.</para>
  521. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Line
  522. Scroll Up</guimenuitem> (shortcut: <keycap>C+QUOTE</keycap>) scrolls the
  523. text area up by one line.</para>
  524. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Line
  525. Scroll Down</guimenuitem> (shortcut: <keycap>C+SLASH</keycap>) scrolls
  526. the text area down by one line.</para>
  527. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Page
  528. Scroll Up</guimenuitem> (shortcut: <keycap>A+QUOTE</keycap>) scrolls the
  529. text area up by one screenful.</para>
  530. <para><guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Page
  531. Scroll Down</guimenuitem> (shortcut: <keycap>A+SLASH</keycap>) scrolls
  532. the text area down by one screenful.</para>
  533. <para>The above scrolling commands differ from the caret movement
  534. commands in that they don't actually move the caret; they just change
  535. the scroll bar position.</para>
  536. </section>
  537. <section id="text-transfer">
  538. <title>Transferring Text</title>
  539. <para>jEdit provides a rich set of commands for moving and copying text.
  540. Commands are provided for moving chunks of text from buffers to
  541. <firstterm>registers</firstterm> and vice-versa. A register is a holding
  542. area for an arbitrary length of text, with a single-character name. Most
  543. other programs can only transfer text to and from the system clipboard;
  544. in jEdit, the system clipboard is just another register, with the
  545. special name <filename>$</filename>.</para>
  546. <section>
  547. <title>The Clipboard</title>
  548. <para>jEdit offers the usual text transfer operations, that operate
  549. on the <filename>$</filename> register.</para>
  550. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Cut</guimenuitem>
  551. (shortcut: <keycap>C+x</keycap>) places the selected text in the
  552. clipboard and removes it from the buffer.</para>
  553. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Copy</guimenuitem>
  554. (shortcut: <keycap>C+c</keycap>) places the selected text in the
  555. clipboard and leaves it in the buffer.</para>
  556. <para><guimenu>Edit</guimenu>&gt;<guimenuitem>Paste</guimenuitem>
  557. (shortcut: <keycap>C+v</keycap>) inserts the clipboard contents in
  558. place of the selection (or at the caret position, if there is no
  559. selection).</para>
  560. <para>The <guimenuitem>Cut</guimenuitem> and
  561. <guimenuitem>Copy</guimenuitem> commands replace the old clipboard
  562. contents with the selected text. There are two alternative commands
  563. which add the selection at the end of the existing clipboard
  564. contents, instead of replacing it.</para>
  565. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  566. Clipboard</guisubmenu>&gt;<guimenuitem>Cut Append</guimenuitem>
  567. (shortcut: <keycap>C+e C+u</keycap>) appends the selected text to
  568. the clipboard, then removes it from the buffer. After this command
  569. has been invoked, the clipboard will consist of the former clipboard
  570. contents, followed by a newline, followed by the selected
  571. text.</para>
  572. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  573. Clipboard</guisubmenu>&gt;<guimenuitem>Copy Append</guimenuitem>
  574. (shortcut: <keycap>C+e C+a</keycap>) is the same as <guimenuitem>Cut
  575. Append</guimenuitem> except it does not remove the selection from
  576. the buffer.</para>
  577. </section>
  578. <section id="quick-copy">
  579. <title>Quick Copy</title>
  580. <para>The quick copy feature is usually found in Unix text editors.
  581. Quick copy is disabled by default, but it can be enabled in the
  582. <guibutton>Mouse</guibutton> pane of the
  583. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  584. Options</guimenuitem> dialog box.</para>
  585. <para>The quick copy feature is accessed using the middle mouse
  586. button. If you do not have a three-button mouse, then either
  587. <keycap>Alt</keycap>-click (on Windows and Unix) or
  588. <keycap>Option</keycap>-click (on MacOS X). The quick copy feature
  589. enables the following behavior:</para>
  590. <itemizedlist>
  591. <listitem>
  592. <para>Clicking the middle mouse button in the text area
  593. inserts the most recently selected text at the clicked
  594. location. If you only have a two-button mouse, you can click
  595. the left mouse button while holding down
  596. <keycap>Alt</keycap> instead of middle-clicking.</para>
  597. </listitem>
  598. <listitem>
  599. <para>Dragging with the middle mouse button creates a
  600. selection without moving the caret. As soon as the mouse
  601. button is released, the selected text is inserted at the
  602. caret position and the selection is deactivated. A message
  603. is shown in the status bar while text is being selected to
  604. remind you that this is not an ordinary selection.</para>
  605. </listitem>
  606. <listitem>
  607. <para>Holding down <keycap>Shift</keycap> while clicking the
  608. middle mouse button will duplicate text between the caret
  609. and the clicked location.</para>
  610. </listitem>
  611. <listitem>
  612. <para>Holding down <keycap>Control</keycap> while clicking
  613. the middle mouse button on a bracket will insert all text in
  614. that bracket's scope at the caret position.</para>
  615. </listitem>
  616. </itemizedlist>
  617. <para>The most recently selected text is stored in the
  618. <filename>%</filename> register.</para>
  619. <para>If jEdit is being run under Java 2 version 1.4 on Unix, you
  620. will be able to transfer text with other X Windows applications
  621. using the quick copy feature. On other platforms and Java versions,
  622. the contents of the quick copy register are only accessible from
  623. within jEdit.</para>
  624. </section>
  625. <section id="registers">
  626. <title>General Register Commands</title>
  627. <para>These commands require more keystrokes than the two methods
  628. shown above, but they can operate on any register, allowing an
  629. arbitrary number of text chunks to be retained at a time.</para>
  630. <para>Each command prompts for a single-character register name to
  631. be entered after being invoked. Pressing <keycap>ESCAPE</keycap>
  632. instead of specifying a register name cancels the operation.</para>
  633. <para>Note that the content of registers other than the clipboard
  634. and quick copy register are automatically saved between jEdit
  635. sessions.</para>
  636. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  637. Clipboard</guisubmenu>&gt;<guimenuitem>Cut to Register</guimenuitem>
  638. (shortcut: <keycap>C+r C+x <replaceable>key</replaceable></keycap>)
  639. stores the selected text in the specified register, removing it from
  640. the buffer.</para>
  641. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  642. Clipboard</guisubmenu>&gt;<guimenuitem>Copy to
  643. Register</guimenuitem> (shortcut: <keycap>C+r C+c
  644. <replaceable>key</replaceable></keycap>) stores the selected text in
  645. the specified register, leaving it in the buffer.</para>
  646. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  647. Clipboard</guisubmenu>&gt;<guimenuitem>Cut Append to
  648. Register</guimenuitem> (shortcut: <keycap>C+r C+u
  649. <replaceable>key</replaceable></keycap>) adds the selected text to
  650. the existing contents of the specified register, and removes it from
  651. the buffer.</para>
  652. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  653. Clipboard</guisubmenu>&gt;<guimenuitem>Copy Append to
  654. Register</guimenuitem> (shortcut: <keycap>C+r C+a
  655. <replaceable>key</replaceable></keycap>) adds the selected text to
  656. the existing contents of the specified register, without removing it
  657. from the buffer.</para>
  658. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  659. Clipboard</guisubmenu>&gt;<guimenuitem>Paste from
  660. Register</guimenuitem> (shortcut: <keycap>C+r C+v
  661. <replaceable>key</replaceable></keycap>) replaces the selection with
  662. the contents of the specified register.</para>
  663. <para>The following three commands display dialog boxes instead of
  664. prompting for a register name.</para>
  665. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  666. Clipboard</guisubmenu>&gt;<guimenuitem>Paste Previous</guimenuitem>
  667. (shortcut: <keycap>C+e C+v</keycap>) displays a dialog box listing
  668. the 20 most recently copied and pasted text strings.</para>
  669. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  670. Clipboard</guisubmenu>&gt;<guimenuitem>Paste Deleted</guimenuitem>
  671. (shortcut: <keycap>C+e C+y</keycap>) is not really a register
  672. command; it displays a dialog box listing the 20 most recently
  673. deleted text strings.</para>
  674. <para><guimenu>Edit</guimenu>&gt;<guisubmenu>More
  675. Clipboard</guisubmenu>&gt;<guimenuitem>View Registers</guimenuitem>
  676. displays a dialog box for viewing register contents, including the
  677. clipboard and the quick copy.</para>
  678. </section>
  679. </section>
  680. <section id="markers">
  681. <title>Markers</title>
  682. <para>A <firstterm>marker</firstterm> is a pointer to a specific
  683. location within a buffer, which may or may not have a single-character
  684. <firstterm>shortcut</firstterm> associated with it. Markers are
  685. persistent; they are saved to
  686. <filename>.<replaceable>filename</replaceable>.marks</filename>, where
  687. <filename><replaceable>filename</replaceable></filename> is the name of
  688. the buffer. (The dot prefix makes the markers file hidden on Unix
  689. systems.) Marker saving can be disabled in the
  690. <guibutton>General</guibutton> pane of the
  691. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  692. Options</guimenuitem> dialog box; see <xref
  693. linkend="general-pane" />.</para>
  694. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Add/Remove
  695. Marker</guimenuitem> (shortcut: <keycap>C+e C+m</keycap>) adds a marker
  696. without a shortcut pointing to the current line. If a marker is already
  697. set on the current line, the marker is removed instead. If text is
  698. selected, markers are added to the first and last line of each
  699. selection.</para>
  700. <para>Markers are listed in the <guimenu>Markers</guimenu> menu;
  701. selecting a marker from this menu will move the caret to its
  702. location.</para>
  703. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Go to Previous
  704. Marker</guimenuitem> (shortcut: <keycap>C+e C+COMMA</keycap>) goes to
  705. the marker immediately before the caret position.</para>
  706. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Go to Next
  707. Marker</guimenuitem> (shortcut: <keycap>C+e C+PERIOD</keycap>) goes to
  708. the marker immediately after the caret position.</para>
  709. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Remove All
  710. Markers</guimenuitem> removes all markers set in the current
  711. buffer.</para>
  712. <para>Markers with shortcuts allow for quicker keyboard-based
  713. navigation. The following commands all prompt for a single-character
  714. shortcut when invoked. Pressing <keycap>ESCAPE</keycap> instead of
  715. specifying a shortcut will cancel the operation.</para>
  716. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Add Marker With
  717. Shortcut</guimenuitem> (shortcut: <keycap>C+t
  718. <replaceable>key</replaceable></keycap>) adds a marker with the
  719. specified shortcut. If marker with that shortcut already exists, it will
  720. remain in the buffer but lose its shortcut.</para>
  721. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Go to
  722. Marker</guimenuitem> (shortcut: <keycap>C+y
  723. <replaceable>key</replaceable></keycap>) moves the caret to the location
  724. of the marker with the specified shortcut.</para>
  725. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Select to
  726. Marker</guimenuitem> (shortcut: <keycap>C+u
  727. <replaceable>key</replaceable></keycap>) creates a selection from the
  728. caret location to the marker with the specified shortcut.</para>
  729. <para><guimenu>Markers</guimenu>&gt;<guimenuitem>Swap Caret and
  730. Marker</guimenuitem> (shortcut: <keycap>C+k
  731. <replaceable>key</replaceable></keycap>) moves the caret to the location
  732. of the marker with the specified shortcut, and moves the marker to the
  733. former caret position. Invoke this command multiple times to flip
  734. between two locations in the buffer.</para>
  735. <para>Lines which contain markers are indicated in the gutter with a
  736. highlight. Moving the mouse over the highlight displays a tool tip
  737. showing the marker's shortcut, if it has one. See <xref
  738. linkend="overview" /> for information about the gutter.</para>
  739. </section>
  740. <section id="search-replace">
  741. <title>Search and Replace</title>
  742. <section>
  743. <title>Searching For Text</title>
  744. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Find</guimenuitem>
  745. (shortcut: <keycap>C+f</keycap>) displays the search and replace
  746. dialog box.</para>
  747. <para>The search string can be entered in the <guibutton>Search
  748. for</guibutton> text field. This text field remembers previously
  749. entered strings; see <xref linkend="history" /> for details.</para>
  750. <para>If text was selected in the text area and the selection does
  751. not span a line break, the selected text becomes the default search
  752. string.</para>
  753. <para>If the selection spans a line break, the <guibutton>Search in
  754. Selection</guibutton> and <guibutton>HyperSearch</guibutton> buttons
  755. will be pre-selected, and the search string field will be initially
  756. blank. (See <xref linkend="hypersearch" /> for information about the
  757. HyperSearch feature.) <!-- Note that finding the next or previous
  758. occurrence cannot be constrained to a selected range; only
  759. replacement and HyperSearch can be (see <xref linkend="hypersearch" />). --></para>
  760. <para>Selecting the <guibutton>Ignore case</guibutton> check box
  761. makes the search case insensitive - for example, searching for
  762. <quote>Hello</quote> will match <quote>hello</quote>,
  763. <quote>HELLO</quote> and <quote>HeLlO</quote>.</para>
  764. <para>To search for special characters (such as newlines or
  765. non-printable characters), inexact sequences of text, or strings
  766. that span multiple lines, we use
  767. <emphasis role="bold">Regular Expressions</emphasis>.
  768. Selecting the <guibutton>Regular expressions</guibutton> check
  769. box allows special characters to be used in the search string.
  770. Regular expression syntax is described in <xref linkend="regexps"/>.
  771. If you use (groups) in the search field, you back-reference them
  772. with $1 through $9 in the replace field. </para>
  773. <para>The <guibutton>Backward</guibutton> and
  774. <guibutton>Forward</guibutton> buttons specify the search direction.
  775. Note that regular expressions can only be used when searching in a
  776. forward direction.</para>
  777. <para>Clicking <guibutton>Find</guibutton> will locate the next
  778. occurrence of the search string (or previous occurrence, if
  779. searching backwards). If the <guibutton>Keep dialog</guibutton>
  780. check box is selected, the dialog box will remain open after the
  781. search string has been located; otherwise, it will close.</para>
  782. <para>If no occurrences could be found and the <guibutton>Auto
  783. wrap</guibutton> check box is selected, the search will
  784. automatically restart from the beginning of the buffer (or the end,
  785. if searching backwards). If <guibutton>Auto wrap</guibutton> is not
  786. selected, a confirmation dialog box is shown before restarting the
  787. search.</para>
  788. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Find
  789. Next</guimenuitem> (shortcut: <keycap>C+g</keycap>) locates the next
  790. occurrence of the most recent search string without displaying the
  791. search and replace dialog box.</para>
  792. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Find
  793. Previous</guimenuitem> (shortcut: <keycap>C+h</keycap>) locates the
  794. previous occurrence of the most recent search string without
  795. displaying the search and replace dialog box.</para>
  796. </section>
  797. <section>
  798. <title>Replacing Text</title>
  799. <para>The replace string text field of the search dialog remembers
  800. previously entered strings; see <xref linkend="history" /> for
  801. details.</para>
  802. <para>Clicking <guibutton>Replace &amp; Find</guibutton> will
  803. perform a replacement in the current selection and locate the next
  804. occurrence of the search string. Clicking <guibutton>Replace
  805. All</guibutton> will replace all occurrences of the search string
  806. with the replacement string in the current search scope (which is
  807. either the selection, the current buffer, or a set of buffers, as
  808. specified in the search and replace dialog box).</para>
  809. <para>Occurrences of the search string can be replaced with either a
  810. replacement string, or the return value of a BeanShell script
  811. snippet. Two radio buttons in the search and replace dialog box
  812. select between the two replacement modes, which are described in
  813. detail below.</para>
  814. <section>
  815. <title>Text Replace</title>
  816. <para>If the <guibutton>Text</guibutton> button is selected, the
  817. search string is simply replaced with the replacement
  818. string.</para>
  819. <para>If regular expressions are enabled, positional parameters
  820. (<literal>$0</literal>, <literal>$1</literal>,
  821. <literal>$2</literal>, and so on) can be used to insert the
  822. contents of matched subexpressions in the replacement string;
  823. see <xref linkend="regexps" /> for more information.</para>
  824. <para>If the search is case-insensitive, jEdit attempts to
  825. modify the case of the replacement string to match that of the
  826. particular instance of the search string being replaced. For
  827. example, searching for <quote>label</quote> and replacing it
  828. with <quote>text</quote>, will perform the following
  829. replacements:</para>
  830. <itemizedlist>
  831. <listitem>
  832. <para><quote>String label</quote> would become
  833. <quote>String text</quote></para>
  834. </listitem>
  835. <listitem>
  836. <para><quote>setLabel</quote> would become
  837. <quote>setText</quote></para>
  838. </listitem>
  839. <listitem>
  840. <para><quote>DEFAULT_LABEL</quote> would become
  841. <quote>DEFAULT_TEXT</quote></para>
  842. </listitem>
  843. </itemizedlist>
  844. </section>
  845. <section>
  846. <title>BeanShell Replace</title>
  847. <para>In BeanShell replacement mode, the search string is
  848. replaced with the return value of a BeanShell snippet. If
  849. you want to use multiple line snippet, enclose your BeanShell
  850. in braces. The following predefined variables can be referenced
  851. in the snippet:</para>
  852. <itemizedlist>
  853. <listitem>
  854. <para><varname>_0</varname> -- the text to be
  855. replaced</para>
  856. </listitem>
  857. <listitem>
  858. <para><varname>_1</varname> - <varname>_9</varname> --
  859. if regular expressions are enabled, these contain the
  860. values of matched subexpressions.</para>
  861. </listitem>
  862. </itemizedlist>
  863. <para>BeanShell syntax and features are covered in great detail
  864. in <xref linkend="writing-macros-part" />, but here are some
  865. examples:</para>
  866. <informalexample>
  867. <para>To replace each occurrence of <quote>Windows</quote>
  868. with <quote>Linux</quote>, and each occurrence of
  869. <quote>Linux</quote> with <quote>Windows</quote>, search for
  870. the following regular expression:</para>
  871. <programlisting>(Windows|Linux)</programlisting>
  872. <para>Replacing it with the following BeanShell
  873. snippet:</para>
  874. <programlisting>_1.equals("Windows") ? "Linux" : "Windows"</programlisting>
  875. </informalexample>
  876. <informalexample>
  877. <para>To convert all HTML tags to lower case, search for the
  878. following regular expression:</para>
  879. <programlisting>&lt;\S+</programlisting>
  880. <para>Replacing it with the following BeanShell
  881. snippet:</para>
  882. <programlisting>_0.toLowerCase()</programlisting>
  883. </informalexample>
  884. <informalexample>
  885. <para>To replace arithmetic expressions contained in curly
  886. braces with the result of evaluating the expression, search
  887. for the following regular expression:</para>
  888. <programlisting>\{(.+?)\}</programlisting>
  889. <para>Replacing it with the following BeanShell
  890. snippet:</para>
  891. <programlisting>eval(_1)</programlisting>
  892. </informalexample>
  893. <para>These examples only scratch the surface; the possibilities
  894. are endless.</para>
  895. </section>
  896. </section>
  897. <section id="hypersearch">
  898. <title>HyperSearch</title>
  899. <para>If the <guibutton>HyperSearch</guibutton> check box in the
  900. search and replace dialog box is selected, clicking
  901. <guibutton>Find</guibutton> lists all occurrences of the search
  902. string, instead of locating the next match.</para>
  903. <para>By default, HyperSearch results are shown in a floating
  904. window. This window can be docked using the commands in its top-left
  905. corner popup menu; see <xref linkend="docking" />.</para>
  906. <para>If the <guibutton>Multiple results</guibutton> check box is
  907. selected in the results window, past search results are
  908. retained.</para>
  909. <para>Running searches can be stopped in the
  910. <guimenu>Utilities</guimenu>&gt;<guisubmenu>Troubleshooting</guisubmenu>&gt;<guimenuitem>I/O
  911. Progress Monitor</guimenuitem> dialog box.</para>
  912. </section>
  913. <section>
  914. <title>Multiple File Search</title>
  915. <para>Search and replace commands can be performed over an arbitrary
  916. set of files in one step. The set of files to search is selected
  917. with a set of buttons in the search dialog box.</para>
  918. <para>If the <guibutton>Current buffer</guibutton> button is
  919. selected, only the current buffer is searched. This is the default
  920. behavior.</para>
  921. <para>If the <guibutton>All buffers</guibutton> button is selected,
  922. all open buffers whose names match the glob pattern entered in the
  923. <guibutton>Filter</guibutton> text field will be searched. See <xref
  924. linkend="globs" /> for more information about glob patterns.</para>
  925. <para>If the <guibutton>Directory</guibutton> radio button is
  926. selected, all files contained in the specified directory whose names
  927. match the glob will be searched. The directory to search in can
  928. either be entered in the <guibutton>Directory</guibutton> text
  929. field, or chosen in a file selector dialog box by clicking the
  930. <guibutton>Choose</guibutton> button next to the field. If the
  931. <guibutton>Search subdirectories</guibutton> check box is selected,
  932. all subdirectories of the specified directory will also be searched.
  933. Keep in mind that searching through directories containing many
  934. files can take a long time.</para>
  935. <para>The <guibutton>Directory</guibutton> and
  936. <guibutton>Filter</guibutton> text fields remember previously
  937. entered strings; see <xref linkend="history" /> for details.</para>
  938. <para>When the search and replace dialog box is opened, the
  939. directory and file name filter fields are set to their previous
  940. values. They can be set to match the current buffer's directory and
  941. file name extension by clicking
  942. <guibutton>Synchronize</guibutton>.</para>
  943. <para>Note that clicking the <guibutton>All Buffers</guibutton> or
  944. <guibutton>Directory</guibutton> radio buttons also selects the
  945. <guibutton>HyperSearch</guibutton> check box since that is what you
  946. would want, most of the time. However, the
  947. <guibutton>HyperSearch</guibutton> check box can be unchecked, for
  948. stepping through search results in multiple files one at a
  949. time.</para>
  950. <para>Two convenience commands are provided for performing multiple
  951. file searches.</para>
  952. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Search in Open
  953. Buffers</guimenuitem> (shortcut: <keycap>C+e C+b</keycap>) displays
  954. the search dialog box and selects the <guibutton>All
  955. buffers</guibutton> button.</para>
  956. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Search in
  957. Directory</guimenuitem> (shortcut: <keycap>C+e C+d</keycap>)
  958. displays the search dialog box and selects the
  959. <guibutton>Directory</guibutton> button.</para>
  960. </section>
  961. <section id="search-bar">
  962. <title>The Search Bar</title>
  963. <para>The search bar feature provides a convenient way to search in
  964. the current buffer without opening the search dialog box. The search
  965. bar does not support replacement or multiple file search. Previously
  966. entered strings can be recalled in the search bar with the
  967. <keycap>Up</keycap> and <keycap>Down</keycap> arrow keys; see <xref
  968. linkend="history" />.</para>
  969. <para>By default, the search bar remains hidden until one of the
  970. quick search commands (described below) is invoked; however you can
  971. choose to have it always visible in the <guibutton>View</guibutton>
  972. pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  973. Options</guimenuitem> dialog box; see <xref
  974. linkend="view-pane" />.</para>
  975. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Incremental Search
  976. Bar</guimenuitem> (shortcut: <keycap>C+COMMA</keycap>) displays the
  977. search bar if necessary, and gives it keyboard focus. </para>
  978. <para><guimenu>Search</guimenu>&gt;<guimenuitem>Incremental Search
  979. for Word</guimenuitem> (shortcut: <keycap>A+COMMA</keycap>) behaves
  980. like the above command except it places the word at the caret in the
  981. search string field. If this command is invoked while there is a
  982. selection, the selection is placed in the search string
  983. field instead.</para>
  984. <para>Unless the <guibutton>HyperSearch</guibutton> check box is
  985. selected, the search bar will perform an <firstterm>incremental
  986. search</firstterm>. In incremental search mode, the first occurrence
  987. of the search string is located in the current buffer as it is being
  988. typed. Pressing <keycap>ENTER</keycap> and <keycap>S+ENTER</keycap>
  989. searches for the next and previous occurrence, respectively. Once
  990. the desired occurrence has been located, pressing
  991. <keycap>ESCAPE</keycap> returns keyboard focus to the text area.
  992. Unless the search bar is set to be always visible (see above),
  993. pressing <keycap>ESCAPE</keycap> will also hide the search
  994. bar.</para>
  995. <note>
  996. <para>Incremental searches cannot be not recorded in macros. If
  997. your macro needs to perform a search, use the search and replace
  998. dialog box instead. See <xref linkend="using-macros" /> for
  999. information about macros.</para>
  1000. </note>
  1001. <para><guimenu>Search</guimenu>&gt;<guimenuitem>HyperSearch
  1002. Bar</guimenuitem> (shortcut: <keycap>C+PERIOD</keycap>) displays the
  1003. search bar if necessary, gives it keyboard focus, and selects the
  1004. <guibutton>HyperSearch</guibutton> check box. If this command is
  1005. invoked while there is a selection, the selected text will be
  1006. searched for immediately and the search bar will not be
  1007. shown.</para>
  1008. <para>If the <guibutton>HyperSearch</guibutton> check box is
  1009. selected, pressing <keycap>Enter</keycap> in the search string field
  1010. will perform a HyperSearch in the current buffer.</para>
  1011. <para><guimenu>Search</guimenu>&gt;<guimenuitem>HyperSearch for
  1012. Word</guimenuitem> (shortcut: <keycap>A+PERIOD</keycap>) performs a
  1013. HyperSearch for the word at the caret. This command does not show
  1014. the search bar or give it keyboard focus.</para>
  1015. </section>
  1016. </section>
  1017. </chapter>