Epsilon User's Manual and Reference >
Commands by Topic >
Changing Text >
Rectangle Commands
Epsilon regions actually come in four distinct types.
Each type has a corresponding Epsilon command that begins defining a
region of that type.
The commands are otherwise very similar. Each command starts
defining a region of the specified type, setting the mark equal to
point and turning on highlighting. If Epsilon is already
highlighting a region of a different type, these commands change the
type. If Epsilon is already highlighting a region of the same type,
these commands start defining a new region by setting mark to point
again. (You can set the variable mark-unhighlights to make
the commands turn off the highlighting and leave the mark alone in
this case.)
The mark-normal-region command defines the same kind of region
as the set-mark command described in Killing Text.
(The commands differ in that set-mark always begins defining
a new region, even if another type of region is highlighted on the
screen. The mark-normal-region command converts the old
region, as described above.)
A line region always contains entire lines of text. It consists of
the line containing point, the line containing mark, and all lines
between the two.
An inclusive region is very similar to a normal region, but an
inclusive region contains one additional character at the end of the
region. A normal region contains all characters between point and
mark, if you think of point and mark as being positioned between
characters. But if you think of point and mark as character
positions, then an inclusive region contains the character at point,
the character at the mark, and all characters between the two. An
inclusive region always contains at least one character (unless point
and mark are both at the end of the buffer).
A rectangular region
consists of all columns between those of point and mark, on all lines
in the buffer between those of point and mark. The
mark-rectangle command on Ctrl-x # begins defining a rectangular
region. In a rectangular region, point can specify any of the four
corners of this rectangle.
Some commands operate differently when the current region is
rectangular. Killing a rectangular region by pressing the Ctrl-w key
runs the command kill-rectangle. It saves the current rectangle
in a kill buffer, and replaces the rectangle with spaces, so as not to
shift any text that appears to the right of the rectangle. To remove
the rectangle and the space it occupied, press Ctrl-u Ctrl-w. This
shifts columns of text that followed the rectangle to the left. (Also
see the kill-rectangle-removes variable.)
The Alt-w key runs the command copy-rectangle. It also saves
the current rectangle, but doesn't modify the buffer. (Actually, it
may insert spaces at the ends of lines, or convert tabs to spaces, if
that's necessary to reach the starting or ending column on one of the
lines in the region. But the buffer won't look any different as a
result of these changes. Most rectangle commands do this.)
The Ctrl-Alt-w key runs the command delete-rectangle. It
removes the current rectangle, shifting any text after it to the left.
It doesn't save the rectangle.
When you use the Ctrl-y key to yank a kill buffer that contains a
rectangle, Epsilon inserts the last killed rectangle into the buffer
at the current column, on the current and successive lines. It shifts
existing text to the right. If you've enabled overwrite mode,
however, the rectangle replaces any existing text in those columns.
See the yank-rectangle-to-corner variable to set how Epsilon
positions point and mark around the yanked rectangle. You can use the
Alt-y key to cycle through previous kills as usual.
When yanking line regions, the yank-line-retains-position
variable serves a similar purpose, influencing where Epsilon positions
the cursor.
The width of a tab character depends upon the column it occurs in.
For this reason, if you use the rectangle commands to kill or copy
text containing tabs, and you move the tabs to a different column,
text after the tabs may shift columns. (For example, a tab at column
0 occupies 8 columns, but a tab at column 6 occupies only 2 columns.)
You can avoid this problem by using spaces instead of tabs with the
rectangle commands.
The buffer-specific variable indent-with-tabs controls whether
Epsilon does indenting with tabs or only with spaces. Set it to 0 to
make Epsilon always use spaces. This variable affects only future
indenting you may do; it doesn't change your file. To replace the
tabs in your file, use the untabify-buffer command.
Note that the bindings shown below for kill-rectangle,
copy-rectangle, and delete-rectangle only apply when
there's a highlighted rectangle.
Standard bindings:
Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.
|