## Selecting Text

A selection is a block of text marked for further manipulation. Range selections are equivalent to selections in most other text editors; they cover text between two points in a buffer. jEdit also allows rectangular selections that cover a rectangular area (some text editors refer to these as “column selections”). Furthermore, several chunks of text can be selected and operated on simultaneously.

### Range Selection

Dragging the mouse creates a range selection from where the mouse was pressed to where it was released. Holding down `Shift` while clicking a location in the buffer will create a selection from the caret position to the clicked location.

Holding down `Shift` in addition to a caret movement key (`LEFT`, `UP`, `HOME`, etc) will extend a selection in the specified direction.

Edit>Select All (shortcut: `C+a`) selects the entire buffer.

Edit>More Selection>Select None (shortcut: `ESCAPE`) deactivates the selection.

### Rectangular Selection

Dragging with the `Control` key held down will create a rectangular selection. Holding down `Shift` and `Control` while clicking a location in the buffer will create a rectangular selection from the caret position to the clicked location.

Alternatively, invoking Edit>More Selection>Rectangular Selection (shortcut: `A+\`) toggles rectangular selection mode. In rectangular selection mode, dragging the mouse always creates a rectangular selection, and keyboard commands that would normally create a range selection create a rectangular selection instead. A status bar indicator is shown when this mode is enabled.

It is possible to select a rectangle with zero width but non-zero height. This can be used to insert a new column between two existing columns, for example. Such zero-width selections are shown as a thin vertical line.

Inserting text into a rectangular selection repeats the text going down as many times as necessary, and shifts the selection to the right. This makes it behave like a “tall” caret.

Rectangles can be deleted, copied, pasted, and operated on using ordinary editing commands. If necessary, rectangular selections are automatically filled in with whitespace to maintain alignment.

Rectangular selections can extend beyond the end of a line into “virtual space”. Furthermore, if keyboard rectangular selection mode is on or if the `Control` key is being held down, clicking beyond the end of a line will insert the appropriate amount of whitespace in order to position the cursor at the clicked location.

### Note

Rectangular selections are implemented using character offsets, not absolute screen positions, so they might not behave as you might expect if a proportional-width font is being used or if soft wrap is enabled. The text area font can be changed in the Text Area pane of the Utilities>Global Options dialog box. For information about soft wrap, see the section called “Wrapping Long Lines”.

### Multiple Selection

Edit>More Selection>Multiple Selection (keyboard shortcut: `C+\`) turns multiple selection mode on and off. In multiple selection mode, multiple fragments of text can be selected and operated on simultaneously, and the caret can be moved independently of the selection. The status bar indicates if multiple selection mode is active; see the section called “The Status Bar”.

Various jEdit commands behave differently with multiple selections:

- Commands that copy text place the contents of each selection, separated by line breaks, in the specified register.

- Commands that insert (or paste) text replace each selection with the entire text that is being inserted.

- Commands that filter text (such as Spaces to Tabs, Range Comment, Replace in Selection, and so on) behave as if each block was selected independently, and the command invoked on each in turn.

- Line-based commands (such as Shift Indent Left, Shift Indent Right, and Line Comment) operate on each line that contains at least one selection.

- Caret movement commands that would normally deactivate the selection (such as the arrow keys, while `Shift` is not being held down), move the caret, leaving the selection as-is.

- Some older plugins may not support multiple selection at all.

Edit>More Selection>Select None (shortcut: `ESCAPE`) deactivates the selection containing the caret, if there is one. Otherwise it deactivates all active selections.

Edit>More Selection>Invert Selection (shortcut: `C+e C+i`) selects a set of text chunks such that all text that was formerly part of a selection is now unselected, and all text that wasn't, is selected.

### Note

Deactivating multiple selection mode while multiple blocks of text are selected will leave the selections in place, but you will not be able to add new selections until multiple selection mode is reactivated.