Perform a Rectangular Edit

The MPLAB® X IDE does not have a built in capability to perform rectangular edits, but there is a Netbeans plug-in that will add this very useful functionality. Specifically, the plug-in supports the following operations:

  1. Rectangular Cut
  2. Rectangular Copy
  3. Rectangular Paste
  4. Rectangular Delete
  5. Rectangular Clear
  6. Rectangular Replace

After installation the plug-in will add extra items under the Edit menu. Using the plug-in may seem a little strange at first since there is no built-in mechanism to make rectangular selections. The workaround is to make ordinary selections in a specific way that will be interpreted by the plug-in as a rectangular selection. As an example, consider the array defined below:

int dataTable[] = {
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9
};

1

Let's say you want to replace the "8,9" at the end of the last three rows with the "3,4" from the first row. First highlight your source data by selecting the corners of the data you wish to copy:

int dataTable[] = {
0,1,2,[[span class="highlight"]]3,4[[/span]],5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9
};

Type Ctrl-Alt-C to copy the data.

2

Next highlight the destination by selecting the corners of the target range. By corners I mean start the selection at the top left most item and end the selection at the bottom right most item. It will look like you are selecting multiple rows, but for this plug-in, it only cares about the starting and ending points (characters in red) - these define the bounds of the rectangle:

int dataTable[] = {
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,[[span class="highlight"]]##red|8##,9,[[/span]]
[[span class="highlight"]]0,1,2,3,4,5,6,7,8,9,[[/span]]
[[span class="highlight"]]0,1,2,3,4,5,6,7,8,##red|9##[[/span]]
};

3

Type Ctrl-Alt-V to paste and you will end up with:

int dataTable[] = {
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,##red|3,4##,
0,1,2,3,4,5,6,7,##red|3,4##,
0,1,2,3,4,5,6,7,##red|3,4##
};

A true, built-in rectangular selection/edit feature should be available when MPLAB X is migrated to the NetBeans 7.1 platform. Until then, this plug-in will perform the task adequately.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.