//---------------------------------------------------------------------------- // Display list of bookmarks in a window. Use cursor keys to select bookmark. // by Pauli Lindgren V1.1 24.05.1999 // // modified by Christian Ziemski 05.07.1999 // saving used registers // selecting unused marker with 0-9 behaves like ESC // position of window optimized // text of marker position modified // minor modifications //---------------------------------------------------------------------------- // Num_Push(80,88) // save numeric used registers CZ (add.) Reg_Push(90,90) // save used text register CZ (add.) #87=50 // width of list window CZ (add.) // Key_Purge() // clear keyboard buffer CZ (del.) #80 = Buf_Num // #80 = original edit buffer #85 = Cur_Pos // #85 = original edit position Win_Create(*,1,Win_Cols-#87-1,11,#87) // Create window CZ (horiz. pos.) Win_Switch(*) Win_Color(240) Win_Clear() Buf_Switch(#81=Buf_Free) Config(PG_E_SYNTAX,0,LOCAL) // disable syntax highlighting Win_Attach(*) // Attach special window // Buf_Empty(OK) CZ (del.) IT(" Select Bookmark: ") // // Display bookmarks: // Buf_Switch(#80) // switch to original buffer #82 = 0 for(#83=0;#83<10;#83++) { if(Marker(#83)!=-1) { // if marker in use Goto_Pos(Marker(#83)) // go to marker position #84 = Cur_Line // Reg_Copy(90,1) // copy line to text register 90 // CZ #88=EoL_Pos // CZ if((Cur_Pos+#87-10)<#88){ // text example max. to EoL // CZ #88=Cur_Pos+#87-10 // CZ } // CZ Reg_Copy_Block(90, Cur_Pos, #88) // CZ Buf_Switch(#81) // switch to marker list IC(#83+48) IC(32) // insert marker number Num_Ins(#84,NOCR) // insert line number IC(58) IC(32) // insert colon + space Reg_Ins(90) // insert the text block Ins_Newline(1) // CZ (add.) Buf_Switch(#80) // switch to original buffer #82++ // number of markers in list } } // // Select a bookmark from list: // Key_Purge() // clear keyboard buffer Buf_Switch(#81) // switch to marker list BOF Goto_Line(3) repeat (ALL) { // Loop until or Begin_Of_Line() #84 = Num_Eval(SUPPRESS) // #84 = marker number Block_Begin(Cur_Pos) Block_End(EOL_Pos) Begin_Of_Line() Update() // Highlight current occurrence line // CZ #88 -> #86 , Text modif. #86 = Get_Key("0-9 = Select+go, = Select, = Go, = jump, = Cancel",STATLINE) if ((#86>='0') && (#86 <='9')) { // Numeric key (0 to 9) #84 = #86 - '0' // go directly to specified marker Break // Break out of Repeat Loop } if (#86=='R'+'T'*256) { // Return Break // Break out of Repeat Loop } if (#86=='E'+'S'*256) { // Escape #84 = -1 // cancel (do not go to marker) CZ (99 -> -1) Break // Break out of Repeat Loop } if (#86=='C'+'D'*256) { // Cursor Down if (Cur_Line<#82+2) { Line(1,NOERR) } } if (#86=='C'+'U'*256) { // Cursor Up if (Cur_Line>3) { Line(-1,NOERR) } else {Set_Visual_Line(3)} // scroll back to top } if ((#86=='C'+'R'*256) || (#86=='C'+'L'*256)) { // Cursor Left/Right (PL) Buf_Switch(#80) // return to original buffer Goto_Pos(Marker(#84)) // go to selected bookmark Update() Buf_Switch(#81) // switch to marker list } } Buf_Quit(DELETE+OK) // close window Buf_Switch(#80) // return to original buffer BB(CLEAR) // remove block markers //if (#84 < 10 ) { // if ESC not pressed if (#84!=-1 && Marker(#84)!=-1) { // if ESC not pressed AND marker used CZ (mod.) Goto_Pos(Marker(#84)) // go to selected bookmark } else { Goto_Pos(#85) // go to original position } Reg_Pop(90,90) // restore text register CZ (add.) Num_Pop(80,88) // restore numeric registers CZ (add.)