home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / MAPL0206.ZIP / ANSIED.MRG < prev    next >
Encoding:
Text File  |  1993-02-06  |  40.5 KB  |  1,221 lines

  1. * ------------[ BLED merge (c) Ken Goosens ]-------------
  2. * Merge this against E:\RBBS\STOCK\ANSIED.BAS to produce E:\RBBS\CHAT\ANSIED.BAS
  3. * E:\RBBS\STOCK\ANSIED.BAS:  Date 2-16-1991  Size 43992 bytes
  4. * ------------[ Created 02-06-1993 06:08:24 ]------------
  5. * REPLACING old line(s) by new
  6. * ------[ first line different ]------
  7. ' $linesize:132
  8. ' $title: 'ANSIED.BAS'
  9. '*
  10. '*  ANSIED v2.44a  by Tom Collins 
  11. '*---------------------------------------------------------------------------
  12. '*  Full Screen Text Editor for RBBS-PC
  13. '*  QuickBASIC v4.5 Version
  14. '*  02-16-91
  15. '*
  16. '*  v2.1xx ... made it work with RBBS v17
  17. '*  v2.2 ..... fixed some inconsistincies in the code as to # of lines in msg.
  18. '*             Some of the code thought 99 was length, some thought 100.
  19. '*  v2.3 ..... let it work with quoted reply.  No more REDIM of ZOutTxt$
  20. '*  v2.4 ..... removed tabs, margins code to be smaller
  21. '*  v2.41..... fixed bug with loss of bold attribute occasionally
  22. '*  v2.42..... made it work as a v17.3 subroutine.  Added block delete.
  23. '*  v2.43..... Added to: and from:.  Made cursor keys work locally.
  24. '*  v2.43a.... Stupid little bugs fixed
  25. '*  v2.44..... Fixed bugs, added ^T, Import, Subject, ASM functions
  26. '*  v2.44a.... Wordwrap/reflow bug fixed.  Arrows work in del.  Lines renum.
  27. '*
  28. '*  Returns:
  29. '*  ZSubParm  =  1 - Save Message
  30. '*            =  2 - Abort Message
  31. '*            = -1 - Dropped Carrier
  32. '*            = -2 - Sleep Disconnect
  33. '*
  34. '* Compile with:
  35. '*   BC C:\RBBSARCS\ANSIED.BAS /O/T/C:512;
  36. '*   
  37. '* Modifications to 2.44a by: Steve Stevens
  38. '* If you Like 'em let me know!
  39. '*       FIDONET 1:376/102                      RBBSNet 8:927/2
  40.  
  41.  
  42. * REPLACING old line(s) by new
  43. 110   CONST ESCKey = 27
  44.       CONST BackspKey = 8
  45.       CONST OtherBackspKey = 127
  46.       CONST CarrRet = 13
  47.       CONST WordLeftKey = 1          ' Ctrl-A
  48.       CONST ReformTextKey = 2        ' Ctrl-B
  49.       CONST PageDownKey = 3          ' Ctrl-C
  50.       CONST ColRightKey = 4          ' Ctrl-D
  51.       CONST LineUpKey = 5            ' Ctrl-E
  52.       CONST WordRightKey = 6         ' Ctrl-F
  53.       CONST CharDeleteKey = 7        ' Ctrl-G
  54. * ------[ first line different ]------
  55.       CONST TabKey = 9               ' Ctrl-I <- Tab Key Support
  56.       CONST HelpExpertKey = 10       ' Ctrl-J <- Turn Help Screen OFF
  57.       CONST EndSessionKey = 11       ' Ctrl-K
  58.       CONST HelpKey = 14             ' Ctrl-N
  59.       CONST ReflowTextKey = 15       ' Ctrl-O
  60.       CONST RepaintKey = 16          ' Ctrl-P
  61.       CONST PageUpKey = 18           ' Ctrl-R
  62.       CONST ColLeftKey = 19          ' Ctrl-S
  63.       CONST DeleteWordRightKey = 20  ' Ctrl-T
  64.       CONST ToggleINSKey = 22        ' Ctrl-V
  65.       CONST HomeKey = 23             ' Ctrl-W
  66.       CONST LineDownKey = 24         ' Ctrl-X
  67.       CONST LineDeleteKey = 25       ' Ctrl-Y
  68.       CONST EndKey = 26              ' Ctrl-Z
  69.  
  70.       CONST BlankLine$ = ""
  71. * REPLACING old line(s) by new
  72. 120   COMMON SHARED /Ansied/ CurrentRow, CurrentCol, TopLine
  73.       COMMON SHARED /Ansied/ OldColour, IsBold, InsertMode
  74.       COMMON SHARED /Ansied/ SoftSpace$
  75.       COMMON SHARED /Ansied/ BlockDelActive, MsgLockLines
  76.       COMMON SHARED /Ansied/ BlockLine1, BlockLine2
  77.       COMMON SHARED /Ansied/ MsgTo$, MsgSubj$
  78.  
  79. * ------[ first line different ]------
  80. ' $INCLUDE: 'RBBS-VAR.MOD'
  81.  
  82.       REDIM ZOutTxt$(99)     '<-- Needed to add this,
  83.       REDIM ZUserIn$(10)      '<-- And this for some strange reason.
  84.  
  85. '*  AnsiEd
  86. '*----------------------------------------------------------------------------
  87. '*  Main full-screen editor routine
  88. '*
  89. '*
  90.       SUB Ansied (T$, S$, L%) STATIC
  91.       '*
  92.       '* ZworkAra$() holds what's currently on the user's screen.
  93.       '* 24 Lines: ZWorkAra$(1) = Menu, Bottom Line = "Line 25"
  94.       '*
  95.  
  96. * REPLACING old line(s) by new
  97. * ------[ first line different ]------
  98. 500  REDIM ZWorkAra$(24)
  99.       '*
  100.       '* TopLine is the index into the ZOutTxt$() array that
  101.       '* corresponds to the top of the displayed image, i.e.
  102.       '* what's on line 3 of the user's screen.
  103.       '*
  104.       '*   1,12,23,34,45,56,78
  105.       '*
  106.       TopLine = 1
  107.       SoftSpace$ = CHR$(250)
  108.       InsertMode = ZTrue
  109.       ZLineFeed$ = CHR$(10)
  110.       BlockDelActive = ZFalse
  111.       HiLiteSave = ZHiLiteOff
  112.       ZHiLiteOff = ZFalse
  113.       UseTputSave = ZUseTput
  114.       ZUseTput = ZFalse
  115.       MsgLockLines = L%
  116.       MsgTo$ = T$
  117.       CALL NameCaps(MsgTo$)
  118.  
  119.       MsgSubj$ = S$
  120.       YY$ = ""
  121.       IF LEFT$(MsgSubj$, 3) = "(R)" THEN
  122.          YY$ = "(R)"
  123.          MsgSubj$ = MID$(MsgSubj$, 4)
  124.       END IF
  125.       CALL NameCaps(MsgSubj$)
  126.       MsgSubj$ = YY$ + MsgSubj$
  127.  
  128.       '*
  129.       '* Initialize the screen
  130.       '*
  131. * REPLACING old line(s) by new
  132. 510   CALL ClearScreen
  133.       CALL UpdateStatusLine(1)
  134. * ------[ first line different ]------
  135.       CALL DisplayKeys
  136.       CALL MoveCursor(3, 1)
  137.       '*
  138.       '* Remove ANSI sequences from the quoted lines
  139.       '*
  140.       IF ZLinesInMsg > 88 THEN
  141.          ZLinesInMsg = 88
  142.       END IF
  143.       IF ZMaxMsgLines > 98 THEN
  144.          ZMaxMsgLines = 98
  145.       END IF
  146.       IF ZLinesInMsg > ZMaxMsgLines THEN
  147.          ZLinesInMsg = ZMaxMsgLines
  148.       END IF
  149.       FOR I = ZLinesInMsg + 1 TO 99
  150.          ZOutTxt$(I) = BlankLine$
  151.       NEXT
  152.       IF ZLinesInMsg <> 0 THEN
  153.          FOR I = 1 TO ZLinesInMsg
  154.             CALL UnString(ZOutTxt$(I), "")
  155.          NEXT
  156.          J = ZLinesInMsg \ 11
  157.          IF ZLinesInMsg MOD 11 = 0 THEN
  158.            J = J - 1
  159.          END IF
  160.          TopLine = J * 11 + 1
  161.          J = ZLinesInMsg - TopLine
  162.          CALL MoveCursor(J + 5, 1)
  163.       END IF
  164.       CALL UpdateScreen
  165.       '*
  166.       '* Run the Editor
  167.       '*
  168. * REPLACING old line(s) by new
  169. 525      IF KeyPressed = ESCKey THEN            ' v2.44a
  170.             CALL GetChar(B$): GOSUB 740
  171.             IF B$ = "[" THEN                    ' ANSI sequence
  172.                CALL GetChar(B$): GOSUB 740
  173.                IF B$ = "C" THEN
  174.                   KeyPressed = ColRightKey
  175.                ELSEIF B$ = "D" THEN
  176.                   KeyPressed = ColLeftKey
  177.                ELSEIF B$ = "A" THEN
  178.                   KeyPressed = LineUpKey
  179.                ELSEIF B$ = "B" THEN
  180.                   KeyPressed = LineDownKey
  181.                END IF
  182.             END IF
  183.          END IF
  184.  
  185.          Index = CurrentRow + TopLine - 3
  186.  
  187. * ------[ first line different ]------
  188.         IF BlockDelActive OR Index <= MsgLockLines OR Index > ZMaxMsgLines THEN
  189. * REPLACING old line(s) by new
  190. 540            CASE ESCKey
  191.                   IF BlockDelActive THEN
  192.                      BlockDelActive = ZFalse
  193. * ------[ first line different ]------
  194.                      CALL ClearScreen        ' <-- Added when user cancells
  195.                      CALL UpdateScreen       ' Block Delete the "highlighted"
  196.                      CALL UpdateStatusLine(1)
  197. '                     CALL UpdateStatusLine(2)
  198.                      CALL MoveCursor(BlockRow, BlockCol)
  199.                      KeyPressed = 255
  200.                   END IF
  201.  
  202.                CASE LineUpKey, LineDownKey, PageDownKey, PageUpKey, TabKey
  203.                   '*
  204.                   '* Up and Down get passed on
  205.                   '*
  206.                CASE ELSE
  207.                   '*
  208.                   '* Ignore the key
  209.                   '*
  210.                   KeyPressed = 255
  211.  
  212.             END SELECT
  213.          END IF
  214.  
  215. * REPLACING old line(s) by new
  216. 560      SELECT CASE KeyPressed
  217. * ------[ first line different ]------
  218.             CASE ESCKey,EndSessionKey    'Pe 03/17/92
  219.                '*
  220.                '* User wants to see main menu
  221.                '*
  222.                CALL DisplayMainMenu
  223.                CALL MoveCursor(RowSave, ColSave)
  224.                CALL GetChar(B$): GOSUB 740
  225.                CALL AllCaps(B$)                                        'RT062992
  226.                IF B$ = "D" THEN
  227.                   BlockDelActive = ZTrue
  228.                   BlockLine1 = RowSave + TopLine - 3
  229.                   BlockCol = ColSave
  230.                   BlockRow = RowSave
  231.                   CALL EraseToEOL(1, 1)                  ' v2.44a
  232.                   CALL PutScreen("Delete Block: Press ENTER on Last Line to Delete, or ESC Twice to Quit", DefaultColor, DefaultBold)
  233.                   BlockLine2 = 0
  234.   CALL MoveCursor(RowSave, 1)                                'SM070501
  235.    Index = (RowSave) + (Topline - 3)
  236.     CALL Putscreen(ZOutTxt$(Index),RedFore,ZFalse)
  237.                ELSE
  238.                   CALL MenuCommand(B$): GOSUB 740
  239.                END IF
  240.      CALL MoveCursor(RowSave, ColSave)
  241.  
  242. * REPLACING old line(s) by new
  243. 570         CASE LineUpKey
  244.                '*
  245.                '* Move the current cursor position up one line
  246.                '*
  247.                IF CurrentRow > 3 THEN
  248.                   CALL MoveCursor(CurrentRow - 1, CurrentCol)
  249.                ELSE
  250.                   IF TopLine <> 1 THEN
  251.                      TopLine = TopLine - 11
  252.                      CALL MoveCursor(CurrentRow + 10, CurrentCol)
  253.                      CALL UpdateScreen
  254.                   END IF
  255.                END IF
  256. * ------[ first line different ]------
  257. '*
  258. '* Un-Highlights lines to be deleted
  259. '* Steve
  260. IF BlockDelActive THEN
  261.  CALL SaveCursor(SaveRow, SaveCol)  'Pe0124
  262.   Index = (CurrentRow + 1) + (Topline - 3)
  263.     CALL MoveCursor(CurrentRow,1)                            'SM070501
  264.     CALL Putscreen(ZOutTxt$(Index), YellowFore,ZTrue)
  265.      CALL MoveCursor(SaveRow, SaveCol)
  266. END IF
  267.  
  268. * REPLACING old line(s) by new
  269. 580         CASE LineDownKey
  270.                '*
  271.                '* Move the current cursor position down one line
  272.                '*
  273. * ------[ first line different ]------
  274.                IF ZExpertUser THEN PE = 23 _
  275.                  Else PE = 19
  276.                IF CurrentRow < PE THEN
  277.                   CALL MoveCursor(CurrentRow + 1, CurrentCol)
  278.                ELSEIF BlockDelActive THEN
  279.                 CALL PutScreen(CHR$(7),RedFore,ZFalse)
  280.                ELSE
  281.                   IF NOT TopLine = 78 THEN
  282.                      TopLine = TopLine + 11
  283.                      CALL MoveCursor(CurrentRow - 10, CurrentCol)
  284.                      CALL UpdateScreen
  285.                   END IF
  286.                END IF
  287. '*
  288. '* Highlight lines to be delete
  289. '*        Steve
  290. IF BlockDelActive THEN
  291.    Index = (CurrentRow) + (Topline - 3)
  292.       CALL Putscreen(ZOutTxt$(Index),RedFore,ZFalse)
  293.        CALL MoveCursor(CurrentRow, 1)
  294. END IF
  295. * INSERTING new line(s)
  296. 595         CASE TabKey    ' <- Tab Key Support here..
  297.                '*
  298.                '* Tab 8 Spaces
  299.                '*
  300.                IF CurrentCol < 72 THEN
  301.                 CALL MoveCursor(CurrentRow, CurrentCol + 8)
  302.                END IF
  303.  
  304. * REPLACING old line(s) by new
  305. * ------[ first line different ]------
  306. 710         CASE HelpKey,HelpExpertKey,ReformTextKey, ReflowTextKey, ToggleINSKey, RepaintKey
  307.                '*
  308.                '* Execute a main menu command
  309.                '*
  310.                '*          1234567890123456789012
  311.                YY$ = MID$(" J       N   HRP     I", KeyPressed, 1)
  312.                CALL MenuCommand(YY$): GOSUB 740
  313.                CALL MoveCursor(RowSave, ColSave)
  314.             CASE IS > 127, IS < 32
  315.                '*
  316.                '* Ignore characters above 127 or below 32
  317.                '*
  318. * REPLACING old line(s) by new
  319. 730   REDIM ZWorkAra$(13)
  320.       ZHiLiteOff = HiLiteSave
  321.       ZUseTput = UseTputSave
  322. * ------[ first line different ]------
  323.       S$ = MsgSubj$                                                   'RT062992
  324.       CALL AllCaps(S$)                                                'RT062992
  325.       EXIT SUB
  326.  
  327.       '*
  328.       '* Test ZSubParm and Exit ANSIED if the carrier dropped
  329.       '*
  330. * REPLACING old line(s) by new
  331. 740   IF ZSubParm <> 0 THEN
  332.          GOTO 730
  333.       END IF
  334.       RETURN
  335.  
  336.       END SUB         ' Sub AnsiEd
  337.  
  338. '*  BackspChar()
  339. '*----------------------------------------------------------------------------
  340. '*  This routine handles the user entering the backspace key
  341. '*
  342. '*
  343. * ------[ first line different ]------
  344.       SUB BackspChar STATIC
  345. * REPLACING old line(s) by new
  346. 1230     ELSE
  347.             CALL FindWrap(LEFT$(ZOutTxt$(Index - 1), ZRightMargin + 1), I)
  348.             IF I <= 1 THEN
  349.                I = ZRightMargin
  350.             END IF
  351.             ZOutTxt$(Index) = MID$(ZOutTxt$(Index - 1), I + 1)
  352.             ZOutTxt$(Index - 1) = LEFT$(ZOutTxt$(Index - 1), I)
  353.          END IF
  354.          IF RowSave > 3 THEN
  355.             CALL MoveCursor(RowSave - 1, NewCol)
  356.             CALL UpdateScreen
  357.          ELSE
  358.             CALL MoveCursor(RowSave, NewCol)
  359.             CALL UnGetChar(LineUpKey)
  360.          END IF
  361.       END IF
  362.       END SUB
  363.  
  364. '*  CarrRetKey()
  365. '*----------------------------------------------------------------------------
  366. '*  This routine handles carriage returns entered in the file
  367. '*
  368. '*
  369. * ------[ first line different ]------
  370.       SUB CarrRetKey STATIC
  371. * REPLACING old line(s) by new
  372. 1300  Index = CurrentRow + TopLine - 3
  373.       IF Index >= 99 THEN
  374.          EXIT SUB
  375.       END IF
  376.       IF InsertMode THEN         ' Insert a new line
  377.          FOR I = 98 TO Index + 1 STEP -1
  378.             ZOutTxt$(I + 1) = ZOutTxt$(I)
  379.          NEXT I
  380.          IF LEN(ZOutTxt$(Index)) >= CurrentCol THEN
  381.             ZOutTxt$(Index + 1) = MID$(ZOutTxt$(Index), CurrentCol)
  382.             ZOutTxt$(Index) = LEFT$(ZOutTxt$(Index), CurrentCol - 1)
  383.          ELSE
  384.             ZOutTxt$(Index + 1) = BlankLine$
  385.          END IF
  386.          CALL UpdateScreen
  387. * ------[ first line different ]------
  388. END IF
  389.  
  390. IF ZExpertUser THEN PE = 23 _
  391.    Else PE = 19
  392.      IF CurrentRow < PE THEN
  393.         CALL MoveCursor(CurrentRow + 1, 1)
  394.      ELSE
  395.          CALL MoveCursor(CurrentRow,1)
  396.          CALL UnGetChar(LineDownKey)
  397.      END IF
  398.       END SUB
  399.  
  400. '*  ChangeSubject()
  401. '*----------------------------------------------------------------------------
  402. '*  Routine to allow user to change the message subject
  403. '*
  404. '*
  405.       SUB ChangeSubject STATIC
  406.       CALL GetString("Change Subject From '" + MsgSubj$ + "' To? ", NewSubj$)
  407.       IF NewSubj$ <> "" THEN
  408.          MsgSubj$ = LEFT$(NewSubj$, 25)
  409.          CALL NameCaps(MsgSubj$)
  410.       END IF
  411.       END SUB
  412.  
  413. '*  ClearScreen()
  414. '*----------------------------------------------------------------------------
  415. '*  This routine clears the screen and moves the cursor to row 2, col 1
  416. '*
  417. '*
  418.       SUB ClearScreen STATIC
  419. * REPLACING old line(s) by new
  420. * ------[ first line different ]------
  421. 1500 IF ZExpertUser THEN PE = 23 _
  422.    Else PE = 19
  423.       FOR I = 1 TO PE
  424.          ZWorkAra$(I) = BlankLine$
  425.       NEXT I
  426.       CALL QuickTput("", 0)
  427.       ZSubParm = 2
  428.       CALL Line25
  429.       ZSubParm = 0
  430.       CALL QuickTput("H" + ZEmphasizeOff$, 0)
  431.       CurrentCol = 1
  432.       CurrentRow = 4
  433.       IsBold = DefaultBold
  434.       OldColour = DefaultColor
  435.       END SUB
  436.  
  437. '*  DeleteCurrentLine()
  438. '*----------------------------------------------------------------------------
  439. '*  This routine deletes the current line on the screen and in the array
  440. '*  ZOutTxt$, and moves the next lower line up one  It then repaints the
  441. '*  affected portion of the screen (from the deleted line down)
  442. '*
  443. '*
  444.       SUB DeleteCurrentLine (Index%) STATIC
  445. * REPLACING old line(s) by new
  446. 1600  FOR I = Index% TO 98
  447.          ZOutTxt$(I) = ZOutTxt$(I + 1)
  448.       NEXT I
  449.       ZOutTxt$(99) = BlankLine$
  450.       CALL UpdateScreen
  451.       END SUB
  452.  
  453. '*  DisplayMainMenu()
  454. '*----------------------------------------------------------------------------
  455. '*  This routine displays the main menu on the top line
  456. '*
  457. '*
  458. * ------[ first line different ]------
  459.       SUB DisplayMainMenu STATIC
  460. * REPLACING old line(s) by new
  461. 1700  CALL MoveCursor(1, 1)
  462.       YY$ = "A)bort H)elp D)elete I)ns/ovw J)ustify "
  463.       IF ZLocalUser OR ZSysop THEN
  464.          YY$ = YY$ + "O)import R)eflow P)aint S)ave U)subject "
  465.       ELSE
  466.          YY$ = YY$ + "R)eflow P)aint S)ave U)subject          "
  467.       END IF
  468.       CALL ColorPrompt(YY$)
  469.       CALL PutScreen(YY$, DefaultColor, DefaultBold)
  470.       END SUB
  471.  
  472. '*  DoneWithMsg()
  473. '*----------------------------------------------------------------------------
  474. '*  This routine is called to save or abort the message
  475. '*
  476. '*
  477. * ------[ first line different ]------
  478.       SUB DoneWithMsg (YY$) STATIC
  479. * REPLACING old line(s) by new
  480. 1810  SELECT CASE YY$
  481.          CASE "S"        ' Save Message
  482.             '*
  483.             '* Remove trailing blank lines from the message
  484.             '*
  485.             CALL FindEndOfMsg(EndOfMsg)
  486.             FOR I = 1 TO EndOfMsg
  487.                J = INSTR(ZOutTxt$(I), SoftSpace$)
  488.                WHILE J <> 0
  489.                   MID$(ZOutTxt$(I), J, 1) = " "
  490.                   J = INSTR(ZOutTxt$(I), SoftSpace$)
  491.                WEND
  492.                CALL TrimTrail(ZOutTxt$(I), " ")
  493.             NEXT I
  494.             CALL FindEndOfMsg(ZLinesInMsg)
  495. * ------[ first line different ]------
  496.              CALL EraseToEOL(1, 1)
  497.               CALL MoveCursor(1, 1)
  498.       CALL PutScreen(" ", DefaultColor, DefaultBold)
  499.       CALL ClearScreen                 'Pe 03/15/92
  500.                ZSubParm = 1
  501.  
  502. * REPLACING old line(s) by new
  503. 1820     CASE "A"
  504.             CALL EraseToEOL(1, 1)
  505.             YY$ = "Abort: Are You Sure (Y)es,[N]o)? "
  506.             CALL ColorPrompt(YY$)
  507.             CALL PutScreen(YY$, DefaultColor, DefaultBold)
  508.             CALL GetChar(B$)
  509.             IF ZSubParm <> 0 THEN
  510.                B$ = "Y"
  511.             END IF
  512. * ------[ first line different ]------
  513.             CALL AllCaps(B$)                                           'RT062992
  514.             IF B$ = "Y" THEN                                           'RT062992
  515.                CALL ClearScreen
  516.                ZSubParm = 2
  517.             END IF
  518.  
  519.       CASE ELSE
  520.  
  521.       END SELECT
  522.       END SUB
  523.  
  524. '*  EraseToEOL()
  525. '*----------------------------------------------------------------------------
  526. '*  This routine clears from a position to to the end of that line
  527. '*
  528. '*
  529.       SUB EraseToEOL (LineNumber, ColNumber) STATIC
  530. * REPLACING old line(s) by new
  531. 1900  CALL MoveCursor(LineNumber, ColNumber)
  532.       CALL QuickTput("", 0)
  533.       END SUB
  534.  
  535. '*  FindEndOfMsg()
  536. '*----------------------------------------------------------------------------
  537. '*  Finds the last active line in the message
  538. '*
  539. '*
  540. * ------[ first line different ]------
  541.       SUB FindEndOfMsg (EndOfMsg) STATIC
  542.       EndOfMsg = 1
  543.       FOR I = ZMaxMsgLines TO 1 STEP -1
  544.          IF ZOutTxt$(I) <> BlankLine$ OR I <= MsgLockLines THEN
  545.             EndOfMsg = I
  546.             EXIT FOR
  547.          END IF
  548.       NEXT I
  549.       END SUB
  550.  
  551. '*  FindWrap()
  552. '*----------------------------------------------------------------------------
  553. '*  This routine finds a place in the string yy$ that could be used as a
  554. '*  place to wrap the line WhereToWrap should be the last position that
  555. '*  remains in the line, ie
  556. '*    set   currentline$ = left$(yy$,wheretowrap)
  557. '*          nextline$    = mid$ (yy$,wheretowrap+1)
  558. '*
  559. '*
  560.       SUB FindWrap (YY$, WhereToWrap) STATIC
  561. * REPLACING old line(s) by new
  562. 2100  WhereToWrap = LEN(YY$) + 1
  563.       CALL FindWord(YY$, 0, WhereToWrap)
  564.       WhereToWrap = WhereToWrap - 1
  565.       END SUB
  566.  
  567. '*  GetChar()
  568. '*----------------------------------------------------------------------------
  569. '*  This routine reads a character from the user into YY$
  570. '*
  571. '*
  572. * ------[ first line different ]------
  573.       SUB GetChar (YY$) STATIC
  574. * REPLACING old line(s) by new
  575. 2200  ZAutoLogoff! = TIMER + ZWaitBeforeDisconnect
  576.       CALL Carrier
  577.       YY$ = ""
  578.       WHILE ZSubParm <> -1 AND ZSubParm <> -2 AND YY$ = ""
  579.          ZSubParm = 0
  580.          IF LEN(ZCommportStack$) > 0 THEN
  581.             YY$ = LEFT$(ZCommportStack$, 1)
  582.             ZCommportStack$ = MID$(ZCommportStack$, 2)
  583.          ELSE
  584.             IF ZLocalUser THEN
  585.                YY$ = INKEY$
  586.                IF LEN(YY$) = 2 THEN
  587.                   KeyPressed = ASC(RIGHT$(YY$, 1))
  588.                   YY$ = ""
  589.                   SELECT CASE KeyPressed
  590.                      CASE 82                  ' Insert
  591.                         KeyPressed = ToggleINSKey
  592.                      CASE 83                  ' Delete
  593.                         KeyPressed = CharDeleteKey
  594.                      CASE 71                  ' Home
  595.                         KeyPressed = HomeKey
  596.                      CASE 73                  ' PgUp
  597.                         KeyPressed = PageUpKey
  598.                      CASE 72                  ' Up Arrow
  599.                         KeyPressed = LineUpKey
  600.                      CASE 80                  ' Down Arrow
  601.                         KeyPressed = LineDownKey
  602.                      CASE 81                  ' PgDn
  603.                         KeyPressed = PageDownKey
  604.                      CASE 75                  ' Left Arrow
  605.                         KeyPressed = ColLeftKey
  606.                      CASE 77                  ' Right Arrow
  607.                         KeyPressed = ColRightKey
  608.                      CASE 115                 ' Ctrl-Left Arrow
  609.                         KeyPressed = WordLeftKey
  610.                      CASE 116                 ' Ctrl-Right Arrow
  611.                         KeyPressed = WordRightKey
  612.                      CASE 79                  ' End
  613.                         KeyPressed = EndKey
  614. * ------[ first line different ]------
  615.                      CASE 9
  616.                         KeyPressed = TabKey
  617.                      CASE ELSE
  618.                         KeyPressed = 0
  619.                   END SELECT
  620.                   IF KeyPressed <> 0 THEN
  621.                      YY$ = CHR$(KeyPressed)
  622.                   END IF
  623.                END IF
  624.             ELSE
  625.                CALL FindFKey
  626.                IF ZSubParm >= 0 THEN
  627.                   YY$ = ZKeyPressed$
  628.                   IF YY$ = "" THEN
  629.                      CALL EofComm(Char%)
  630.                      IF Char% = -1 THEN
  631.                         CALL CheckTime(ZAutoLogoff!, Remain!, 1)
  632.                         IF Remain! < 0 THEN
  633.                            CALL UpdtCalr("Sleep disconnect", 1)
  634.                            ZSubParm = -2
  635.                            ZNo = ZTrue
  636.                            ZSleepDisconnect = ZTrue
  637.                         END IF
  638.                      ELSE
  639.                         CALL Carrier
  640.                         IF ZSubParm <> -1 THEN
  641.                            ZSubParm = 0
  642.                            CALL GetCom(YY$)
  643.                         END IF
  644.                      END IF
  645.                   END IF
  646.                END IF
  647.             END IF
  648.          END IF
  649.       WEND
  650.       END SUB
  651.  
  652. '*  GetString()
  653. '*----------------------------------------------------------------------------
  654. '*  Gets a string from the user
  655. '*
  656. '*
  657.       SUB GetString (Prompt$, YY$) STATIC
  658.       YY$ = ""
  659.       CALL EraseToEOL(1, 1)
  660.       CALL PutScreen(Prompt$, DefaultColor, DefaultBold)
  661.       NewCol = CurrentCol
  662.       InitCol = NewCol
  663.       DO
  664.          CALL MoveCursor(CurrentRow, NewCol)
  665.          CALL GetChar(B$)
  666.          IF ZSubParm <> 0 THEN
  667.             B$ = CHR$(ESCKey)
  668.          END IF
  669.          KeyPressed = ASC(B$)
  670.          SELECT CASE KeyPressed
  671.             CASE BackspKey, OtherBackspKey
  672.                IF NewCol <> InitCol THEN
  673.                   CALL MoveCursor(CurrentRow, NewCol - 1)
  674.                   CALL PutScreen(" ", DefaultColor, DefaultBold)
  675.                   NewCol = NewCol - 1
  676.                   YY$ = LEFT$(YY$, LEN(YY$) - 1)
  677.                END IF
  678.             CASE CarrRet
  679.                EXIT DO
  680.             CASE ESCKey
  681.                YY$ = ""
  682.                EXIT DO
  683.             CASE ELSE
  684.                YY$ = YY$ + B$
  685.                CALL PutScreen(B$, DefaultColor, DefaultBold)
  686.                NewCol = NewCol + 1
  687.          END SELECT
  688.       LOOP WHILE 1
  689.       END SUB
  690.  
  691. '*  HelpMe()
  692. '*----------------------------------------------------------------------------
  693. '*  This routine provides on-line help for the user
  694. '*
  695. '*
  696.       SUB HelpMe STATIC
  697. * REPLACING old line(s) by new
  698. 2300  CALL SaveCursor(RowSave, ColSave)
  699. * ------[ first line different ]------
  700.      SaveXpertUser = ZExpertUser
  701.      ZExpertUser = ZFalse
  702. CALL DisplayKeys
  703.      ' CALL ClearScreen
  704.      ' CALL BufFile(ZHelpPath$ + "ANSIED" + ZHelpExtension$, X)
  705.      '      CALL ClearScreen
  706. ZExpertUser = SaveXpertUser
  707.       CALL UpdateScreen
  708.       CALL MoveCursor(RowSave, ColSave)
  709.       END SUB
  710.  
  711. '*  ImportFile()
  712. '*----------------------------------------------------------------------------
  713. '*  Imports an ASCII text file in the message
  714. '*
  715. '*
  716.       SUB ImportFile STATIC
  717.       IF ZLocalUser OR ZSysop THEN
  718.          CALL GetString("Import What File? ", FileName$)
  719.          IF FileName$ <> "" THEN
  720.             CALL FindIt(FileName$)
  721.             IF ZOK THEN
  722.                ZUserIn$(1) = FileName$
  723.                ZAnsIndex = 0
  724.                ZLastIndex = 1
  725.                CALL FindEndOfMsg(EndOfMsg)
  726.                CALL MsgImport(ZMaxMsgLines, ZRightMargin, EndOfMsg, ZOutTxt$())
  727.          J = EndOfMsg \ 11
  728.          IF EndOfMsg MOD 11 = 0 THEN
  729.            J = J - 1
  730.          END IF
  731.           TopLine = J * 11 + 1
  732.            J = EndOfMsg - TopLine
  733.           CALL MoveCursor(J + 5, 1)
  734.          CALL UpdateScreen
  735.             END IF
  736.          END IF
  737.       END IF
  738.       END SUB
  739.  
  740. '*  LastParaLine()
  741. '*----------------------------------------------------------------------------
  742. '*  This routine returns ZTrue if ZOutTxt$(I) is the last line
  743. '*  in a paragraph
  744. '*
  745. '*
  746.       SUB LastParaLine (I, LastLine, Result) STATIC
  747. * REPLACING old line(s) by new
  748. 2400  Result = ZFalse
  749.       IF I = LastLine OR I >= ZMaxMsgLines THEN
  750.          Result = ZTrue
  751.       ELSE
  752.          YY$ = ZOutTxt$(I)
  753.          J = INSTR(YY$, ">")
  754.          IF J = 0 THEN
  755.             J = 6
  756.          END IF
  757.          IF J < 5 THEN
  758.             Result = ZTrue
  759.          ELSEIF YY$ = BlankLine$ THEN
  760.             Result = ZTrue
  761.          ELSE
  762.             IF ZOutTxt$(I + 1) = BlankLine$ THEN
  763.                Result = ZTrue
  764.             ELSEIF LEFT$(ZOutTxt$(I + 1), 1) = " " THEN
  765.                Result = ZTrue
  766.             ELSE
  767.                K = INSTR(ZOutTxt$(I + 1), ">")
  768.                IF K <> 0 AND K < 5 THEN
  769.                   Result = ZTrue
  770.                END IF
  771.             END IF
  772.          END IF
  773.       END IF
  774.       END SUB
  775.  
  776. '*  MenuCommand()
  777. '*----------------------------------------------------------------------------
  778. '* This routine executes the passed main menu command
  779. '*
  780. '*
  781. * ------[ first line different ]------
  782.       SUB MenuCommand (YY$) STATIC
  783. * REPLACING old line(s) by new
  784. 2450  ZSubParm = 0              ' v2.44a
  785.       SELECT CASE YY$
  786. * ------[ first line different ]------
  787. '         CASE "+"
  788. '         CASE "-"
  789.          CASE "H"
  790.             CALL HelpMe
  791.             CALL DisPlayKeys       'Pe 03/17/92
  792.          CASE "N"
  793.             CALL ClearScreen
  794.             CALL UpdateScreen
  795.          CASE "S", "A"
  796.             CALL DoneWithMsg(YY$)
  797.          CASE "P"
  798.             CALL ClearScreen
  799.             CALL DisplayKeys
  800.             CALL UpdateScreen
  801.          CASE "I"
  802.             InsertMode = NOT InsertMode
  803.          CASE "R"
  804.             CALL ReformText(ZFalse)
  805.          CASE "J"
  806.             CALL ReformText(ZTrue)
  807.          CASE "O"
  808.             CALL ImportFile
  809.          CASE "U"
  810.             CALL ChangeSubject
  811.       Case Else                       'HP072501
  812.       END SELECT
  813.       IF ZSubParm = 0 THEN
  814.          CALL EraseToEOL(1, 1)
  815.          CALL UpdateStatusLine(1)
  816.       END IF
  817.       END SUB
  818.  
  819. '*  MoveCursor()
  820. '*----------------------------------------------------------------------------
  821. '*  This routine moves the cursor to the position spec'd by newcol and
  822. '*  newrow and tries to do it with the minimum number of Ansi characters
  823. '*
  824. '*
  825.       SUB MoveCursor (NewRow, NewCol) STATIC
  826. * REPLACING old line(s) by new
  827. 2500  YY$ = "        "
  828.       CALL MoveCurStr(CurrentRow, CurrentCol, NewRow, NewCol, YY$, YLen)
  829.       IF YLen <> 0 THEN
  830.          YY$ = LEFT$(YY$, YLen)
  831.          CALL QuickTput(YY$, 0)
  832.       END IF
  833.       ZSubParm = 0
  834.       END SUB
  835.  
  836. '*  NormalChar()
  837. '*----------------------------------------------------------------------------
  838. '*  This routine handles 'normal' characters entered into the message
  839. '*
  840. '*
  841. * ------[ first line different ]------
  842.       SUB NormalChar (YY$) STATIC
  843.  
  844. * REPLACING old line(s) by new
  845. 2630  ELSE
  846.          '*
  847.          '* Wrap the end of the line
  848.          '*
  849.          IF NOT AtEndOfLine THEN
  850.             ZOutTxt$(Index) = LEFT$(ZOutTxt$(Index), CurrentCol - 1) + YY$ + MID$(ZOutTxt$(Index), CurrentCol)
  851.             LML = LML + 1
  852.          ELSE
  853.             MID$(ZOutTxt$(Index), CurrentCol, 1) = YY$
  854.          END IF
  855.  
  856.          CALL FindWrap(ZOutTxt$(Index), I)
  857.          IF I <= 1 THEN
  858.             I = ZRightMargin
  859.          END IF
  860.  
  861.          ZZ$ = MID$(ZOutTxt$(Index), (I + 1))
  862.          CALL TrimTrail(ZZ$, SoftSpace$)
  863.          ZOutTxt$(Index) = LEFT$(ZOutTxt$(Index), I)
  864.          '*
  865.          '* Add to the beginning of a new line
  866.          '*
  867.          IF Index <= 98 THEN
  868.             Index = Index + 1
  869.          END IF
  870.  
  871.          Z = INSTR(ZOutTxt$(Index), ">")                                                  ' v2.44a
  872.          IF ZOutTxt$(Index) <> BlankLine$ AND (Z <= 0 OR Z > 6) AND LEN(ZOutTxt$(Index)) + LEN(ZZ$) < ZRightMargin THEN
  873.             ZOutTxt$(Index) = ZZ$ + ZOutTxt$(Index)
  874.          ELSE
  875.             FOR J = 98 TO Index STEP -1
  876.                ZOutTxt$(J + 1) = ZOutTxt$(J)
  877.             NEXT J
  878.             ZOutTxt$(Index) = ZZ$
  879.          END IF
  880.  
  881.          CALL EraseToEOL(CurrentRow, I + 1)        ' do the "easy" line
  882.          ZWorkAra$(CurrentRow) = ZOutTxt$(Index)
  883.  
  884.          CALL UpdateScreen
  885.          IF (ColSave > I) THEN
  886.             NewCol = ColSave - I + 1
  887. * ------[ first line different ]------
  888.         IF ZExpertUser THEN PE = 23 _
  889.             Else PE = 19
  890.             IF RowSave <> PE THEN
  891.                CALL MoveCursor(RowSave + 1, NewCol)
  892.             ELSE
  893.                CALL MoveCursor(RowSave, NewCol)
  894.                CALL UnGetChar(LineDownKey)
  895.             END IF
  896.          ELSE
  897.             CALL MoveCursor(RowSave, ColSave + 1)
  898.          END IF
  899.       END IF
  900.       END SUB
  901.  
  902. '*  PutScreen()
  903. '*----------------------------------------------------------------------------
  904. '* This routine writes YY$ to the user in the color and
  905. '* intensity specified
  906. '*
  907. '*
  908.       SUB PutScreen (YY$, Colour, Bold) STATIC
  909. * REPLACING old line(s) by new
  910. 2800  ZZ$ = ""
  911.       IF Colour <> 99 THEN
  912.          IF (Colour <> OldColour) OR (Bold <> IsBold) THEN
  913.             ZZ$ = ""
  914.             IF Bold <> IsBold THEN
  915.                IF Bold THEN
  916.                   ZZ$ = ZZ$ + "1;"
  917.                ELSE
  918.                   ZZ$ = ZZ$ + "0;"
  919.                END IF
  920.             END IF
  921.             ZZ$ = ZZ$ + MID$(STR$(Colour), 2) + "m"
  922.          END IF
  923.       ELSE
  924.          ZZ$ = ZEmphasizeOff$
  925.       END IF
  926.       ZOutTxt$ = ZZ$ + YY$
  927.       IF ZLocalUser THEN
  928.          CALL QuickTput(ZOutTxt$, 0)
  929.       ELSE
  930.          ZSubParm = 4
  931.          CALL Tput
  932.       END IF
  933.       ZSubParm = 0
  934.       IF INSTR(YY$, "") = 0 THEN
  935.          CurrentCol = CurrentCol + LEN(YY$)
  936.          IF CurrentCol > 80 THEN
  937.             CurrentCol = 0
  938.             CurrentRow = 0
  939.          END IF
  940.       ELSE
  941.          CurrentRow = 0
  942.          CurrentCol = 0
  943.       END IF
  944.       OldColour = Colour
  945.       IsBold = Bold
  946.       END SUB
  947.  
  948. '*  ReformText()
  949. '*----------------------------------------------------------------------------
  950. '*  This routine reflows the text to the current margins.  Optionally,
  951. '*  it right justifies all lines by adding "soft spaces"
  952. '*
  953. '*
  954. * ------[ first line different ]------
  955.       SUB ReformText (Justify%) STATIC
  956.  
  957. * REPLACING old line(s) by new
  958. 2900  DIM Places(80)
  959.  
  960.       CALL EraseToEOL(1, 1)
  961.       CALL PutScreen("Reformatting... Please Wait.", WhiteFore, ZTrue)
  962.  
  963.       CALL FindEndOfMsg(EndOfMsg)
  964.  
  965.       I = MsgLockLines + 1   ' Read index
  966.       J = MsgLockLines + 1   ' Write index
  967.  
  968.       '*
  969.       '* Reflow the text to the maximum on a line
  970.       '*
  971.       DO WHILE I <= EndOfMsg
  972.          '*
  973.          '* Loop until we get a long line or an end of paragraph
  974.          '*
  975.          ZOutTxt$ = ""
  976.          DO WHILE 1
  977.             YY$ = ZOutTxt$(I)
  978.             CALL UnString(YY$, SoftSpace$)
  979.             IF ZOutTxt$ <> "" AND RIGHT$(ZOutTxt$, 1) <> " " THEN
  980.                ZOutTxt$ = ZOutTxt$ + " "
  981.             END IF
  982.             ZOutTxt$ = ZOutTxt$ + YY$
  983.             CALL LastParaLine(I, EndOfMsg, EndOfPara)
  984.             I = I + 1
  985.             IF LEN(ZOutTxt$) > ZRightMargin THEN
  986.                '*
  987.                '* Wrap the long line
  988.                '*
  989.                CALL FindWrap(LEFT$(ZOutTxt$, ZRightMargin + 1), K)
  990.                IF K <= 1 THEN
  991.                   K = ZRightMargin
  992.                END IF
  993.                ZOutTxt$(J) = LEFT$(ZOutTxt$, K)
  994.                IF EndOfPara THEN
  995.                   '*
  996.                   '* Go to the next paragraph
  997.                   '*
  998.                   J = J + 1
  999.                   ZOutTxt$(J) = MID$(ZOutTxt$, K + 1)
  1000.                ELSE
  1001.                   '*
  1002.                   '* Keep the remaining part of the line and process
  1003.                   '* it on the next pass
  1004.                   '*
  1005.                   I = I - 1
  1006.                   ZOutTxt$(I) = MID$(ZOutTxt$, K + 1)
  1007.                END IF
  1008.                J = J + 1
  1009.                EXIT DO
  1010.             ELSEIF EndOfPara THEN
  1011.                ZOutTxt$(J) = ZOutTxt$
  1012.                J = J + 1
  1013.                EXIT DO
  1014.             END IF
  1015.          LOOP
  1016.       LOOP
  1017.  
  1018.       FOR I = J TO 99
  1019.          ZOutTxt$(I) = BlankLine$
  1020.       NEXT
  1021.  
  1022.       EndOfMsg = J - 1
  1023.  
  1024.       '*
  1025.       '* Space out the text on each line
  1026.       '*
  1027.       IF Justify% THEN
  1028.          FOR I = MsgLockLines + 1 TO EndOfMsg
  1029.             CALL LastParaLine(I, EndOfMsg, EndOfPara)
  1030.             IF NOT EndOfPara THEN
  1031.                '*
  1032.                '* Space out the line
  1033.                '*
  1034.                ZOutTxt$ = ZOutTxt$(I)
  1035.                CALL TrimTrail(ZOutTxt$, " ")
  1036.                TxtLen = LEN(ZOutTxt$)
  1037.                SpacesToAdd = ZRightMargin - TxtLen
  1038.                IF SpacesToAdd > 0 THEN
  1039.                   '*
  1040.                   '* Skip leading spaces on the line
  1041.                   '*
  1042.                   Place = 1
  1043.                   IF LEFT$(ZOutTxt$, 1) = " " THEN
  1044.                      CALL FindWord(ZOutTxt$, 1, Place)
  1045.                   END IF
  1046.                   '*
  1047.                   '* Find all of the possible places to space out the line
  1048.                   '*
  1049.                   NumPlaces = 0
  1050.                   DO WHILE 1
  1051.                      CALL FindWord(ZOutTxt$, 1, Place)
  1052.                      IF Place < TxtLen THEN
  1053.                         NumPlaces = NumPlaces + 1
  1054.                         Places(NumPlaces) = Place
  1055.                      ELSE
  1056.                         EXIT DO
  1057.                      END IF
  1058.                   LOOP
  1059.                   '*
  1060.                   '* Fill in available places with soft spaces
  1061.                   '*
  1062.                   IF NumPlaces <> 0 THEN
  1063.                      ExtraPlaces = (SpacesToAdd MOD NumPlaces)
  1064.                      LeftExtra = ExtraPlaces \ 2
  1065.                      RightExtra = ExtraPlaces - LeftExtra
  1066.                      FOR J = NumPlaces TO 1 STEP -1
  1067.                         SpacesThisPlace = SpacesToAdd \ NumPlaces
  1068.                         IF J <= LeftExtra OR J > NumPlaces - RightExtra THEN
  1069.                            SpacesThisPlace = SpacesThisPlace + 1
  1070.                         END IF
  1071.                         IF SpacesThisPlace <> 0 THEN
  1072.                            ZOutTxt$ = LEFT$(ZOutTxt$, Places(J) - 1) + STRING$(SpacesThisPlace, SoftSpace$) + MID$(ZOutTxt$, Places(J))
  1073.                         END IF
  1074.                      NEXT J
  1075.                   END IF
  1076.                END IF
  1077.                ZOutTxt$(I) = ZOutTxt$
  1078.             END IF
  1079.          NEXT I
  1080.       END IF
  1081.  
  1082.       CALL UpdateScreen
  1083.  
  1084.       END SUB
  1085.  
  1086. '*  SaveCursor()
  1087. '*----------------------------------------------------------------------------
  1088. '*  This routine saves the current cursor position
  1089. '*
  1090. '*
  1091. * ------[ first line different ]------
  1092.       SUB SaveCursor (Row%, Col%) STATIC
  1093.       Row% = CurrentRow
  1094.       Col% = CurrentCol
  1095.       END SUB
  1096.  
  1097. '*  UnGetChar()
  1098. '*----------------------------------------------------------------------------
  1099. '*   Puts a key in the beginning of the keyboard buffer
  1100. '*
  1101. '*
  1102.       SUB UnGetChar (X) STATIC
  1103.       ZCommportStack$ = CHR$(X) + ZCommportStack$
  1104.       END SUB
  1105.  
  1106. '*  UnString()
  1107. '*----------------------------------------------------------------------------
  1108. '*  Removes one string from another
  1109. '*
  1110. '*
  1111.       SUB UnString (YY$, BadString$) STATIC
  1112.       I = INSTR(YY$, BadString$)
  1113.       WHILE I <> 0
  1114.          YY$ = LEFT$(YY$, I - 1) + MID$(YY$, I + LEN(BadString$))
  1115.          I = INSTR(YY$, BadString$)
  1116.       WEND
  1117.       END SUB
  1118.  
  1119. '*  UpdateScreen()
  1120. '*----------------------------------------------------------------------------
  1121. '*  This is one of the most important routines  It compares the arrays
  1122. '*  ZOutTxt$ and ZWorkAra$ and only sends the user the DIFFERENCE between the
  1123. '*  two within the viewing area  In this way all processing can be done on
  1124. '*  ZOutTxt$ and then the screen is updated to reflect the changes. After the
  1125. '*  users screen is updated, ZWorkAra$ is changed to reflect what should be
  1126. '*  on the users' screen The cursor is restored to its original position
  1127. '*
  1128. '*
  1129.       SUB UpdateScreen STATIC
  1130. * REPLACING old line(s) by new
  1131. * ------[ first line different ]------
  1132. 3100  CALL SaveCursor(Row, Col)
  1133. IF ZExpertUser THEN PE = 23 _
  1134.    Else PE = 19
  1135.       For I = 3 To PE                'Pe 07/25/92
  1136.          Index = I + TopLine - 3
  1137.          ScreenLine$ = ZWorkAra$(I)
  1138.          MessageLine$ = ZOutTxt$(Index)
  1139.          LML = LEN(MessageLine$)
  1140.  
  1141.          IF Index = ZMaxMsgLines + 1 THEN
  1142.             CALL EraseToEOL(I, 1)
  1143.             CALL PutScreen("[* End of Message *]", CyanFore, ZFalse)
  1144.             ZWorkAra$(I) = CHR$(EndKey)
  1145.          ELSEIF Index > ZMaxMsgLines + 1 THEN
  1146.             IF ScreenLine$ <> BlankLine$ THEN
  1147.                CALL EraseToEOL(I, 1)
  1148.                ZWorkAra$(I) = BlankLine$
  1149.             END IF
  1150.          ELSEIF MessageLine$ = ScreenLine$ THEN
  1151.             '*
  1152.             '* Screen = What's in message buffer
  1153.             '*
  1154.          ELSEIF MessageLine$ = BlankLine$ OR MessageLine$ = SPACE$(LML) THEN
  1155.             CALL EraseToEOL(I, 1)
  1156.             ZWorkAra$(I) = MessageLine$
  1157.          ELSE
  1158.           CALL MoveCursor(I, 1)
  1159.           YY$ = MessageLine$
  1160.           CALL EraseToEOL(CurrentRow, CurrentCol) ' <-- Switched these 2 to
  1161.           CALL PutScreen(YY$, YellowFore, ZTrue)  ' <-- get P)aint Working
  1162.           ZWorkAra$(I) = ZOutTxt$(Index)          '     Properly.
  1163.          END IF
  1164.       NEXT I
  1165.     CALL MoveCursor(Row,Col)
  1166.       END SUB
  1167.  
  1168. '*  UpdateStatusLine()
  1169. '*-----------------------------------------------------------------------------
  1170. '*  Rewrites the status line on screen line(s) 1 and 2
  1171. '*
  1172. '*    Input:  How% = 1   - Rewrite both lines
  1173. '*            How% = 2   - Just rewrite top line
  1174. ' Changed this a little bit.
  1175. ' Changed the DOUBLE ESC command to CTRL-K (Double ESC still works)
  1176. ' CTRL-K was easier to explain to brain dead users :)
  1177. ' Also attempted to make CTRL-K stand out a bit more
  1178. '
  1179.  
  1180.       SUB UpdateStatusLine (How%) STATIC
  1181. * REPLACING old line(s) by new
  1182. * ------[ first line different ]------
  1183. 3200  CALL MoveCursor(1, 1)
  1184.       CALL PutScreen("ANSIED " + Version$ +" by Tom Collins       ", BlueFore, ZTrue)
  1185.       CALL PutScreen("Hit Esc Twice or Cntrl-K ",RedFore, ZTrue)
  1186.       CALL PutScreen("for Menu" + SPACE$(24),BlueFore, ZTrue)
  1187.  
  1188. * REPLACING old line(s) by new
  1189. 3210  IF How% = 1 THEN
  1190.          YY$ = CHR$(205) + " To: " + MsgTo$ + " " + CHR$(205) + " Re: " + MsgSubj$ + " " + CHR$(205)
  1191. * ------[ first line different ]------
  1192.          YY$ = YY$ + STRING$(74 - LEN(YY$), CHR$(205))
  1193.          IF InsertMode THEN
  1194.             MID$(YY$, 70) = " Ins "
  1195.          ELSE
  1196.             MID$(YY$, 70) = " Ovw "
  1197.          END IF
  1198.          I = 1
  1199.          CALL MoveCursor(2, I)
  1200.          CALL PutScreen(YY$, WhiteFore, ZFalse)
  1201.       END IF
  1202.       END SUB
  1203.  
  1204. * INSERTING new line(s)
  1205. 3220 SUB DisplayKeys STATIC
  1206. IF ZExpertUser THEN EXIT SUB   'Pe 07/25/92
  1207.   CALL MoveCursor(20,1)
  1208. YY$ = STRING$(79,CHR$(205))
  1209. MID$ (YY$,30) = "ANSIED QuickKeys Menu"
  1210.   CALL Putscreen(YY$,RedFore,DefaultBold)
  1211.   CALL MoveCursor(21,1)
  1212.   CALL PutScreen ("^A Word Left  ^B Reformat  ^C PageDown  ^D ColRight ^E LineUp   ^F Word Right",DefaultColor, DefaultBold)
  1213.   CALL MoveCursor(22,1)
  1214.   CALL PutScreen ("^G Del        ^O Reflow    ^P Repaint   ^R PageUp   ^S ColLeft  ^T DelWordRight",DefaultColor, DefaultBold)
  1215.   CALL MoveCursor(23,1)
  1216.   CALL PutScreen ("^V Toggle Ins ^W home      ^X Line Down ^Y Del Line ^Z End",DefaultColor, DefaultBold)
  1217.   CALL MoveCursor(24,1)
  1218.   CALL PutScreen ("^K Lists Menu      ^N This Help  ^J Help Screen OFF",RedFore, DefaultBold)
  1219.  
  1220.      END SUB
  1221.