Working with Blocks of Code

The Code Editor offers several useful tools for manipulating blocks of code. For example, as described in Working with Tabs, you can move multiple lines of text with a single press of the Tab key (or the Shift+Tab shortcut). You can also use a single command to add or remove comment markers from an entire block of text, or use a simple key/mouse combination to select, move, copy, and paste a vertical block (or column) of text.

Comment and uncomment block

To comment out a block of code, perform the following steps:

  1. Select the text.
  2. Expand the Format menu and select Comment Block.

    This adds an asterisk character (*) in column 7 and moves each line right one column.

To uncomment a block of code, perform the following steps:

  1. Select the text.
  2. Expand the Format menu and select Uncomment Block.

    This removes an asterisk character and moves each line left one column.

Vertical block select

To select a vertical column of text, position the cursor at the start of the first item in the column, then hold down the Alt key while clicking and dragging with the mouse. You can then copy the column of text to the clipboard and paste it to another file, either within AcuBench or in another editor. Note that when you paste a vertical block of text into a third-party editor, AcuBench adds a comment, **AcuBench Column Block**, at the head of the column.

When you paste a vertical block into AcuBench, note that the column does not overwrite any existing text. Instead, existing text is moved over the number of columns necessary to make room for the pasted block.

Consider the following example. Suppose you have a list of error codes and the corresponding error messages. You might set up several lines of code like the following:

WHEN "" MOVE "" TO text-message

You could then select the error codes in a vertical block, position the cursor between the first set of quotation marks, and paste the block. Each line would be moved to get a result like:

WHEN "01" MOVE "" TO text-message
WHEN "02" MOVE "" TO text-message
WHEN "03" MOVE "" TO text-message

You could next perform the same operation with the string representing the message to get a result like:

WHEN "01" MOVE "File not found " TO text-message
WHEN "02" MOVE "Incorrect file type" TO text-message
WHEN "03" MOVE "File locked " TO text-message

Note the spaces in the first and third lines. With a vertical block of text, the exact width of the vertical block is preserved, regardless of the length of individual lines in the block.