Block|Rectangular Selections

(available in EditPad Pro only)

There are several ways to select text in EditPad using the keyboard or the mouse. Whichever way you choose, it involves marking a starting and an ending position for the selection. All the text between the starting and the ending position becomes selected, following the flow of the text like you would follow it when reading it out loud. This is how almost all Windows programs select text, and is appropriate in most situations.

But in some situations, such as when editing text files with information organized in tables, it is more useful to make a rectangular selection, also called a column selection. A rectangular selection is much like a selection of cells in a spreadsheet application, except that in EditPad you select characters instead of cells.

Before you can make rectangular selections, a few conditions must be met. First, you need to use a monospaced (fixed width) font such as Consolas. You can change the font via Options|Font. You can make the font monospaced with the monospaced left-to-right text layout. Characters must be properly aligned into columns to be able to make rectangular selections. That only happens when the font is monospaced.

Second, word wrap must be off. You can turn it off using Options|Word Wrap. When long lines are wrapped, editing a long line causes the text to be rewrapped. This is not a problem when the selection flows along with the text. But when using rectangular selections, this rewrapping would cause the selection to change.

Many text editors do not support rectangular selections. Those that do, are usually IDEs or editors from the DOS world that do not support word wrapping or proportionally spaced (variable width) fonts. EditPad is a flexible editor. It supports both rectangular selections as well as modern conveniences like word wrap and proportionally spaced fonts. But it can’t support all this at the same time for the reasons explained above.

There are two ways to make a rectangular selection. First, you can make it the usual way using the keyboard or the mouse, while holding down the Alt button on the keyboard. Second, you can pick Rectangular Selections from the Block menu. This inverts the meaning of the Alt key while making a selection. After choosing Rectangular Selections in the Block menu, a selection made the normal way is rectangular, and a selection made while pressing Alt flows along with the text.

If you did not choose a monospaced font and turn off word wrap, then the selection always flows along with the text. If you pick Block|Rectangular Selections from the menu, EditPad Pro warns you that rectangular selections are presently not possible. It will offer to adjust the settings for you to make rectangular selection possible.

If you turn on Block|Rectangular Selections then it remains active until you turn it off. If you change the file’s settings or if you switch to another file that does not allow rectangular selections then Block|Rectangular Selections has no effect on that file. It will appear inactive even while EditPad Pro remembers that it was active. If you click it then it will offer to adjust the settings. But even if you don’t click it, Block|Rectangular Selections will reactivate if you change settings again or switch to a file that allows rectangular selections. To turn it off permanently, click Block|Rectangular Selections while it shows that it is active.

EditPad Lite does not have the Block|Rectangular Selections menu item. But it does allow you to make rectangular selections using the Alt key. You just need to make sure word wrap is off and the font is monospaced.

Column Editing

Column editing is supported by both EditPad Lite and EditPad Pro. Column editing is automatically active if the cursor is at the left- or right-hand edge of the selection. In EditPad Pro, column editing works differently when selections are persistent.

Column editing often results in a new rectangular selection that is zero columns wide. Such a zero-column selection appears as a vertical line between two columns. You can think of it as a multi-line text cursor. You can make such a selection simply by creating a rectangular selection that starts and ends on the same column on different lines.

Column Editing with Non-Persistent Selections

When selections are not persistent, the cursor is always at an edge of the selection. Moving the cursor away from the selection removes the selection. So column editing is always active if there is a non-persistent rectangular selection.

Entering a character on the keyboard replaces the selected columns with that character on each line. You get a new zero-column selection after the entered character on each line. Entering a character on a zero-column selection inserts the character at the selected column on each line and shifts the zero-column selection one column to the right. Combined, entering multiple characters replaces the selected columns with those characters on each line.

When one or more columns are selected, pressing Backspace or Delete on the keyboard deletes the selected columns. It doesn’t matter whether the cursor is at the left- or right-hand edge. The selection itself remains where it is but becomes zero columns wide.

Pressing Backspace on a zero-column selection deletes the character to the left of the selection on each selected line. The selection moves one column to the left along with the cursor. Pressing Delete on a zero-column selection deletes the character to the right of the selection on each selected line. The selection stays where it is.

Pasting text that does not contain any line breaks replaces the selected columns with the pasted text on each line. You get a new zero-column selection after the pasted text on each line. Pasting text without line breaks on a zero-column selection inserts the pasted text on each line and shifts the zero-column selection as many columns to the right as were pasted.

Copying a rectangular selection and pasting it over another rectangular selection deletes all the selected columns. The pasted rectangle is then inserted at what was the left-hand edge of the deleted selection. The first line on the clipboard is inserted into the first selected line, the second line on the clipboard into the second selected line, and so on. Nothing is selected after pasting. If there are fewer lines on the clipboard than were selected then the whole selection is still deleted. Nothing is inserted on the extra lines that were selected. If there are more lines on the clipboard than were selected, those lines are inserted at the same column into the lines below the selection. If there are not enough lines in the file below the selection then as many lines are added as needed. They are padded with spaces until the column that you are pasting at.

Copying a linear selection and pasting it over a rectangular selection deletes all the selected columns. All of the pasted text, including its line breaks, is then inserted at what was the upper left corner of the deleted selection. Nothing is inserted on the second and following lines that columns were deleted from.

So, by turning off persistent selections, you can easily replace or fill a rectangular selection with new text.

Column Editing with Persistent Selections

When selections are persistent, moving the cursor away from the edge of the selection cancels column editing without removing the selection. Column editing becomes active again as soon as you move the cursor back to the edge of the selection. Any edits you make while the cursor is not at the selection’s edge are made only at the position of the cursor, whether that is inside or outside the selection.

Entering a character on the keyboard inserts that character on each selected line at the column that the text cursor is on. You get a new zero-column selection after the entered character on each line. Nothing is deleted.

Pressing Backspace deletes the character to the left of the cursor’s column on each selected line. Pressing Delete deletes the character to the right of the cursor’s column on each selected line. If the deleted column was selected, the selection shrinks by one column. If the deleted column was to the left of the selection, the selection shifts one column to the left. Regardless, the cursor stays at the same edge of the selection.

Pasting text that does not contain any line breaks inserts the pasted text at the cursor’s column on each selected line. You get a new rectangular selection of the pasted text on each line it was pasted into.

Pasting text that does contain line breaks clears and ignores any persistent selection and is thus unaffected by column editing. Pasting a linear block simply inserts all its text at the cursor’s position.

Pasting a rectangular block inserts the first pasted line at the cursor, the second line at the cursor's column on the line below the cursor, and so on. If the cursor was at the bottom of a rectangular selection then the second and following lines are pasted below the selection. If there are not enough lines in the file below the cursor to paste all the lines on the clipboard then additional lines are added to the file. They are padded with spaces until the cursor’s column.

So, by turning on persistent selections, you can easily prefix or suffix a rectangular selection with new text.

See Also

Block menu
Block|Persistent Selections
Block|Duplicate
Block|Move
Block|Move Lines & Columns
Block|Begin Selection
Block|End Selection
Block|Expand Selection