From: "Wilson, Jim A, SITS" To: "'aurora-editor@sfu.ca'" Subject: LSTFILES Macro Date: Tue, 21 Oct 1997 12:07:52 -0400 X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.995.52 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable All; Okay, here's another (hopefully last!) version of that LSTFILES macro. This fixes one bug with the previous version, adds another argument and exposes what appears to be a bug in Auroras 'popup' function. The new argument is 'n', for numbers. When passed to LSTFILES it will display a numeric value in front of each file name. This gives you an alternative method for jumping to a specific file. Instead of typing the first few letters of the file name -- which is how it's done when you don't specify the 'n' argument -- you can just type in the files number. But, this is also where the problem lies... If the file is numbered from 1-9 then typing that number on the keyboard will place the highlight bar on the correct file name. However, if the number is greater than 10 (two digits long) then typing those two digits seems to _add_ them together, as opposed to taking them literally. For example, suppose you wanted to jump to file number 15. Typing a '1' and then a '5' should, in theory, position the highlight on the file with the number 15 proceeding it. Instead, the highlight gets positioned on the number 6 file (equivalent to saying '1 + 5 = 6'). Why this is occurring is a mystery to me. I haven't been able to determine how to turn this "feature" off either. I kinda doubt that quirk can be coded around so it may be there to stay (although, if anyone's got an idea how to get around it I'm all ears). One other thing: I had someone email me back and say that they got a bunch of capital A's with two dots over them in place of the horizontal lines where it says "(if? FullDisplay ('File Name ...". If that happens to you just replace them all with the character <196>, where the number 196 is typed on the keypad. Let me know if you have any other problems with this macro. Regards, Jim Wilson (jawilson@ix.netcom.com) /* ------------------------------------------------------------------ */ /* Macro: LSTFILES.AML */ /* Written by: Jim Wilson */ /* */ /* Description: Macro used to display a list of files being edited */ /* WITHOUT displaying the path before the file name. */ /* This makes jumping from one file to the next a */ /* matter of typing the first letter(s) of the actual */ /* file name, unlike the original Aurora 'filelist' */ /* function where the path name prevents you from doing */ /* that. */ /* */ /* Version: 1.0 -- 8/97 */ /* ----------- */ /* Initial version. */ /* */ /* 2.0 -- 10/97 */ /* ------------ */ /* Combined the original LSTFILE1 and LSTFILE2 into a */ /* a single program called LSTFILES. */ /* */ /* Modified the window title to show the total number */ /* of files being edited. */ /* */ /* Added a function that adjusts the window size if a */ /* lot of files are to be displayed in the popup. */ /* */ /* Added the 'f' argument (full) to display the path */ /* as well as the file name. */ /* */ /* Added the 'n' argument (numbers) to display a number */ /* before each file so you can use that to jump from */ /* one file to the next. */ /* */ /* ------------------------------------------------------------------ */ include bootpath "define.aml" Spaces = " " // used to pad output Options = arg 2 // grab any args passed PadWidth = 15 // space for file name BufferName = "LstFiles" // buffer name TotalFiles = 0 // total files being edited CurrentFile = getcurrbuf // save current file number if? (pos 'f' Options 'i') (FullDisplay = TRUE) (FullDisplay = FALSE) // setup for display window type if? (pos 'n' Options 'i') (ShowNumbers = TRUE) (ShowNumbers = FALSE) // setup for display of numbers while CurrentFile do FileName = upcase (getname (getbufname CurrentFile)) // grab just the file name PathName = upcase (getpath (getbufname CurrentFile)) // grab just the path name NumSpaces = PadWidth - length (FileName) // calculate number of spaces to pad display if FileName then TotalFiles = TotalFiles + 1 // add one to counter for # of files if? FullDisplay // setup filename for displaying (databuf BufferName ((if? ShowNumbers TotalFiles:2 '') + ' ' + FileName + Spaces[1..NumSpaces] + PathName) end) (databuf BufferName ((if? ShowNumbers TotalFiles:2 '') + ' ' + FileName) end) endif CurrentFile = getprevbuf CurrentFile // get next file name endwhile Selected = popup BufferName // setup title and window size (if? FullDisplay ('File Name ÄÄÄÄ Directory Name ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Files: ') ('Files: ')) + TotalFiles (if? FullDisplay (60) (15)) // popup window width (if? TotalFiles > (getvidrows)-8 (getvidrows)-8) // popup window height destroybuf BufferName // remove temp buffer if Selected then // TRUE if a file was chosen CurrentFile = getcurrbuf // grab current file again case ShowNumbers // find 1st char in file name when TRUE FirstChar = (pos '[0-9] ' Selected 'x') + 2 when FALSE FirstChar = (pos '^ .' Selected 'ix') + 1 endcase case FullDisplay // find last char in file name when TRUE LastChar = (pos ' ' Selected) - 1 when FALSE LastChar = length Selected endcase while CurrentFile do FileName = upcase (getname (getbufname CurrentFile)) // get a file name if FileName == Selected [FirstChar..LastChar] then // if it matches selected file.. open (getbufname CurrentFile) // ..jump to it endif CurrentFile = getprevbuf CurrentFile // ..else get next file name endwhile endif