(→Columnar Block Examples) |
|||
| Line 90: | Line 90: | ||
Use <kbd>USER</kbd> > <kbd>Remove trailing spaces</kbd> to remove all trailing spaces from a file. (This assumes the default '''USER''' menu.) | Use <kbd>USER</kbd> > <kbd>Remove trailing spaces</kbd> to remove all trailing spaces from a file. (This assumes the default '''USER''' menu.) | ||
</div> | </div> | ||
| + | |||
| + | ==Related Resources== | ||
| + | *[[Block_Operations|Block Operations Overview]] | ||
| + | *[[Indent_Block_Lines|Indent Blocks and Lines]] | ||
VEDIT works manipulate columns of text, a “columnar block” is a rectangle of characters in your file. It can be anywhere from one character wide to the full width of the text being edited and also extend from as little as one line to many pages in length. All of vEdit's block operations work with columnar blocks, also you can restrict a search/replace operation to the columnar block.
Columnar blocks are especially convenient for editing tabular data such as a spreadsheet or a database. For example, you could copy a table of numbers, say between lines 10 and 20 and between columns 30 and 40 to a text register. This columnar block of numbers can then be inserted anywhere else. To make columnar block operations as simple and useful as possible, VEDIT performs some additional manipulations on your text.
To perform columnar block operations mark the desired block with BLOCK > Set column marker ( Alt-I or toolbar). After setting the first block marker, the highlighting shows precisely which characters are included in the block. You will immediately notice the difference in the way the text is highlighted in Column Mode.
The following screen shows a columnar block highlighted. Note that the cursor is in the lower right corner of the block:

After copying this block to a text register, the register will contain:
VVVVVVVVV EEEEEEEEE DDDDDDDDD IIIIIIIII TTTTTTTT. VVVVVV...
The “.” are padding spaces that were added to the register in order to give it a flush right margin.
Now consider the following text before inserting this register.

After inserting the register, the screen will display:

This shows the importance of the added extra spaces when the block was initially copied to the text register.
Now consider the following text before inserting the same text register. Note that text lines 6 and 7 do not reach the insertion column.

After inserting the same register, the screen will display:

By padding text lines 6 and 7 with spaces, the inserted block also remains aligned.
Notice that the extra spaces added to the text register are now trailing spaces on lines 6 and 7 above and serve no alignment purpose. When CONFIG > Tab/Fill > Trim spaces after columnar operation is enabled (the default), these extra spaces are trimmed following the insertion.
To demonstrate this trimming, consider the following text register. Note that it contains a blank line consisting of spaces.
VVVVVVVVV EEEEEEEEE ......... DDDDDDDD. IIIIII... TTTT.....
Consider the following text which contains three trailing spaces on lines 4, 6 and 8. (Remember that trailing spaces are invisible unless you change VIEW > Options > Show newlines (CR/LF) to display the location of the “newline” character(s) at the end of each line.)

With CONFIG > Tab/Fill > Trim spaces after columnar operation enabled, inserting the text register will change the screen to:

The trailing spaces, including the existing ones on lines 4, have been trimmed. The trailing spaces on line 8, which was not involved in the insertion, still remain.
As explained earlier, Tab characters in a columnar block operation are first converted to spaces and can optionally be converted back to Tab characters. However, a single space is never converted to a Tab character. Also, the first two spaces following a “.” (period), “!” and “:” are not converted to a Tab character. This makes columnar block operations more compatible with the needs of word processing.
The above discussion also applies to columnar block copy/move performed with BLOCK > Copy to cursor and BLOCK > Move to cursor. These are implemented with an internal text register and therefore operate identically.
Use EDIT > Convert > Detab to convert Tab characters in a file to spaces.
Use USER > Remove trailing spaces to remove all trailing spaces from a file. (This assumes the default USER menu.)