// SEARCH116.VDM - Double click event macro for SEARCH.TMP // Load to text register 116, e.g. with command // Reg_Load(116,"search116.vdm",EXTRA) // // Usage: // 1. When viewing the search results of Wildfile Wizard (search.tmp): // - double-click on a line that contains searched text. The corresponding // file will be loaded and cursor is moved to that line. // // 2. When editing any other file: // - Double-click to highlight a word. // - Double-double-click to highlight entire line // - Press Shift key and double-click to highlight a paragraph // (requires Vedit 6.13 or later) // // by Pauli Lindgren // V1.0 06-Feb-2003 // V2.0 07-July-2004 - Mark entire line, mark paragraph Num_Push(80,82) // Save numeric registers used here #80 = Reg_Free() // #80 = T-Reg to hold filename/extension // Check filename to decide operation Reg_Set(#80,FILENAME) if (Reg_Compare(#80,"search.tmp") != 0) { // Wildfile Wizard search result? // not search.tmp, mark word as block, as usual #81 = 0 if (Version_Num > 612) { #81 = KeyShiftStatus } if (#81 & 2) { // Shift key pressed? BB(BOP_pos) BE(EOP_pos) // mark paragraph } else { // check if word already marked and cursor within the block (e.g. double-double click), if ((BB > BOL_pos) && (BB <= CP) && (BE >= CP)) { BB(BOL_pos) BE(EOL_pos) // mark entire line } else { Mark_Word() } } Goto END_MACRO } // Double-click handler for SEARCH.TMP BOL #81 = 1 #82 = CP Match("|W", ADVANCE) if (Match("|D") == 0) { // line number? #81 = Num_Eval(SUPPRESS) Search("|<|A", REVERSE) // find filename } Reg_Copy_Block(#80,CP,EOL_pos) // @#80 = filename Reg_Set(#80,`"`,INSERT) Reg_Set(#80,`"`,APPEND) GP(#82) // restore position in search.tmp File_Open(@#80,MRU) // open the file Goto_Line(#81) // go to line containing the match Update() :END_MACRO: Reg_Empty(#80) // Empty T-Regs Num_Pop(80,82) // Restore numeric regs Return