SlickEdit has the ability to copy just the outer lines of a block statement to the clipboard. This feature is new in SlickEdit 2021.
Suppose you have an if statement like this, and you need the same logic in another spot:
if (autoUpdatePath != "") {
_xmlcfg_add_attribute(handle, newNode, "AutoUpdateFrom", autoUpdatePath);
}
Somewhere else:
mkdirhier(autoUpdatePath);
If you place your cursor on the "if" statement and hit Ctrl+C to copy (or whatever key you have for copy in your emulation), you will get a dialog like the one attached below. You can then select "Copy the surrounding statement" to copy just the if statement and it's closing brace to the clipboard. When you paste it above the "mkdirheir" line, you can then use Dynamic Surround to enclose the statement in the if block.
if (autoUpdatePath != "") {
}
mkdirhier(autoUpdatePath);
After hitting Cursor down in Dynamic Surround mode:
if (autoUpdatePath != "") {
mkdirhier(autoUpdatePath);
}
Or, if you do not use Dynamic Surround, you can use SmartPaste to move the "mkdirheir" statement into the if block.
if (autoUpdatePath != "") {
}
mkdirhier(autoUpdatePath);
Hit Ctrl+X to cut the mkdirheir statement.
Then move up within the if statement and hit Ctrl+V to paste. SlickEdit will correct the indentation for you (SmartPaste).
if (autoUpdatePath != "") {
mkdirhier(autoUpdatePath);
}