// A simple pascal script to navigate to the previous 
// method in your source code.
// You can assign a keyboard shortcut to this script.
// E.g. Ctrl+Alt+Up

procedure GotoPreviousMethod;
begin
   if not Document.GotoPreviousMethod(False,True) then
   begin
      if MessageDlg('Could not find a method! Do you want to start again from the bottom?',mtInformation,mbYes or mbNo,0) = mrYes then
      begin
         Document.CursorDocEnd(False);
         Document.CursorX := 0;
         Document.GotoPreviousMethod(False,True);
      end; 
   end;  
end;

// Main function
begin
   GotoPreviousMethod; 
end.

