//Word-txt.vdm // Formatting paragraphs consisting of on single long line (e.g. generated // by email programs). To reverse the process use txt-word.vdm. // Based on txt-word.vdm by Greenview Data // Fritz Heberlein (sla019@ku-eichstaett.de) // Last change: 10/11/02 // // Requires: VEDIT 5.00 or later. // // // Position the cursor in the paragraph to be converted. // // OR - Highlight a block of text; all paragraphs in the block // will be converted. // // Description: Reformats groups of paragraphs consisting of single long lines, // e.g. of documents imported from email programs. // Assumes that paragraphs are separated from each other by one or more blank // lines. // //////////////// // if (BB!=-1 && BE==-1) { BE(CP) } //Set 2nd marker if only 1st set if (BB==BE) { //If no block marked... Search("|N|[|W]|N",REVERSE+ADVANCE+NOERR) //Goto beginning of current paragraph if (Error_Match) { BOF } //Handle case at B-O-F BB(CP) //Set Block_Begin Search("|N|[|W]|N",ADVANCE+NOERR) //Goto end of current paragraph if (Error_Match) { EOF } //Handle case at E-O-F Match("|[|W]|N",ADVANCE+ALL) //Advance past all blank lines BE(CP) //Set Block_End } // // Normalize BB and BE. // if (BB > BE) { #103=BB BB(BE) BE(#103) } //Ensure BB < BE if ( Block_Mode==LINEBLOCK ) { //If Line block, include full lines Goto_Pos(BE) BE(EOL_POS) Goto_Pos(BB) BB(BOL_POS) } // Reformat // Goto_Pos(BB) //Goto beginning of block/paragraph #1=CP // Save block begin position repeat(ALL) { //Repeat until break-out Search("|[|W]|N",ERRBREAK) if (CP >= BE) { //If past/at end of block/paragraph... Goto_Pos(BE) //Goto end of block Break //Break-out } FP() //Format long line } BB(-1) //Remove block markers gotopos(#1) // Go to block begin