home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d7xx / d770 / uedit.lha / Uedit / Jenkins2.LZH / BlockIndent-Outdent next >
Text File  |  1991-04-08  |  3KB  |  79 lines

  1. ======= BlockIndent-Outdent ===============================
  2.  
  3. COPYRIGHT 1991
  4. Robert A. Jenkins, Ph.D.
  5. 22901 Shagbark Lane
  6. Miller Woods, IL 60411
  7. (708) 758-0344
  8. All Rights Reserved
  9. Rick Stiles may distribute it as he pleases.
  10.  
  11. =============================================================================
  12. In writing a command I often find that I need to change the indentation of a
  13. block of text.  Rick's match indent to the preceding line only works in simple
  14. situations.  This command is much more powerful.  It will shift the indent of
  15. the hilighted block left or right as you like.
  16.  
  17. Hilite a block of text.
  18. Hit shft-tab
  19. Enter the amount of shift, pos or negative, and hit esc.
  20. =============================================================================
  21.  
  22.  
  23. Block Indent-Outdent
  24. <shft-tab:
  25. putMsg("Input incremental indent, +-n:")
  26. inputNum(n50)
  27. moveCursor(curFile,sHilite)
  28. if (gtNum(n50,0)) {                                                   ..indent
  29.       ..putMsg("starting indent")..debug
  30.       while (gtLoc(curFile,eHilite,atCursor)) {
  31.          ..alertUser("starting a line")..debug
  32.          equateNum(n51,n50)
  33.          while (gtNum(n51,0)) {
  34.             insertChar(curFile," ")
  35.             decNum(n51) }
  36.          moveCursor(curFile,sLine)
  37.          moveCursor(curFile,downline)
  38.          ..alertUser("finished a line") 
  39.          } }
  40.    else {                                                            ..outdent
  41.       while (gtLoc(curFile,eHilite,atCursor)) {
  42.          if (is(curFile,blankLine)) goto label(0)
  43.          equateNum(n51,n50)
  44.          while (gtNum(0,n51)) {
  45.             ..alertUser("testing")..debug
  46.             ..if (is(curFile,whiteSpace)) alertUser("whiteSpace") ..debug
  47.             if (!is(curFile,whiteSpace)) {
  48.                vScroll(atCursor)
  49.                alertUser("Aborted: At this point requested outdent > total indent")
  50.                return }
  51.             clearChar(curFile)
  52.             incNum(n51) }
  53.          LABEL(0)
  54.          moveCursor(curFile,downline)
  55.          if (not is(curFile,sLine)) moveCursor(curFile,sLine) } }
  56.    >Saturday 23-Feb-91 21:36:46
  57.  
  58. Test Suite
  59. -----
  60.    BEGIN
  61.    fhPtr := Dos.Open (ADR (pathName), Dos.newFile);
  62.    WriteString ('Saving>'); WriteLine (pathName);
  63.    transactionPtr := firstTransactionPtr;
  64.    li := Dos.Write (fhPtr, ADR (nTransactions), SIZE (CARDINAL));
  65.    FOR i := 1 TO nTransactions DO
  66.       li := Dos.Write (fhPtr, transactionPtr, SIZE (Transaction));
  67.       liquidationBlockPtr := transactionPtr^.firstLiquidationBlockPtr;
  68.       WHILE liquidationBlockPtr # NIL DO
  69.          li := Dos.Write (fhPtr, liquidationBlockPtr, SIZE (LiquidationBlock));
  70.          liquidationBlockPtr := liquidationBlockPtr^.nextPtr
  71.       END;
  72.       transactionPtr := ADR (transactionPtr^.nextPtr^);
  73.    END;
  74.    Dos.Close (fhPtr);
  75.    WriteLine ('Data saved');
  76.    END Save;
  77. ----- 
  78.  
  79.    more text