// // BOOKMARK.VDM Christian Ziemski // 21.01.2000 // // Makes it possible to save/restore the textmarkers of a vedit buffer. // // The textmarker positions are saved to a file .mrk where // is the actual filename of the buffer. // // Attention: This macro is coded quick and dirty within 30 minutes. // So there is no much error handling! // And the used registers are not saved/restored. // // // It is recommended to assign those two macros to two keys for easy usage. // // (Or maybe the file-close-event-macro and file-open-event-macro are a good // place for them. But that's not so easy to implement.) // //---------------------------------------------------------------------------- // 1.) Save the Text-Markers to a file // get the actual filename Out_Reg(99) Name_Write(EXTRA+NOMSG+NOCR) Out_Reg(CLEAR) // save the markers temporary #98=80 for(#99=0;#99<10;#99++){ #@98 = Marker(#99) #98++ } #98=Buf_Num //fill the bookmark file File_Open("|@(99).mrk") EoF Del_Block(0,Cur_Pos) for(#99=80;#99<90;#99++){ Num_Ins(#@99, LEFT+NOCR) IT(":") } File_Save() Buf_Close(NOMSG) Buf_Switch(#98) Return //----------------------------------------- // 2.) Restore the Markers from the bookmark file // get the actual filename Out_Reg(99) Name_Write(EXTRA+NOMSG+NOCR) Out_Reg(CLEAR) // get the markers from the bookmark file if (!File_Exist("|@(99).mrk")){ alert() return } #98=Buf_Num File_Open("|@(99).mrk") for(#99=80;#99<90;#99++){ #@99=Num_Eval(ADVANCE) Char(1) } Buf_Close(NOMSG) Buf_Switch(#98) // set the markers for the correct buffer #98=80 for(#99=0;#99<10;#99++){ Set_Marker(#99,#@98) #98++ } Return