* * SPLITBLK.KEX * * Selectively split each line of the currently marked block just beyond a * specified column. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * parse arg col if col = "" then col = 80 else if datatype(col) \= "NUM" then do 'emsg SPLITBLK Error 1: Invalid column number "'col'"' exit 1 end if block.1() = "NONE" then do 'emsg SPLITBLK Error 2: You must mark a block first' exit 2 end if block.1() = "STREAM" then do 'emsg SPLITBLK Error 3: Only line and box blocks are supported' exit 3 end if block.6() \= fileid.1() then do 'emsg SPLITBLK Error 4: Marked block is not in the current file' exit 4 end * Preserve current SET options and turn off AUTOSAVE 'preserve' 'set autosave off' ResetBlock = 0 if version.1() = "KEDIT/WINDOWS" then do if block.7() = "SELECTION" then do ResetBlock = 1 "mark persistent" end end 'sos blockstart' * We'll actually split the line just after the specified column col = col + 1 * Remember if we're on the command line and then place the cursor in the text * area if command() then do OnCmdline = 1 'sos current' end else do OnCmdline = 0 'sos makecurr' end * Split each line of the file as many times as necessary do forever 'clocate :'col * Anything to the right of where we are? if after() then "down 1" * Hit the EOF yet? if \inblock() then leave 'split' 'down 1' end * Restore initial SET options 'restore' if OnCmdLine then "cursor cmdline" "sos blockstart" if ResetBlock then "reset block" exit 0