home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / w / w048 / 2.ddi / MSSRC.ARC / MSPROMPT.INC < prev    next >
Encoding:
Text File  |  1987-12-21  |  3.8 KB  |  132 lines

  1. {                           MSPROMPT.INC
  2.                                MS 4.0
  3.                 Copyright (c) 1985, 87 by Borland International, Inc.         }
  4.  
  5.   procedure EdUpdateCmdLine;
  6.     {-Update the top command line}
  7.  
  8.   begin                      {EdUpdateCmdLine}
  9.     if EdKeyInterrupt or Recurring then
  10.       Exit;
  11.     Move(PromptLine[1], Tline, PhyScrCols);
  12.     FillChar(Aline, PhyScrCols, ScreenAttr[CmdColor]);
  13.     EdWrline(PromptRow);
  14.   end;                       {EdUpdateCmdLine}
  15.  
  16.   procedure EdEraseMenuHelp;
  17.     {-Remove menu help from the prompt line}
  18.  
  19.   begin                      {EdEraseMenuHelp}
  20.     if EdKeyInterrupt or Recurring then
  21.       Exit;
  22.     if ShowMenuHelp then begin
  23.       FillChar(PromptLine[MenuHelpPos], Succ(PhyScrCols-MenuHelpPos), Blank);
  24.       EdUpdateCmdLine;
  25.     end;
  26.   end;                       {EdEraseMenuHelp}
  27.  
  28.   procedure EdShowMenuHelp;
  29.     {-Put the menu help into the prompt line}
  30.  
  31.   begin                      {EdShowMenuHelp}
  32.     if EdPtrIsNil(CurrMenu) and ShowMenuHelp then begin
  33.       Move(HelpPromptLine[1], PromptLine[1], PhyScrCols);
  34.       PromptCol := 1;
  35.       EdUpdateCmdLine;
  36.     end;
  37.   end;                       {EdShowMenuHelp}
  38.  
  39.   procedure EdAppPromptLine(S : VarString);
  40.     {-Append command name to prompt line}
  41.   var
  42.     Len : Integer;
  43.  
  44.   begin                      {EdAppPromptLine}
  45.     Len := Length(S);
  46.     if Len > 0 then begin
  47.       {Truncate if too long}
  48.       if PromptCol+Len > MaxPromptChars then
  49.         Len := Succ(MaxPromptChars-PromptCol);
  50.       Move(S[1], PromptLine[PromptCol], Len);
  51.       PromptCol := PromptCol+Len;
  52.       if not(SolidCursor) then
  53.         EdGotoxy(PromptCol, PromptRow);
  54.     end;
  55.   end;                       {EdAppPromptLine}
  56.  
  57.   procedure EdZapPromptLine;
  58.     {-Zap prompt line, leaving it blank}
  59.  
  60.   begin                      {EdZapPromptLine}
  61.     FillChar(PromptLine[1], MaxPromptChars, Blank);
  62.     {Reset the next column number}
  63.     PromptCol := 1;
  64.     UpdateCursor := True;
  65.   end;                       {EdZapPromptLine}
  66.  
  67.   procedure EdResetPromptLine;
  68.     {-Clear partial command indicator from command line}
  69.  
  70.   begin                      {EdResetPromptLine}
  71.     CmdPtr := 0;
  72.     EdZapPromptLine;
  73.     UpdateScreen := True;
  74.     UpdateCursor := True;
  75.   end;                       {EdResetPromptLine}
  76.  
  77.   procedure EdWritePromptLine(S : VarString);
  78.     {-Write a new message line to the screen}
  79.  
  80.   begin                      {EdWritePromptLine}
  81.     EdZapPromptLine;
  82.     EdAppPromptLine(S);
  83.     EdUpdateCmdLine;
  84.   end;                       {EdWritePromptLine}
  85.  
  86.   procedure EdForceMessage(msg : VarString);
  87.     {-Guarantee that a message is displayed}
  88.  
  89.   begin                      {EdForceMessage}
  90.     Intrflag := NoInterr;
  91.     EdWritePromptLine(msg);
  92.     Intrflag := Interr;
  93.   end;                       {EdForceMessage}
  94.  
  95.   procedure EdDisplayCommandBuffer;
  96.     {-Indicate that a partial command has been entered}
  97.   var
  98.     Cmd : VarString;
  99.     I : Integer;
  100.     Ch : Char;
  101.  
  102.   begin                      {EdDisplayCommandBuffer}
  103.     {Get out fast if other keys are waiting}
  104.     if (Circin = Circout) then begin
  105.       I := 1;
  106.       Cmd := '';
  107.       while I <= CmdPtr do begin
  108.         Ch := CmdBuf[I];
  109.         case Ch of
  110.           #0 :
  111.             begin
  112.               {Don't try to interpret extended keystrokes}
  113.               Inc(I);
  114.               Cmd := Cmd+'+';
  115.             end;
  116.           #1..#31 :
  117.             Cmd := Cmd+'^'+Chr(Ord(Ch)+64)
  118.         else
  119.           Cmd := Cmd+Ch;
  120.         end;
  121.         Inc(I);
  122.       end;
  123.       EdWritePromptLine(Cmd);
  124.     end;
  125.   end;                       {EdDisplayCommandBuffer}
  126.  
  127.   procedure EdWait;
  128.     {-Display a Wait signal}
  129.   begin                      {EdWait}
  130.     EdWritePromptLine(EdGetMessage(327));
  131.   end;                       {EdWait}
  132.