(*----------------------------------------------------------------------*)
(*               Clear_Window --- Clear out lines in window             *)
(*----------------------------------------------------------------------*)

PROCEDURE Clear_Window;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Procedure:  Clear_Window                                         *)
(*                                                                      *)
(*     Purpose:    Clears screen for current window                     *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Clear_Window                                                  *)
(*                                                                      *)
(*     Calls:   Upper_Left                                              *)
(*              GoToXY                                                  *)
(*              ClrEol                                                  *)
(*                                                                      *)
(*     Remarks:                                                         *)
(*                                                                      *)
(*       This routine exists because of a bug in the ClrScr routine     *)
(*       when used with windows on a mono monitor with overlays:  the   *)
(*       entire screen, not just the current window, is (incorrectly)   *)
(*       cleared.  There may be other circumstances in which ClrScr     *)
(*       will fail.                                                     *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

VAR
   Ytop: INTEGER;
   Xtop: INTEGER;
   Ybot: INTEGER;
   I   : INTEGER;

BEGIN (* Clear_Window *)

                   (*---------------------------------------*)
                   (*   If you have a color monitor, try    *)
                   (*   replacing the remaining code with   *)
                   (*   just ClrScr.  If it works, use it!  *)
                   (*---------------------------------------*)

   Upper_Left( Xtop, Ytop );
   Ybot := Lower_Right_Row;

   FOR I := 1 TO ( Ybot - Ytop + 1 ) DO
      BEGIN
         GoToXY( 1 , I );
         ClrEol;
      END;

   GoToXY( 1 , 1 );

END   (* Clear_Window *);
