Workaround for "split" command (hangs in post import hook)

Answered by: Brent Hartwig Last Updated: 2006-09-22

package uOid; ... global WORKAROUND_ATI30960 = 1; ... # # # function split( workaroundATI30960 = uOid::WORKAROUND_ATI30960 ) {  if ( workaroundATI30960 ) {    local name = oid_name( oid_caret ); # Cut residual element content into paste buffer clear_mark all; mark -noinvert begin; goto_oid( oid_caret, -1 ); mark end; delete_mark bufSplitCmd; if ( main::status != 0 ) { return }; # Move past end tag forward_char( 1 ); if ( main::status != 0 ) { return }; # Create new element insert_tag $name; if ( main::status != 0 ) { return }; # Paste content paste bufSplitCmd; if ( main::status != 0 ) { return }; # Place caret at beginning of new tag goto_oid( oid_caret ); }  else {    split; } } (Editor's comment by Karl Johan Kleist: Note Brent's clever bookkeeping of workarounds, which makes it easy to find out if new Arbortext releases fixes known problems without monkeying around with the code.)
 * 1) Boolean to workaround Epic split command bug -- hangs during post import hook.
 * 2) ATI30960. As of 20041213, Arbortext suggested using "<?Pub Caret?>" vs.
 * 3) "<?Pub Caret1?>" within XML import templates. This worked for 1 file but not
 * 4) another. Leaving "<?Pub Caret?>" in templates but turning workaround on.
 * 1) This function's only reason for existence is to provide an alternative to
 * 2) Epic's split command -- WHICH HANGS EPIC WHEN EXECUTED WITHIN THE POST
 * 3) IMPORT HOOK! The preceding is true at least with Epic 4.4K (ATI30960). This
 * 4) function isolates the workaround. The function behaves similar to Epic's
 * 5) split command in the respect the caret must be in the correct spot in the
 * 6) current doc. Compare $main::status to know if a call to this function was
 * 7) successful.
 * 1) THIS WORKAROUND HAS A DRAWBACK: The oids of elements that end up being
 * 2) cut and pasted elsewhere are no longer valid.

Related content

How to prevent the "Modify Attributes" dialog when splitting an element?