home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 2 / CDPD_II_2352.bin / applications / uedit / config!m < prev    next >
Text File  |  1992-01-01  |  55KB  |  1,978 lines

  1. -----------------------------------------------------------------------------
  2. |                              Config!M                                        |
  3. |         Copyright (C) 1986-92 Rick Stiles.  All rights reserved.            |
  4. -----------------------------------------------------------------------------
  5.  
  6. *************************************
  7. N-variables used:
  8. n0-n9    scratch numbers
  9.  
  10. n20 delay time
  11. n21 arithmetic total
  12. n22 #cycles in cycle counter
  13. n23 macroNum to be run in cycle counter
  14.  
  15. Buffers used:
  16. buf50-buf54 scratch buffers
  17.  
  18. buf37    copied columnar text
  19. buf38    directory names
  20. buf39    result from DOS
  21. buf40    DOS command
  22. buf41    swap buf
  23. buf42    Help buf
  24. buf43    file name
  25. buf44    command buffer
  26. buf45    UNDO buffer
  27. buf46    invert buf
  28. buf47    hilite buf
  29. buf48    replace text
  30. buf49    search string
  31.  
  32. *************************************
  33.  
  34. <defines:
  35. define(N_0 ,n0)
  36. define(N_1 ,n1)
  37. define(N_2 ,n2)
  38. define(N_3 ,n3)
  39. define(N_4 ,n4)
  40. define(N_5 ,n5)
  41. define(N_6 ,n6)
  42. define(N_7 ,n7)
  43. define(N_8 ,n8)
  44. define(N_9 ,n9)
  45.  
  46. define(DELAY_TIME    ,n20)
  47. define(SUM_TOTAL    ,n21)
  48. define(CYCLES    ,n22)
  49. define(MACRO_NUM    ,n23)
  50.  
  51. define(B_0 ,buf50)
  52. define(B_1 ,buf51)
  53. define(B_2 ,buf52)
  54. define(B_3 ,buf53)
  55. define(B_4 ,buf54)
  56.  
  57. define(BSTACK_99    ,buf99) .. note buf99 isn't actually used
  58. define(HOME_BUF ,buf0) .. note buf0 isn't actually used
  59.  
  60. define(COLUMNAR_BUF ,buf37)
  61. define(DIR_NAMES    ,buf38)
  62. define(DOS_RESULT    ,buf39)
  63. define(DOS_CMD ,buf40)
  64. define(SWAP_BUF ,buf41)
  65. define(HELP_BUF ,buf42)
  66. define(FILE_NAME    ,buf43)
  67. define(CMD_BUF ,buf44)
  68. define(UNDO_BUF ,buf45)
  69. define(INVERT_BUF    ,buf46)
  70. define(HILITE_BUF    ,buf47)
  71. define(REPLACE_TXT ,buf48)
  72. define(SEARCH_STR    ,buf49)
  73.  
  74. define(Eat_MouseUp_Input    ,624)
  75. >
  76.  
  77. ======= MISCELLANEOUS CMDS =======
  78.  
  79. Set max number of files can load for normal editing (1-100, usually 20)
  80. <altCtl-f1:
  81.     putMsg("Input max # documents allowed (1-100)")
  82.     if (inputNum(N_4)) setMaxFiles(N_4) >
  83.  
  84. Mark region clicked with mouse
  85. <virtual-buttonDown:
  86.     equateLoc(curFile,atCursor,mouseLoc)
  87.     equateLoc(curFile,eInvert,atCursor)
  88.     equateLoc(curFile,sInvert,atCursor)
  89.     if (eqNum(curFile,38)) equateLoc(DIR_NAMES,eHilite,sHilite)
  90.     runKey(Eat_MouseUp_Input)                     .. soak mouseUp
  91.  
  92.     if (is(curFile,eFile) | is(curFile,whiteSpace)) returnFalse
  93.  
  94.     while (!is(curFile,whiteSpace) & !is(curFile,sFile))
  95.         moveCursor(curFile,sChar)                      .. find start non-white
  96.     if (is(curFile,whiteSpace)) moveCursor(curFile,eChar)
  97.     equateLoc(curFile,sInvert,atCursor)          .. sinvert = start non-white
  98.  
  99.     while (!is(curFile,whiteSpace) & !is(curFile,eFile))
  100.         moveCursor(curFile,eChar)                        .. find end non-white
  101.     equateLoc(curFile,eInvert,atCursor)            .. einvert = end non-white
  102.     if (eqNum(curFile,38)) {                        .. in directory buffer 38
  103.         equateLoc(curFile,sHilite,sInvert)
  104.         equateLoc(curFile,eHilite,eInvert)
  105.         equateLoc(curFile,sInvert,eInvert)
  106.         moveCursor(curFile,sHilite)
  107.     }
  108.     refreshDisplay
  109. >
  110.  
  111. Load File or select Directory that is CTRL-clicked.
  112. <ctl-buttonDown:
  113.     equateNum(N_9,curFile)
  114.     if (!runKey(virtual-buttonDown)) { runKey(virtual-buttonUp) return }
  115.     if (!eqNum(curFile,38)) {
  116.         if (geLoc(curFile,sInvert,eInvert)) return                  .. no rgn
  117.         moveCursor(curFile,sChar)
  118.         if (!is(curFile,"/") & !is(curFile,":")) {
  119.             freeBuf(B_4)
  120.             moveCursor(curFile,sInvert)
  121.             while (!eqLoc(curFile,atCursor,eInvert)) {
  122.                 if (is(curFile,":")) goto label(99)
  123.                 moveCursor(curFile,eChar)
  124.             }
  125.             insertRgn(B_4,sFile,DIR_NAMES,hilite)
  126. label(99)
  127.             insertRgn(B_4,eFile,curFile,invert)
  128.             loadFile(B_4)
  129.             return
  130.         }
  131.         moveCursor(curFile,eInvert)
  132.         freeBuf(B_3)
  133.         insertRgn(B_3,eFile,curFile,invert)
  134.         runKey(virtual-7)                                  .. add dir to DIR_NAMES
  135.     }
  136.     runKey(virtual-9)                                          .. show dir msg
  137.     return
  138. >
  139.  
  140. Search for B_3 dirname in DIR_NAMES.  Add name to list if not there.
  141. <virtual-7:
  142.     moveCursor(B_3,eFile)
  143.     decLoc(B_3,atCursor)
  144.     if (!is(B_3,"/") & !is(B_3,":")) insertRgn(B_3,eFile,"/",all)
  145.     if (isEmpty(DIR_NAMES)) runKey(virtual-8)                 .. default dir names
  146.                                          .. if (isEmpty(DIR_NAMES)) goto label(0)
  147.     moveCursor(DIR_NAMES,sFile)
  148.     equateLoc(DIR_NAMES,eHilite,sHilite)
  149. label(1)
  150.     while (is(DIR_NAMES,whiteSpace)) moveCursor(DIR_NAMES,eChar)
  151.     if (is(DIR_NAMES,eFile)) goto label(0)                              .. add it
  152.     equateLoc(DIR_NAMES,sHilite,atCursor)                           .. store start
  153.     while (!is(DIR_NAMES,whiteSpace) & !is(DIR_NAMES,eFile))
  154.         moveCursor(DIR_NAMES,eChar)
  155.     equateLoc(DIR_NAMES,eHilite,atCursor)                             .. store end
  156.     freeBuf(B_2)
  157.     insertRgn(B_2,sFile,DIR_NAMES,hilite)
  158.     if (!stringComp(N_4,B_3,B_2,1)) goto label(1)             .. try again
  159.     moveCursor(DIR_NAMES,sHilite)           .. found dirname.  Put cursor at start
  160.     goto label(5)
  161. label(0)                                        .. dirname not found.  Add it
  162.     moveCursor(DIR_NAMES,eFile)
  163.     if (!isEmpty(B_3)) {
  164.         locToCol(DIR_NAMES,N_4,atCursor)
  165.         if (gtNum(N_4,60)) insertChar(DIR_NAMES,eLine)
  166.         else insertChar(DIR_NAMES,9)                                       .. tab
  167.     }
  168.     equateLoc(DIR_NAMES,sHilite,eFile)
  169.     decLoc(DIR_NAMES,sHilite)
  170.     insertRgn(DIR_NAMES,eFile,B_3,all)         .. install new dirname as curdir
  171.     equateLoc(DIR_NAMES,eHilite,eFile)
  172.     incLoc(DIR_NAMES,sHilite)
  173.     moveCursor(DIR_NAMES,sHilite)
  174.     equateNum(N_4,curFile)
  175. label(5)
  176.     freeBuf(B_3)
  177.     if (!eqNum(N_4,38) & gotoSplit(DIR_NAMES)) gotoSplit(buf[N_4])..force refresh
  178.     runKey(virtual-9)
  179. >
  180.  
  181. Load beginning directory names into DIR_NAMES
  182. <virtual-8:
  183.     if (isEmpty(DIR_NAMES)) {
  184.         if (!insertFile(DIR_NAMES,eFile,"S:Directories"))
  185.            insertRgn(DIR_NAMES,eFile," DF0:  DF1:  DH0:  S:  RAM:  RAD:  VD0:",all)
  186.         moveCursor(DIR_NAMES,eFile)
  187.         equateLoc(DIR_NAMES,sHilite,eHilite)
  188.         equateLoc(DIR_NAMES,mouseLoc,eFile)
  189.      }
  190.      equateLoc(DIR_NAMES,sPage,sFile) >
  191.  
  192. Put up msg telling what click-loading directory now is.
  193. <virtual-9:
  194.     freeBuf(B_3)
  195.     insertRgn(B_3,eFile,"Click-loading directory = ",all)
  196.     if (gtLoc(DIR_NAMES,eHilite,sHilite)) insertRgn(B_3,eFile,DIR_NAMES,hilite)
  197.     else insertRgn(B_3,eFile,"default",all)
  198.     putMsg(B_3)
  199.     freebuf(B_3) >
  200.  
  201. Click or drag mouse, put word/phrase into index in buffer 41.  (Ctl-w to see.)
  202. <shftAlt-buttonDown:
  203.     equateLoc(curFile,atCursor,mouseLoc)
  204.     moveCursor(curFile,eWord)
  205.     equateLoc(curFile,eInvert,atCursor)
  206.     moveCursor(curFile,sWord)
  207.     equateLoc(curFile,sInvert,atCursor)
  208.     refreshDisplay >
  209.  
  210. Click or drag mouse, put word/phrase into index in buffer 41.  (Ctl-w to see.)
  211. <shftAlt-buttonUp:
  212.     equateLoc(curFile,atCursor,mouseLoc)
  213.     moveCursor(curFile,eWord)
  214.     equateLoc(curFile,eInvert,atCursor)
  215.     if (geLoc(curFile,sInvert,eInvert)) returnFalse
  216.     moveCursor(curFile,sInvert)
  217.     if (is(curFile,upperCase)) equateNum(N_0,1)
  218.     else equateNum(N_0,0)
  219.     toLower(curFile)
  220.     copyChar(curFile,N_4)
  221.     if (eqNum(N_0,1)) toUpper(curFile)
  222.     if (isEmpty(SWAP_BUF)) insertChar(SWAP_BUF,eLine)
  223.     moveCursor(SWAP_BUF,sFile)
  224.     equateLoc(SWAP_BUF,sPage,atCursor)
  225. label(1)
  226.     if (is(SWAP_BUF,upperCase)) equateNum(N_0,1)
  227.     else equateNum(N_0,0)
  228.     toLower(SWAP_BUF)
  229.     copyChar(SWAP_BUF,N_3)
  230.     if (eqNum(N_0,1)) toUpper(SWAP_BUF)
  231.     if (gtNum(N_4,N_3)) {
  232.         moveCursor(SWAP_BUF,downLine)
  233.         if (!is(SWAP_BUF,eFile)) goto label(1)
  234.     }
  235.     insertRgn(SWAP_BUF,atCursor,curFile,invert)
  236.     insertChar(SWAP_BUF,eLine)
  237. >
  238.  
  239. Handle DIR_NAMES directory traffic
  240. <virtual-buttonUp:
  241.     runKey(virtual-8)                     .. load in dir defalts if not loaded
  242.     equateLoc(DIR_NAMES,mouseLoc,atCursor)
  243.     equateNum(N_7,0)
  244.     if (!eqNum(curFile,38) & !gotoSplit(DIR_NAMES)) {
  245.         if (!splitWindow(DIR_NAMES,7)) {
  246.             putMsg("Close a split window so can let you select Directory")
  247.             return
  248.         }
  249.         equateNum(N_7,1)                           .. had to make split window
  250.     }
  251.     updateDisplay
  252. label(98)
  253.     equateLoc(DIR_NAMES,mouseLoc,sFile)
  254.     putMsg(
  255.     "Ctrl-mouse=SelectDir.  F1=Edit.  F2=DirList.  F3=Save.  F4=ChgDir.  F5=CD.")
  256.  
  257.     runKey(Eat_MouseUp_Input)                     .. soak mouseUp
  258.     getKeyVal(macroNum,inputChar)
  259.     switch(macroNum) {
  260.         case(normal-closebox)
  261.         case(normal-buttonDown) {                    .. done bring down window
  262.             gotoSplit(buf[N_9])
  263.             if (eqNum(N_7,1)) splitWindow(DIR_NAMES,0)       .. close it if made it
  264.             runKey(virtual-9)
  265.             return
  266.         }
  267.         case(normal-f1) {                                        .. edit DIR_NAMES
  268.             putMsg("Press left-Amiga-0 to elim split window.")
  269.             return
  270.         }
  271.         case(ctl-buttonDown) {
  272.             runkey(virtual-buttonDown)
  273.             refreshDisplay
  274.             runKey(virtual-9)
  275.             delay(3)
  276.         }
  277.         case(normal-f2) {                                      .. get dir list
  278.             gotoSplit(buf[N_9])
  279.             if (eqNum(N_7,1)) splitWindow(DIR_NAMES,0)       .. close it if made it
  280.             if (newFile) {
  281.                 setFileName(curFile,"DirList")
  282.                 clearRgn(curFile,all)
  283.                 insertRgn(curFile,atCursor,DIR_NAMES,hilite)
  284.                 insertChar(curFile,eLine)
  285.                 equateLoc(curFile,sPage,sFile)
  286.                 updateDisplay
  287.                 freeBuf(B_4)
  288.                 insertRgn(B_4,eFile,"dir ",all)
  289.                 insertRgn(B_4,eFile,DIR_NAMES,hilite)
  290.                 execute(curFile,B_4)
  291.  
  292.                                                           .. massage dir list
  293.                 getSearch(B_0)
  294.                 setSearch(" (dir)")
  295.                 moveCursor(curFile,sFile)
  296.                 while (search(curFile,locA,locB,1)) {
  297.                     clearRgn(curFile,loc)
  298.                     insertChar(curFile,"/")
  299.                     moveCursor(curFile,sLine)
  300.                     moveCursor(curFile,eWord)
  301.                     moveCursor(curFile,sWord)
  302.                     insertRgn(curFile,atCursor,DIR_NAMES,hilite)
  303.                 }
  304.                 setSearch(B_0)                     .. restore search string
  305.                 moveCursor(curFile,sFile)
  306.                 flipFlag(curFile,changed)
  307.                 putMsg("Ctl-click dirnames to add, filenames to load.")
  308.                 return
  309.             } else putMsg("Can't open file buf for dir list")
  310.         }
  311.         case(normal-f3) { saveFile(DIR_NAMES) }
  312.         case(normal-f4) {                                        .. change dir
  313.             if (gtLoc(DIR_NAMES,eHilite,sHilite)) {
  314.                 freeBuf(B_4)
  315.                 insertRgn(B_4,eFile,DIR_NAMES,hilite)
  316.                 changeDir(B_4)
  317.                 goto label(0)
  318.             }
  319.         }
  320.         case(normal-f5) {                                            .. get CD
  321. label(0)    freeBuf(B_3)
  322.             execute(B_3,"CD")
  323.             freeBuf(B_4)
  324.             insertRgn(B_4,eFile,"CD = ",all)
  325.             insertRgn(B_4,eFile,B_3,line)
  326.             putMsg(B_4)
  327.             delay(5)
  328.         }
  329.     }
  330.     goto label(98)
  331. >
  332.  
  333. Scroll up 1 line
  334. <normal-upArrow:
  335.     if (!thisKey) vScroll(-1)
  336.     else while (nothing) {
  337.         if (!vScroll(-1) | !inputWaiting) return
  338.         while (inputKey(N_4)) nothing
  339.         vScroll(-3)
  340.         updateDisplay
  341.     } >
  342.  
  343. Scroll down 1 line
  344. <normal-downArrow:
  345.     if (!thisKey) vScroll(1)
  346.     else while (nothing) {
  347.         if (!vScroll(1) | !inputWaiting) return
  348.         while (inputKey(N_4)) nothing
  349.         vScroll(3)
  350.         updateDisplay
  351.     } >
  352.  
  353. Scroll right 1 char
  354. <normal-leftArrow: hScroll(1) >
  355.  
  356. Scroll left 1 char
  357. <normal-rightArrow: hScroll(-1) >
  358.  
  359. Scroll up 11 lines
  360. <shft-upArrow: vScroll(-11) >
  361.  
  362. Scroll down 11 lines
  363. <shft-downArrow: vScroll(11) >
  364.  
  365. Scroll right 10 chars
  366. <shft-leftArrow: hScroll(10) >
  367.  
  368. Scroll left 10 chars
  369. <shft-rightArrow: hScroll(-10) >
  370.  
  371. Scroll to start of page
  372. <alt-upArrow: vScroll(sPage) >
  373.  
  374. Scroll to bottom of page
  375. <alt-downArrow: vScroll(ePage) >
  376.  
  377. Scroll right 20 chars
  378. <alt-leftArrow: hScroll(20) >
  379.  
  380. Scroll left 20 chars
  381. <alt-rightArrow: hScroll(-20) >
  382.  
  383. Scroll to start of file
  384. <ctl-upArrow: vScroll(sFile) >
  385.  
  386. Scroll to end of file
  387. <ctl-downArrow: vScroll(eFile) >
  388.  
  389. Scroll to end of line
  390. <ctl-leftArrow:
  391.     getLocal(curFile,N_4,lineLength)
  392.     hScroll(N_4) >
  393.  
  394. Scroll to start of line
  395. <ctl-rightArrow: while (hScroll(-1)) nothing >
  396.  
  397. Load and show help file - press again to release help
  398. <normal-help:
  399.     if (!isEmpty(HELP_BUF)) {
  400.         equateNum(N_4,curFile)
  401.         if (eqNum(N_4,42)) freeBuf(HELP_BUF)
  402.         else editBuf(HELP_BUF)
  403.     } else {
  404.         insertFile(HELP_BUF,sFile,"Help!")
  405.         if (isEmpty(HELP_BUF)) {
  406.             freeBuf(HELP_BUF)
  407.             insertFile(HELP_BUF,sFile,"S:Help!")
  408.         }
  409.         if (!isEmpty(HELP_BUF)) {
  410.             editBuf(HELP_BUF)
  411.             upFlag(HELP_BUF,readOnly)
  412.         } else putMsg("Can't find S:Help! file.")
  413.     } >
  414.  
  415. Start this Key-Help mode - press Amiga-ESC to leave this Key-Help mode
  416. <ctl-help: flipFlag(curFile,teachKeys) >
  417.  
  418. Refresh screen including title bar
  419. <shftCtl-help: fullRefresh >
  420.  
  421. Rebuild the menus by running the startup command
  422. <shftAltCtl-Help: runKey(startup) >
  423.  
  424. Close file.  If changed, ask "Save changes?"  If no files, ask "Really quit?"
  425. <normal-closeBox:
  426.     if (getFlag(curfile,changed) &
  427.         askYesNo("Save changes?") &
  428.             !saveFile(curFile)) return
  429.     freeBuf(curFile)
  430.     if (isEmpty(curFile)) {
  431.         equateNum(N_1,0)
  432.         getMaxFiles(N_0)
  433.         decNum(N_0)
  434.         do (N_4,0,N_0) if (!isEmpty(buf[N_4])) equatenum(N_1,1)
  435.         if (eqNum(N_1,0) & askYesNo("Really quit?")) quit(0)
  436.     } >
  437.  
  438. Switch to next document
  439. <normal-gadget1: toggle(curFile) >
  440.  
  441. Switch to previous document
  442. <normal-gadget2: runKey(shft-f1) >
  443.  
  444. Scroll display down
  445. <normal-gadget3: while (mouseDown) { vScroll(downLine) updateDisplay } >
  446.  
  447. Scroll display up
  448. <normal-gadget4: while (mouseDown) { vScroll(upLine)   updateDisplay } >
  449.  
  450. Switch to next file
  451. <normal-f1: toggle(curFile) >
  452.  
  453. Switch to previous file
  454. <shft-f1:
  455.     getMaxFiles(N_3)
  456.     if (geNum(1,N_3)) { returnFalse }
  457.     decNum(N_3)
  458.     equateNum(N_4,curFile)
  459.     while (nothing) {
  460.         if (gtNum(N_4,N_3)) equateNum(N_4,N_3)
  461.         decNum(N_4)
  462.         if (gtNum(0,N_4)) equateNum(N_4,N_3)
  463.         if (getFileName(B_4,buf[N_4])) {
  464.             editBuf(buf[N_4])
  465.             returnTrue
  466.         }
  467.     } >
  468.  
  469. Load a file
  470. <alt-f1:
  471.     putMsg("Input new filename:")
  472.     freeBuf(FILE_NAME)
  473.     if (inputString(FILE_NAME)) loadFile(FILE_NAME) >
  474.  
  475. Open new "Noname" file
  476. <ctl-f1: newFile >
  477.  
  478. Insert file at cursor
  479. <shftAlt-f1:
  480.     putMsg("Input filename to insert:")
  481.     freeBuf(FILE_NAME)
  482.     if (inputString(FILE_NAME)) insertFile(curFile,atCursor,FILE_NAME) >
  483.  
  484. Bring up file-requester
  485. <lAmiga-f1:
  486.     freeBuf(B_4)
  487.     insertRgn(B_4,eFile,DIR_NAMES,hilite)
  488.     moveCursor(B_4,efile)
  489.     moveCursor(B_4,sChar)
  490.     if (!is(B_4,sfile) & is(B_4,"/")) clearChar(B_4)
  491.     if (fileRequest(B_4,"Select Directory and/or File",0)) {
  492.         freeBuf(B_3)                         .. if True, always has 2 lines
  493.         insertRgn(B_3,efile,B_4,all)
  494.         moveCursor(B_3,sfile)
  495.         if (!is(B_3,eline)) moveCursor(B_3,eLine)
  496.         clearChar(B_3)                                     .. erase the eol
  497.         loadFile(B_3)
  498.     }
  499.     if (isEmpty(B_4)) {
  500.         putMsg("No selection or no Arp")
  501.         returnFalse
  502.     }
  503.     .. strip off the extra // if not using the arp requester
  504.     getSearch(B_3)
  505.     push(BSTACK_99,B_3)                                .. save old search string
  506.     setSearch("//")
  507.     movecursor(B_4,sFile)
  508.                                                   .. erase one of the slashes
  509.     if (search(B_4,sInvert,eInvert,1)) clearChar(B_4)
  510.     pop(BSTACK_99,B_3)                         .. restore the old search string
  511.     setSearch(B_3)
  512.  
  513.     moveCursor(B_4,sfile)     .. puts filename on line 2.  outputs "*" if no
  514.     if (!is(B_4,"*") & !is(B_4,eLine)) {
  515.         freeBuf(B_3)
  516.         insertRgn(B_3,efile,B_4,line)
  517.         runKey(virtual-7)      .. store dirname in DIR_NAMES, if not already there
  518.     }
  519. >
  520.  
  521. Save file currently in window
  522. <normal-f2: saveFile(curFile) >
  523.  
  524. Save file under different name
  525. <shft-f2:
  526.     putMsg("Save file as:")
  527.     freeBuf(FILE_NAME)
  528.     if (inputString(FILE_NAME) & setFileName(curFile,FILE_NAME)) saveFile(curFile) >
  529.  
  530. Save all changed files
  531. <alt-f2:
  532.     getMaxFiles(N_3)
  533.     decNum(N_3)
  534.     do(N_4,0,N_3) if (getFlag(buf[N_4],changed)) saveFile(buf[N_4]) >
  535.  
  536. Abort the current file save
  537. <shftAlt-f2: abortSave >
  538.  
  539. Save hilite as...
  540. <shftCtl-f2:
  541.     freeBuf(FILE_NAME)
  542.     insertRgn(FILE_NAME,atCursor,DIR_NAMES,hilite)
  543.     putMsg("Save hilite as:")
  544.     if (!inputString(FILE_NAME)) return
  545.     freeBuf(B_4)
  546.     insertRgn(B_4,efile,curFile,hilite)
  547.     setFileName(B_4,FILE_NAME)
  548.     saveFile(B_4)
  549.     freeBuf(B_4) >
  550.  
  551. Close current file.  If changed, ask "Save changes?"
  552. <normal-f3:
  553.     if (!isEmpty(curFile)
  554.         & getFlag(curFile,changed)
  555.         & askYesNo("Save changes before closing?")
  556.         & !saveFile(curFile)) returnFalse
  557.     freeBuf(curFile) >
  558.  
  559. Save file, if changed, then close it
  560. <shft-f3:
  561.     if (getFlag(curFile,changed) & !saveFile(curFile)) returnFalse
  562.     freeBuf(curFile) >
  563.  
  564. Free all non-file buffers.  Erases search buffer, directory name, etc
  565. <alt-f3:
  566.     getMaxFiles(N_2)
  567.     do(N_4,N_2,99) freeBuf(buf[N_4]) >
  568.  
  569. Ask "Save changes?", if any changes, then ask "Really quit?"
  570. <normal-f4:
  571.     if (!askYesNo("Really quit?")) returnFalse
  572.     equateNum(N_3,0)
  573.     getMaxFiles(N_2)
  574.     decNum(N_2)
  575.     do(N_4,0,N_2) if (getFlag(buf[N_4],changed)) equateNum(N_3,1)
  576.     if (eqNum(N_3,1) & askYesNo("Save changes?") & !runKey(shft-f4))
  577.         returnFALSE
  578.     quit(0) >
  579.  
  580. Save all changed files automatically, then quit
  581. <shft-f4:
  582.     getMaxFiles(N_2)
  583.     decNum(N_2)
  584.     do (N_4,0,N_2)
  585.     if (getFlag(buf[N_4],changed) & !saveFile(buf[N_4])) returnFalse
  586.     quit(0) >
  587.  
  588. Swap next 2 commands. (Mouse buttons, menu selections, gadgets, keys.)
  589. <normal-f5:
  590.     putMsg("Next 2 function keys will be swapped!")
  591.     if (getKey(N_3) & getKey(N_4) & swapKey(N_3,N_4))
  592.             { putMsg("Keys were swapped.") return }
  593.     putMsg("") >
  594.  
  595. Select buffer 44 to use for scratch editing or writing commands
  596. <shft-f6:
  597.     editBuf(CMD_BUF)
  598.     putMsg("Type in command, <anykey: etc>, and press F6 to compile:") >
  599.  
  600. Save UE config to disk.  Default is Data! or last name you gave
  601. <alt-f6:
  602.     if (askYesNo("Save data?")) {
  603.         putMsg("Input data filename or pmESC:")
  604.         freeBuf(B_4)
  605.         inputString(B_4)
  606.         saveConfig(B_4)
  607.     } >
  608.  
  609. Restore UE config from disk.  Default is Data! or last name you gave
  610. <ctl-f6:
  611.     if (askYesNo("Load data?")) {
  612.         putMsg("Input data filename or pmESC:")
  613.         freeBuf(B_4)
  614.         inputString(B_4)
  615.         loadConfig(B_4)
  616.     } >
  617.  
  618. Compile configuration default values at the top of Config! file
  619. <altCtl-f6:
  620.     moveCursor(curFile,sFile)
  621.     if (!compileDefaults(curFile)) beepDisplay>
  622.  
  623. Input the number of a buffer to edit
  624. <shftAlt-f6:
  625.     putMsg("Input number of buffer to edit:")
  626.     if (inputNum(N_4)) { editBuf(buf[N_4]) vScroll(sFile) } >
  627.  
  628. Examine all buffers that aren't empty
  629. <shftCtl-f6:
  630.     getMaxFiles(N_2)
  631.     do (N_4,N_2,99) if (!isEmpty(buf[N_4])) {
  632.         editBuf(buf[N_4])
  633.         vScroll(sFile)
  634.         updateDisplay
  635.         putMsg("F1=continue, F2=edit this one, F3=stop:")
  636.         getKey(N_3)
  637.         if (eqNum(N_3,normal-f2)) { putMsg("") return }
  638.         if (eqNum(N_3,normal-f3)) goto label(1)
  639.     }
  640.     label(1)
  641.     toggle(curFile)
  642.     putMsg("") >
  643.  
  644. Kill next command, including mouse button, menu selection, gadget, key
  645. <shftAltCtl-f6:
  646.     putMsg("Next command-key will be deleted!")
  647.     if (getKey(N_4) & killKey(N_4))
  648.             { putMsg("Key command was deleted.") return }
  649.     putMsg("") >
  650.  
  651.  
  652. Find out if keys have got commands attached
  653. <lAmiga-f6:
  654.     putMsg("Press any key")
  655.     while (getKey(N_4)) {
  656.         if (inUse(N_4)) putMsg("In use - Amiga-esc=abort")
  657.         else putMsg("Available - Amiga-esc=abort")
  658.     }>
  659.  
  660. Push current buffer onto buffer stack
  661. <lAmiga-w:  push(BSTACK_99,curFile) runKey(virtual-w)  >
  662.  
  663. Pop buffer stack
  664. <rAmiga-w:
  665.     equateNum(N_1,99)            .. for buf stack 99
  666.     getStackSize(N_1,N_2,N_3)
  667.     if (geNum(0,N_1)) {
  668.         putMsg("Buffer stack is empty")
  669.         returnFalse
  670.     }
  671.     if (!askYesNo("Replace current buffer, deleting old?") & !newFile) {
  672.         putMsg("Can't open a file buffer")
  673.         returnFalse
  674.     }
  675.     pop(BSTACK_99,curFile)
  676.     runKey(virtual-w) >
  677.  
  678. Rotate buffer stack
  679. <shftAlt-w: rollStack(BSTACK_99,1) runKey(virtual-w) >
  680.  
  681. Show number of buffers in stack
  682. <virtual-w:
  683.     equateNum(N_1,99)        .. for buffer stack 99
  684.     equateNum(N_2,99)        .. and num stack 99
  685.     getStackSize(N_1,N_2,N_3)
  686.     freeBuf(B_4)
  687.     insertRgn(B_4,atCursor,"Buffers on stack: ",all)
  688.     toWord(B_4,N_1)
  689.     putMsg(B_4)  >
  690.  
  691. Input search text & search fwd.  (Either-Or="$", wildcards= "?" & "*".)
  692. <normal-f7:  freeBuf(SEARCH_STR) runKey(shft-f7) >
  693.  
  694. Input new search wild-card characters
  695. <alt-f7:
  696.     putMsg("Input single wild-card char:")
  697.     getChar(wildCard)
  698.     putMsg("Input multi wild-card char:")
  699.     getChar(multiWild)
  700.     putMsg("White on single wildcards: 0=no, 1=space/tab, 2=all white:")
  701.     getChar(N_4)
  702.     if (geNum(N_4,"0") & geNum("2",N_4)) sub(singleWhite,N_4,"0")
  703.     putMsg("White on multi wildcards: 0=no, 1=space/tab, 2=all white:")
  704.     getChar(N_4)
  705.     if (geNum(N_4,"0") & geNum("2",N_4)) sub(multiWhite,N_4,"0")
  706.     putMsg("Input all-but delimiter char:")
  707.     getChar(allBut)
  708.     putMsg("")>
  709.  
  710. Input new search either-or character
  711. <ctl-f7:
  712.     putMsg("Input new search either-or char:")
  713.     getChar(eitherOr)
  714.     putMsg("")>
  715.  
  716. Input replace text to use in search-replace
  717. <normal-f8:
  718.     freeBuf(REPLACE_TXT)
  719.     runKey(shft-f8) >
  720.  
  721. Modify existing replace text
  722. <shft-f8: putMsg("input replace string:") inputString(REPLACE_TXT) >
  723.  
  724. Search forward, mark matched region, put cursor at start of rgn
  725. <normal-f9:
  726.     if (eqLoc(curFile,atCursor,eInvert)) moveCursor(curFile,sChar)
  727.     if (search(curFile,sInvert,eInvert,1)) {
  728.       putMsg("")
  729.       return
  730.     }
  731.     runKey(virtual-f9) >                                 .. failed search msg
  732.  
  733. Search backward, mark matched region, put cursor at start of rgn
  734. <shft-f9:
  735.     if (search(curFile,sInvert,eInvert,-1)) { putMsg("") return }
  736.     runKey(virtual-f9) >                                 .. failed search msg
  737.  
  738. Failed search message used by fwd/bkwd search
  739. <virtual-f9:
  740.     putMsg("Search failed.")
  741.     if (not eqLoc(curFile,sInvert,eInvert)) {
  742.         equateLoc(curFile,sInvert,eInvert)
  743.         refreshDisplay
  744.     }
  745.     returnFalse >
  746.  
  747. Replace matched region with replace text, then search forward
  748. <normal-f10:
  749.     if (eqLoc(curFile,sInvert,eInvert)) returnFalse
  750.     clearRgn(curFile,invert)
  751.     insertRgn(curFile,sInvert,REPLACE_TXT,all)
  752.     runKey(normal-f9) >
  753.  
  754. Replace matched region with replace text, then search backward
  755. <shft-f10:
  756.     if (eqLoc(curFile,sInvert,eInvert)) returnFalse
  757.     clearRgn(curFile,invert)
  758.     insertRgn(curFile,sInvert,REPLACE_TXT,all)
  759.     runKey(shft-f9) >
  760.  
  761. Replace and continue forward search-replace until search fails
  762. <alt-f10: while(runKey(normal-f10)) nothing >
  763.  
  764. Open a space under cursor for typing
  765. <shft-del:
  766.     insertChar(curFile," ") moveCursor(curFile,sChar)
  767.     if (is(curFile,sLine)) refreshDisplay>
  768.  
  769. Open line for typing below cursor line
  770. <alt-del:
  771.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  772.     insertChar(curFile,eLine)>
  773.  
  774. Delete line above cursor line
  775. <ctl-del:
  776.     equateLoc(curFile,mouseLoc,atCursor)
  777.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  778.     if (!is(curFile,sFile)) {
  779.         moveCursor(curFile,upLine)
  780.         runKey(virtual-x)                                   .. this runs ctl-d
  781.         moveCursor(curFile,mouseLoc)
  782.     }>
  783.  
  784. Open a space for typing in front of current word
  785. <shft-bs:
  786.     if (!is(curFile,sWord)) moveCursor(curFile,sWord)
  787.     runKey(shft-del)>
  788.  
  789. Open line for typing above the current line
  790. <alt-bs:
  791.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  792.     insertChar(curFile,eLine)  moveCursor(curFile,sChar)>
  793.  
  794. Delete line below cursor line
  795. <ctl-bs:
  796.     equateLoc(curFile,mouseLoc,atCursor)
  797.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  798.     if (!is(curFile,eFile)) {
  799.         moveCursor(curFile,downLine)
  800.         runKey(virtual-x)                                   .. this runs ctl-d
  801.         moveCursor(curFile,mouseLoc)
  802.     }>
  803.  
  804.                             *** Keypad Keys ***
  805. Find cursor and center it in window
  806. <normal-kp5: vScroll(atCursor) >
  807.  
  808. .. free the scratch buffer
  809. <520:
  810.     freeBuf(UNDO_BUF)
  811. >
  812.  
  813. Delete word left, storing it in Undo buffer
  814. <normal-kp7:
  815.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  816.     equateLoc(curFile,locB,atCursor)
  817.     moveCursor(curFile,sWord)
  818.     equateLoc(curFile,locA,atCursor)
  819.     insertRgn(UNDO_BUF,sFile,curFile,loc)
  820.     equateLoc(UNDO_BUF,sPage,sFile)
  821.     clearRgn(curFile,loc) >
  822.  
  823. Delete word right, storing it in Undo buffer
  824. <normal-kp9:
  825.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  826.     equateLoc(curFile,locA,atCursor)
  827.     moveCursor(curFile,eWord)
  828.     equateLoc(curFile,locB,atCursor)
  829.     insertRgn(UNDO_BUF,eFile,curFile,loc)
  830.     equateLoc(UNDO_BUF,sPage,sFile)
  831.     clearRgn(curFile,loc) >
  832.  
  833. Move cursor up 1 line
  834. <normal-kp8: moveCursor(curFile,upLine) >
  835.  
  836. Move cursor down 1 line
  837. <normal-kp2: moveCursor(curFile,downLine) >
  838.  
  839. Move cursor to start of word
  840. <normal-kp4: moveCursor(curFile,sWord) >
  841.  
  842. Move cursor to end of word
  843. <normal-kp6: moveCursor(curFile,eWord) >
  844.  
  845. Set start of hilite region at cursor
  846. <normal-kp1: equateLoc(curFile,sHilite,atCursor) refreshDisplay >
  847.  
  848. Set end of hilite region at cursor
  849. <normal-kp3: equateLoc(curFile,eHilite,atCursor) refreshDisplay >
  850.  
  851. UNDO scratch deletes, inserting scratch delete buffer at cursor
  852. <normal-kp0: insertRgn(curFile,atCursor,UNDO_BUF,all) >
  853.  
  854. Copy hilite region into buffer
  855. <normal-kpDot:
  856.     if (getFlag(curFile,columnar)) { runKey(shftCtl-3) return }
  857.     if (gtLoc(curFile,eHilite,sHilite)) {
  858.         freeBuf(HILITE_BUF)
  859.         insertRgn(HILITE_BUF,sFile,curFile,hilite)
  860.         equateLoc(HILITE_BUF,sPage,sFile)
  861.     } else returnFalse >
  862.  
  863. Copy hilite region into buffer, then delete hilite region
  864. <normal-kpMinus:
  865.     if (getFlag(curFile,columnar)) { runKey(shftCtl-1) return }
  866.     if (runKey(normal-kpDot)) clearRgn(curFile,hilite)
  867.     vscroll(atcursor) >
  868.  
  869. Insert copied hilite at cursor
  870. <normal-kpEnter:
  871.     if (getFlag(curFile,columnar)) { runKey(shftCtl-4) return }
  872.     if (is(curFile,sFile)) {
  873.         equateLoc(curFile,sHilite,atCursor)
  874.         equateLoc(curFile,eHilite,sHilite)
  875.     } else {
  876.         equateLoc(curFile,sHilite,atCursor)
  877.         decLoc(curFile,sHilite)
  878.         equateLoc(curFile,eHilite,atCursor)
  879.     }
  880.     insertRgn(curFile,atCursor,HILITE_BUF,all)
  881.     if (eqLoc(curFile,atCursor,sHilite)) equateLoc(curFile,sHilite,sFile)
  882.     else incLoc(curFile,sHilite)
  883.     if (!onScreen(atCursor)) vScroll(atCursor) >
  884.  
  885. Find cursor and center it in window
  886. <shft-kp5: vScroll(atCursor) >
  887.  
  888. Delete char to left of cursor, storing it in Undo buffer
  889. <shft-kp7:
  890.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  891.     equateLoc(curFile,locB,atCursor)
  892.     moveCursor(curFile,sChar)
  893.     equateLoc(curFile,locA,atCursor)
  894.     insertRgn(UNDO_BUF,sFile,curFile,loc)
  895.     equateLoc(UNDO_BUF,sPage,sFile)
  896.     clearRgn(curFile,loc) >
  897.  
  898. Delete char under cursor, storing it in Undo buffer
  899. <shft-kp9:
  900.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  901.     equateLoc(curFile,locA,atCursor)
  902.     moveCursor(curFile,eChar)
  903.     equateLoc(curFile,locB,atCursor)
  904.     insertRgn(UNDO_BUF,eFile,curFile,loc)
  905.     equateLoc(UNDO_BUF,sPage,sFile)
  906.     clearRgn(curFile,loc) >
  907.  
  908. Move cursor up one line
  909. <shft-kp8: moveCursor(curFile,upLine) >
  910.  
  911. Move cursor down one line
  912. <shft-kp2: moveCursor(curFile,downLine) >
  913.  
  914. Move cursor left 1 char
  915. <shft-kp4: moveCursor(curFile,sChar) >
  916.  
  917. Move cursor right 1 char
  918. <shft-kp6: moveCursor(curFile,eChar) >
  919.  
  920. Set start of hilite region at cursor
  921. <shft-kp1: runKey(normal-kp1) >
  922.  
  923. Set end of hilite region at cursor
  924. <shft-kp3: runKey(normal-kp3) >
  925.  
  926. UNDO scratch deletes, inserting scratch delete buffer at cursor
  927. <shft-kp0: runKey(normal-kp0) >
  928.  
  929. Copy hilite region into buffer
  930. <shft-kpDot: runKey(normal-kpDot) >
  931.  
  932. Copy hilite region into buffer, then delete hilite region
  933. <shft-kpMinus: runKey(normal-kpMinus) >
  934.  
  935. Insert copied hilite region at cursor
  936. <shft-kpEnter: runKey(normal-kpEnter) >
  937.  
  938. Find cursor and center it in window
  939. <alt-kp5: vScroll(atCursor) >
  940.  
  941. Delete to start of line, storing it in Undo buffer
  942. <alt-kp7:
  943.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  944.     if (is(curFile,sLine)) runKey(shft-kp7)
  945.     else {
  946.         equateLoc(curFile,locB,atCursor)
  947.         moveCursor(curFile,sLine)
  948.         equateLoc(curFile,locA,atCursor)
  949.         insertRgn(UNDO_BUF,sFile,curFile,loc)
  950.         equateLoc(UNDO_BUF,sPage,sFile)
  951.         clearRgn(curFile,loc)
  952.     } >
  953. Delete to end of line, storing it in Undo buffer
  954. <alt-kp9:
  955.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  956.     if (is(curFile,eLine)) runKey(shft-kp9)
  957.     else {
  958.         equateLoc(curFile,locA,atCursor)
  959.         moveCursor(curFile,eLine)
  960.         equateLoc(curFile,locB,atCursor)
  961.         insertRgn(UNDO_BUF,eFile,curFile,loc)
  962.         equateLoc(UNDO_BUF,sPage,sFile)
  963.         clearRgn(curFile,loc)
  964.     } >
  965.  
  966. Move cursor to start of page
  967. <alt-kp8: moveCursor(curFile,sPage) vScroll(atCursor)>
  968.  
  969. Move cursor to end of page
  970. <alt-kp2: moveCursor(curFile,ePage) >
  971.  
  972. Move cursor to start of line
  973. <alt-kp4: moveCursor(curFile,sLine) >
  974.  
  975. Move cursor to end of line
  976. <alt-kp6: moveCursor(curFile,eLine) >
  977.  
  978. Set start of hilite region at cursor
  979. <alt-kp1: runKey(normal-kp1) >
  980.  
  981. Set end of hilite region at cursor
  982. <alt-kp3: runKey(normal-kp3) >
  983.  
  984. UNDO scratch deletes, inserting scratch delete buffer at cursor
  985. <alt-kp0: runKey(normal-kp0) >
  986.  
  987. Copy hilite region into buffer
  988. <alt-kpDot: runKey(normal-kpDot) >
  989.  
  990. Copy hilite region into buffer, then delete hilite region
  991. <alt-kpMinus: runKey(normal-kpMinus) >
  992.  
  993. Insert copied hilite region at cursor
  994. <alt-kpEnter: runKey(normal-kpEnter) >
  995.  
  996. Find cursor and center it in window
  997. <ctl-kp5: vScroll(atCursor) >
  998.  
  999. Delete from cursor to start of page, storing it in Undo buffer
  1000. <ctl-kp7:
  1001.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  1002.     equateLoc(curFile,locB,atCursor)
  1003.     moveCursor(curFile,sPage)
  1004.     equateLoc(curFile,locA,atCursor)
  1005.     insertRgn(UNDO_BUF,sFile,curFile,loc)
  1006.     equateLoc(UNDO_BUF,sPage,sFile)
  1007.     clearRgn(curFile,loc)
  1008.     vScroll(atCursor)
  1009.     updateDisplay >
  1010.  
  1011. Delete from cursor to end of page, storing it in Undo buffer
  1012. <ctl-kp9:
  1013.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  1014.     equateLoc(curFile,locA,atCursor)
  1015.     moveCursor(curFile,ePage)
  1016.     equateLoc(curFile,locB,atCursor)
  1017.     insertRgn(UNDO_BUF,eFile,curFile,loc)
  1018.     equateLoc(UNDO_BUF,sPage,sFile)
  1019.     clearRgn(curFile,loc)
  1020.     updateDisplay >
  1021.  
  1022. Move cursor to start of form
  1023. <ctl-kp8: moveCursor(curFile,sForm) >
  1024.  
  1025. Move cursor to end of form
  1026. <ctl-kp2: moveCursor(curFile,eForm) >
  1027.  
  1028. Move cursor to start of line
  1029. <ctl-kp4: moveCursor(curFile,sLine) >
  1030.  
  1031. Move cursor to end of line
  1032. <ctl-kp6: moveCursor(curFile,eLine) >
  1033.  
  1034. Set start of invert region at cursor
  1035. <ctl-kp1: equateLoc(curFile,sInvert,atCursor) refreshDisplay >
  1036.  
  1037. Set end of invert region at cursor
  1038. <ctl-kp3: equateLoc(curFile,eInvert,atCursor) refreshDisplay >
  1039.  
  1040. UNDO scratch deletes, inserting scratch delete buffer at cursor
  1041. <ctl-kp0: runKey(normal-kp0) >
  1042.  
  1043. Give message telling turn OFF columnar if columnar is ON.
  1044. <virtual-kpDot:
  1045.     if (getFlag(curFile,columnar)) {
  1046.         alertuser("Turn OFF columnar display mode first. (See Columnar menu.)")
  1047.         abort
  1048.     } >
  1049.  
  1050. Copy invert region into buffer
  1051. <ctl-kpDot:
  1052.     runKey(virtual-kpDot)
  1053.     if (gtLoc(curFile,eInvert,sInvert)) {
  1054.         freeBuf(INVERT_BUF)
  1055.         insertRgn(INVERT_BUF,sFile,curFile,invert)
  1056.         equateLoc(INVERT_BUF,sPage,sFile)
  1057.     } else returnFalse >
  1058.  
  1059. Copy invert region into buffer, then delete invert region
  1060. <ctl-kpMinus:
  1061.     runKey(virtual-kpDot)
  1062.     runKey(ctl-kpDot)
  1063.     clearRgn(curFile,invert) >
  1064.  
  1065. Insert copied invert region at cursor
  1066. <ctl-kpEnter:
  1067.     runKey(virtual-kpDot)
  1068.         if (is(curFile,sFile)) {
  1069.             equateLoc(curFile,sInvert,atCursor)
  1070.             equateLoc(curFile,eInvert,sInvert)
  1071.         } else {
  1072.             equateLoc(curFile,sInvert,atCursor)
  1073.             decLoc(curFile,sInvert)
  1074.             equateLoc(curFile,eInvert,atCursor)
  1075.         }
  1076.         insertRgn(curFile,atCursor,INVERT_BUF,all)
  1077.         if (eqLoc(curFile,atCursor,sInvert)) equateLoc(curFile,sInvert,sFile)
  1078.         else incLoc(curFile,sInvert)
  1079.         if (!onScreen(atCursor)) vScroll(atCursor) >
  1080.  
  1081.                         *** miscellaneous keys ***
  1082.  
  1083. Set new line-length
  1084. <ctl-return:
  1085.     putMsg("Enter new line-length:")
  1086.     if (inputNum(N_4)) {
  1087.         setLocal(curFile,lineLength,N_4)
  1088.         equateNum(lineLength,N_4)
  1089.     } >
  1090.  
  1091. Transparent tab forward
  1092. <shft-tab: moveCursor(curFile,eTab) >
  1093.  
  1094. Transparent tab backward
  1095. <alt-tab: moveCursor(curFile,sTab) >
  1096.  
  1097. Untab - delete white space back to previous tab column
  1098. <ctl-tab:
  1099.     equateLoc(curFile,locA,atCursor)
  1100.     moveCursor(curFile,sTab)
  1101.     while (is(curFile,space) | is(curFile,9)) {
  1102.         clearChar(curFile)
  1103.         if (eqLoc(curFile,atCursor,locA)) return
  1104.     }>
  1105.  
  1106. Show tab ruler above cursor line
  1107. <shftAlt-tab: seeRuler>
  1108.  
  1109. Set tab ruler using mouse or keys
  1110. <shftCtl-tab:
  1111.     putMsg(
  1112.     "Use mouse click/drag, Tab, Space, BS, Del (anykey=quit,Amiga-ESC=abort)")
  1113.     setRuler putMsg("") >
  1114.  
  1115. Convert tabs in document to spaces
  1116. <lAmiga-t: tabsToSpaces(curFile) >
  1117.  
  1118. Convert spaces in document to TABs
  1119. <rAmiga-t: spacesToTabs(curFile) >
  1120.  
  1121. Set TAB table number (0-4) to use for TAB spacing
  1122. <shftAltCtl-tab:
  1123.     putMsg("Enter new tab table # (0-4):")
  1124.     if (inputNum(N_4) & geNum(N_4,0) & geNum(4,N_4)) {
  1125.         setLocal(curFile,tabTable,N_4)
  1126.         equateNum(tabTable,N_4)
  1127.     } >
  1128.  
  1129. Trim spaces between the next two words after cursor
  1130. <alt-c:
  1131.     while (copyChar(curfile,N_4)
  1132.         & !(eqNum(N_4,32) | eqNum(N_4,9) | is(curfile,efile)))
  1133.                 moveCursor(curFile,eChar)
  1134.     moveCursor(curFile,eChar)
  1135.     if (is(curfile,efile)) returnFalse
  1136.     while (copyChar(curfile,N_4)
  1137.         & (eqNum(N_4,32) | eqNum(N_4,9)))
  1138.                 clearChar(curfile) >
  1139.  
  1140. Let next character typed be a CTRL-character, such as formfeed, etc
  1141. <ctl-c:
  1142.     putMsg("Input a control character:")
  1143.     getChar(N_4)
  1144.     if (geNum(31,N_4) | (geNum(N_4,64) & geNum(127,N_4))) {
  1145.         and(N_4,N_4,31)
  1146.         insertChar(curFile,N_4)
  1147.     }
  1148.     putMsg("") >
  1149.  
  1150. Count number of times the next command is successfully executed
  1151. <shftAlt-c:
  1152.     equateNum(CYCLES,0)
  1153.     putMsg("Input command to execute & count:")
  1154.     if (getKey(MACRO_NUM)) {
  1155.         while (runKey(MACRO_NUM)) incNum(CYCLES)
  1156.         freeBuf(B_4)
  1157.         insertRgn(B_4,sFile,"Times executed = ",all)
  1158.         toWord(B_4,CYCLES)
  1159.         putMsg(B_4)
  1160.     } >
  1161.  
  1162. Delay the amount of time (tenths of seconds) stored using shftAlt-d
  1163. <alt-d: delay(DELAY_TIME) >
  1164.  
  1165. Delete cursor line, storing it in Undo buffer.  (See keypad-0/7/9.)
  1166. <ctl-d: runKey(virtual-x)
  1167. >
  1168.  
  1169. Delete cursor line
  1170. <virtual-x:
  1171.     if (!eqLoc(curFile,locB,atCursor)) runKey(520)
  1172.     equateLoc(curFile,locB,atCursor)
  1173.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  1174.     if (!eqLoc(curFile,locB,atCursor)) {
  1175.         equateLoc(curFile,locA,atCursor)
  1176.         insertRgn(UNDO_BUF,sFile,curFile,loc)
  1177.         clearRgn(curFile,loc)
  1178.     } else equateLoc(curFile,locA,atCursor)
  1179.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1180.     moveCursor(curFile,eChar)
  1181.     equateLoc(curFile,locB,atCursor)
  1182.     insertRgn(UNDO_BUF,eFile,curFile,loc)
  1183.     equateLoc(UNDO_BUF,sPage,sFile)
  1184.     clearRgn(curFile,loc) >
  1185.  
  1186. Set the delay variable to some value in tenths of seconds
  1187. <shftAlt-d:
  1188.     putMsg("Input # tenths of seconds (used in delays)")
  1189.     inputNum(DELAY_TIME) >
  1190.  
  1191. Change end-of-line character
  1192. <alt-e:
  1193.     putMsg("Input new end-of-line value (usually 10 or 13):")
  1194.     inputNum(N_4)
  1195.     setEol(N_4)
  1196.     refreshDisplay >
  1197.  
  1198. Change current document's end-of-line character
  1199. <ctl-e:
  1200.     putMsg("Input file's current end-of-line value (usually 10 or 13):")
  1201.     inputNum(N_4)
  1202.     if (!gtNum(N_4,0)) returnFalse
  1203.     putMsg("Input new end-of-line value (usually 10 or 13):")
  1204.     inputNum(N_3)
  1205.     if (!gtNum(N_3,0)) returnFalse
  1206.     setEol(N_4)
  1207.     moveCursor(curFile,sFile)
  1208.     putMsg("Changing eol characters... Amiga-ESC=abort.")
  1209.     if (is(curFile,N_4)) swapChar(curFile,N_3)
  1210.     while (moveCursor(curFile,eLine))
  1211.         if (is(curFile,N_4)) swapChar(curFile,N_3)
  1212.     setEol(N_3)
  1213.     vScroll(sFile)
  1214.     putMsg("")
  1215.     refreshDisplay >
  1216.  
  1217. Input the number of buffer to free
  1218. <alt-f:
  1219.     putMsg("Input buffer # to free:")
  1220.     if (inputNum(N_4)) freeBuf(buf[N_4]) >
  1221.  
  1222. Flip upper/lower case of char under cursor
  1223. <ctl-f:
  1224.     if (is(curFile,alpha)) {
  1225.         if (is(curFile,lowerCase)) toUpper(curFile)
  1226.         else toLower(curFile)
  1227.     }
  1228.     moveCursor(curFile,eChar) >
  1229.  
  1230. Ask for new font name & size and change font
  1231. <shftAlt-f:
  1232.     putMsg("Input font name (such as Topaz):")
  1233.     freebuf(B_4)
  1234.     if (inputString(B_4)) {
  1235.         putMsg("Input font character height (such as 8):")
  1236.         if (inputNum(N_4) & gtNum(N_4,5) & gtNum(33,N_4)) setFont(B_4,N_4)
  1237.         else returnFalse
  1238.     } else returnFalse
  1239.     toggle(toTiny)
  1240.     toggle(toTiny)
  1241.     runkey(startup)
  1242. >
  1243.  
  1244. Input a new lines/page value
  1245. <alt-g:
  1246.     putMsg("Enter new lines/page setting:")
  1247.     inputNum(N_4)
  1248.     if (gtNum(N_4,0)) {
  1249.         setLocal(curFile,pageLines,N_4)
  1250.         equateNum(pageLines,N_4)
  1251.     } >
  1252.  
  1253. Uncolor the hilite region
  1254. <alt-h: equateLoc(curFile,sHilite,eHilite) refreshDisplay >
  1255.  
  1256. Erase hilite region.  No Copy is made!
  1257. <ctl-h: clearRgn(curFile,hilite) vscroll(atCursor) >
  1258.  
  1259. Uncolor the invert region
  1260. <alt-i: equateLoc(curFile,sInvert,eInvert) refreshDisplay >
  1261.  
  1262. Erase the invert region.  No Copy is made!
  1263. <ctl-i: clearRgn(curFile,invert) >
  1264.  
  1265. Scan index buffer, build an index.  (See shftAlt-buttonDown/buttonUp.)
  1266. <shftAlt-i:
  1267.     if (isEmpty(SWAP_BUF)) returnFalse
  1268.  
  1269.     runKey(alt-g)            .. Could elim.  get lines-per-page setting to use
  1270.     freeBuf(B_4)
  1271.     putMsg("Working....")                    .. erase duplicate items in SWAP_BUF
  1272. label(10)                                               .. get next index item
  1273.     moveCursor(SWAP_BUF,sFile)
  1274.     while (is(SWAP_BUF,whiteSpace)) clearChar(SWAP_BUF)     .. clear any blank lines
  1275.     if (is(SWAP_BUF,eFile)) goto label(11)            .. done finding duplicates
  1276.     equateLoc(SWAP_BUF,sInvert,atCursor)                            .. mark start
  1277.     moveCursor(SWAP_BUF,downLine)
  1278.     equateLoc(SWAP_BUF,eInvert,atCursor)                              .. mark end
  1279.     freeBuf(B_0)
  1280.     insertRgn(B_0,eFile,SWAP_BUF,invert)                 .. copy item to B_0
  1281.     clearRgn(SWAP_BUF,invert)                                .. erase from SWAP_BUF
  1282.     insertRgn(B_4,eFile,B_0,all)                       .. add it to B_4
  1283.     moveCursor(SWAP_BUF,eFile)                           .. search bkwd for dups
  1284.     setSearch(B_0)
  1285.     while (search(SWAP_BUF,sInvert,eInvert,-1)) clearRgn(SWAP_BUF,invert).. del dup
  1286.     goto label(10)                  .. get next item, unless SWAP_BUF empty now.
  1287. label(11)
  1288.     freeBuf(SWAP_BUF)                                           .. starting over
  1289.     insertRgn(SWAP_BUF,eFile,B_4,all)            .. store no-dup list in SWAP_BUF
  1290.     freeBuf(B_4)                                 .. erase old list in B_4
  1291. label(1)                            .. NOTE: should have used swapBuf instead
  1292.     moveCursor(SWAP_BUF,sFile)
  1293.     while (is(SWAP_BUF,whiteSpace)) clearChar(SWAP_BUF)    .. clear lead white space
  1294.     if (is(SWAP_BUF,eFile)) {                   .. SWAP_BUF empty, must be finished
  1295.         swapBuf(B_4,SWAP_BUF)                            .. index was in B_4
  1296.         freeBuf(B_4)
  1297.         setFileName(SWAP_BUF,"Index")
  1298.         equateLoc(SWAP_BUF,sPage,sFile)
  1299.         equateLoc(SWAP_BUF,atCursor,sFile)
  1300.         putMsg("Press ctl-w to see Index")                        .. finished
  1301.         return
  1302.     }
  1303.     freeBuf(B_0)
  1304.     insertRgn(B_0,sFile,SWAP_BUF,line)         .. load search string with item.
  1305.     clearRgn(SWAP_BUF,line)                                    .. erase the item
  1306.     putMsg(B_0)                                             .. show the item
  1307.     moveCursor(B_4,eFile)              .. put item at end of index building
  1308.     insertRgn(B_4,eFile,B_0,all)
  1309.     insertRgn(B_4,eFile,"  ",all)        .. space before page #s that go in
  1310.     insertChar(B_4,eLine)
  1311.     moveCursor(B_4,sChar)
  1312.     equateNum(N_3,0)                                 .. so know if need comma
  1313.     moveCursor(curFile,sFile)
  1314.     label(2)
  1315.     setSearch(B_0)
  1316.     while (search(curFile,sInvert,eInvert,1)) {
  1317.         moveCursor(curFile,sChar)
  1318.         if (is(curFile,alpha)) {
  1319.             label(3)                       .. part of a bigger word so ignore
  1320.             moveCursor(curFile,eInvert)
  1321.             goto label(2)                                 .. and resume search
  1322.         }
  1323.         if (is(curFile,digit)) goto label(3)   .. part of bigger word, ignore
  1324.         moveCursor(curFile,eInvert)
  1325.         if (is(curFile,alpha)
  1326.              | is(curFile,digit)) goto label(2).. part of bigger word, ignore
  1327.         getPageRowCol(N_4,N_0,N_5)                       .. this uses display
  1328.         moveCursor(curFile,eForm)           .. don't search again on this page
  1329.         if (!eqNum(N_3,0)) insertChar(B_4,",")    .. put comma if not 1st #
  1330.         toWord(B_4,N_4)               .. install the page # after index item
  1331.         equateNum(N_3,N_4)         .. so will put in comma next time for sure
  1332.     }
  1333.     goto label(1)                                  .. get next item from SWAP_BUF
  1334. >
  1335.  
  1336. Enter idle-timer value (tenths of sec) after which idle command executed
  1337. <shftAltCtl-i:
  1338.     putMsg("Input idle time (tenths of a second)")
  1339.     if (inputNum(N_4)) equateNum(idleTime,N_4)>
  1340.  
  1341. Join next line to cursor line
  1342. <ctl-j:
  1343.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1344.     clearChar(curFile)
  1345.     while (is(curFile,space) | is(curFile,9)) clearChar(curFile)
  1346.     insertChar(curFile," ") >
  1347.  
  1348. Move the hilite to the left by one character (space or tab)
  1349. <alt-l:
  1350.     moveCursor(curFile,sHilite)
  1351.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  1352. label(1)
  1353.     if (is(curFile,space) | is(curFile,9)) clearChar(curFile)
  1354.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1355.     moveCursor(curFile,eChar)                            .. start of next line
  1356.     if (gtLoc(curFile,eHilite,atCursor)) goto label(1) >
  1357.  
  1358. Convert the character under the cursor to lower case and move cursor fwd
  1359. <ctl-l:
  1360.     toLower(curFile)
  1361.     moveCursor(curFile,eChar) >
  1362.  
  1363. Set bottom margin
  1364. <lAmiga-l:
  1365.     putMsg("Input bottom margin lines (0-200):")
  1366.     if (inputNum(N_4)) equateNum(bottomMargin,N_4)
  1367.     setLocal(curFile,bottomMargin,bottomMargin)>
  1368.  
  1369. Set command multiplier to use for next command
  1370. <ctl-m: putMsg("Input command multiplier:") inputNum(cmdMultiplier) >
  1371.  
  1372. Swap the mouse's button-Up operation with the next key-command pressed
  1373. <alt-m:
  1374.     putMsg("Will swap mouse buttonUp with your next input:")
  1375.     getKey(N_3)
  1376.     if (swapKey(N_3,normal-buttonUp)) {
  1377.         putMsg("Swapped - to undo, do it again")
  1378.         return
  1379.     }
  1380.     putMsg("") >
  1381.  
  1382. Rename the document in the window
  1383. <alt-n:
  1384.     putMsg("Input new filename:")
  1385.     getFileName(FILE_NAME,curFile)
  1386.     if (inputString(FILE_NAME))
  1387.     setFileName(curFile,FILE_NAME) >
  1388.  
  1389. Input a text line number to go to
  1390. <ctl-n:
  1391.     putMsg("Input line number:")
  1392.     if (inputNum(N_4)) {
  1393.         lineToLoc(curFile,atCursor,N_4)
  1394.         vScroll(atCursor)
  1395.     } >
  1396.  
  1397. Open the cursor line for typing
  1398. <ctl-o:
  1399.     insertChar(curFile,eLine)
  1400.     moveCursor(curFile,sChar) >
  1401.  
  1402. Switch to next "Favorite" file
  1403. <lAmiga-q: toggle(favorite) >
  1404.  
  1405. Move the hilite region to the right by one space
  1406. <alt-r:
  1407.     moveCursor(curFile,sHilite)
  1408.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  1409.     while (gtLoc(curFile,eHilite,atCursor)) {
  1410.         insertChar(curFile,32)
  1411.         if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1412.         moveCursor(curFile,eChar)
  1413.     } >
  1414.  
  1415. Terminate Learn Mode or run whatever is stored in learn-buffer.  (See ctl-s.)
  1416. <ctl-r: runLearn  >
  1417.  
  1418. Speak the hilite region
  1419. <alt-s:
  1420.     if (gtLoc(curFile,eHilite,sHilite)) {
  1421.         freeBuf(B_0)
  1422.         insertRgn(B_0,eFile,curFile,hilite)
  1423.         speak(B_0)
  1424.     } >
  1425.  
  1426. Start/abort Learn Mode.  (Use ctl-r to finish & to run it.)
  1427. <ctl-s:
  1428.     if (!getFlag(curFile,learnMode)) putMsg("LEARN MODE ACTIVE!")
  1429.     else putMsg("Learn Mode cancelled.")
  1430.     flipFlag(curFile,learnMode) >
  1431.  
  1432. Line sort.
  1433. <shftAlt-s:
  1434.     moveCursor(curFile,eFile)
  1435.     if (!is(curFile,sLine)) insertChar(curFile,eLine)
  1436.     sortLines(curFile,0)
  1437. >
  1438.  
  1439. Show key-help message on next key pressed.  Copy key-help to RAM: on first
  1440. <ctl-t:
  1441.     putMsg("Input a key, gadget, click etc to get Help msg")
  1442.     getKey(N_4)
  1443.     teachOne(N_4)>
  1444.  
  1445. Load UStar config
  1446. <virtual-u:
  1447.     if (!loadConfig("UstarData!")) loadConfig("S:UstarData!") >
  1448.  
  1449. Convert char under cursor to upper case
  1450. <ctl-u:
  1451.     toUpper(curFile)
  1452.     moveCursor(curFile,eChar) >
  1453.  
  1454. Set left margin
  1455. <lAmiga-k:
  1456.     putMsg("Input left margin column (0-200):")
  1457.     if (inputNum(N_4)) equateNum(leftMargin,N_4)
  1458.     setLocal(curFile,leftMargin,leftMargin)>
  1459.  
  1460. Set top margin
  1461. <lAmiga-u:
  1462.     putMsg("Input top margin lines (0-200):")
  1463.     if (inputNum(N_4)) equateNum(topMargin,N_4)
  1464.     setLocal(curFile,topMargin,topMargin)>
  1465.  
  1466. Swap the current document in window with buffer 41
  1467. <ctl-w: swapBuf(curFile,SWAP_BUF) >
  1468.  
  1469. Swap current buffer to buffer 0 (the "home" buffer of Uedit)
  1470. <alt-w:
  1471.     swapBuf(HOME_BUF,curFile)
  1472.     editBuf(HOME_BUF) >
  1473.  
  1474. For programmers:  Toggle number under cursor between hex/decimal
  1475. <ctl-x: hexDecimal(curFile) >
  1476.  
  1477. Execute an AmigaDOS command, but don't collect the results
  1478. <ctl-y:
  1479.     putMsg("Enter AmigaDOS command")
  1480.     freeBuf(DOS_CMD)
  1481.     if (inputString(DOS_CMD)) execute(" ",DOS_CMD) >
  1482.  
  1483. Execute an AmigaDOS command and show the results
  1484. <ctl-z:
  1485.     putMsg("Enter AmigaDOS command")
  1486.     freeBuf(DOS_CMD)
  1487.     freeBuf(DOS_RESULT)
  1488.     if (!inputString(DOS_CMD) | !execute(DOS_RESULT,DOS_CMD)) returnFalse
  1489.     if (!isEmpty(DOS_RESULT)) {
  1490.         putMsg("Result of AmigaDOS command:")
  1491.         downFlag(DOS_RESULT,changed)
  1492.         editBuf(DOS_RESULT)
  1493.         vscroll(sFile)
  1494.         updateDisplay
  1495.         return
  1496.     }
  1497.     putMsg("No reply from AmigaDOS.")
  1498.     freeBuf(DOS_RESULT) >
  1499.  
  1500. Get listing. (Also sets directoryname used in ctl-buttonDown.)
  1501. <alt-z:
  1502.     putMsg("Enter directory: ")
  1503.     freeBuf(B_3)
  1504.     if (inputString(B_3)) runKey(virtual-7)
  1505.     freeBuf(B_4)
  1506.     insertRgn(B_4,eFile,"Dir ",all)
  1507.     insertRgn(B_4,eFile,DIR_NAMES,hilite)
  1508.     if (!execute(DOS_RESULT,B_4)) returnFalse
  1509.     moveCursor(DOS_RESULT,sFile)
  1510.     insertChar(DOS_RESULT,eLine)
  1511.     insertRgn(DOS_RESULT,sFile,DIR_NAMES,hilite)
  1512.     newFile
  1513.     swapBuf(DOS_RESULT,curFile)
  1514.     freeBuf(DOS_RESULT)
  1515.     vScroll(sFile)
  1516.     putMsg("To load files, ctrl-click names with mouse.")
  1517.     setFileName(curFile,B_4)
  1518.     downFlag(curFile,changed) >
  1519.  
  1520. Change the current working directory
  1521. <altCtl-z:
  1522.     putMsg("Change current directory to (may not work in Workbench):")
  1523.     freeBuf(B_3)
  1524.     if (inputString(B_3)) changeDir(B_3) >
  1525.  
  1526. Clear leading white space in cursor line
  1527. <alt-1:
  1528.     equateLoc(curFile,locA,atCursor)
  1529.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  1530.     while (is(curFile,whiteSpace) & !is(curFile,eLine) & !is(curFile,12))
  1531.                 clearChar(curFile)
  1532.     equateLoc(curFile,atCursor,locA) >
  1533.  
  1534. Center text in the line.  (Uses current line length.)
  1535. <alt-2:
  1536.     runKey(alt-1)                                 .. clear leading white space
  1537.     if (is(curFile,blankLine)) returnFalse
  1538.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1539.     locToCol(curFile,N_3,atCursor)
  1540.     getLocal(curFile,N_4,lineLength)
  1541.     if (gtNum(N_4,N_3)) {
  1542.         moveCursor(curFile,sLine)
  1543.         incNum(N_4)
  1544.         sub(N_3,N_4,N_3)
  1545.         div(N_3,N_3,2)
  1546.         do (N_4,1,N_3) insertChar(curFile," ")
  1547.     } >
  1548.  
  1549. Match indent of cursor line to previous line
  1550. <alt-4:
  1551.     equateNum(N_4,0)
  1552.     moveCursor(curFile,upLine)
  1553.     if (!getFlag(curFile,autoIndent)) {
  1554.         flipFlag(curFile,autoIndent)
  1555.         equateNum(N_4,1)
  1556.     }
  1557.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1558.     clearChar(curFile)
  1559.     typeChar(eLine)
  1560.     if (eqNum(N_4,1)) flipFlag(curFile,autoIndent)
  1561.     moveCursor(curFile,downLine) >
  1562.  
  1563. Right-align the cursor line from cursor rightward
  1564. <alt-5:
  1565.     if (!is(curFile,whiteSpace)) moveCursor(curFile,sChar)
  1566.     if (is(curFile,eLine)) return
  1567.     while (is(curFile,whiteSpace) & !is(curFile,sLine)) {
  1568.         clearChar(curFile)
  1569.         moveCursor(curFile,sChar)
  1570.     }
  1571.     moveCursor(curFile,eChar)
  1572.     equateLoc(curFile,locA,atCursor)
  1573.     if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1574.     locToCol(curFile,N_4,atCursor)
  1575.     decNum(N_4)
  1576.     getLocal(curFile,N_3,lineLength)
  1577.     sub(N_4,N_3,N_4)
  1578.     moveCursor(curFile,locA)
  1579.     if (gtNum(N_4,0)) while (decNum(N_4)) insertChar(curFile," ") >
  1580.  
  1581. Show the value of a number variable
  1582. <alt-8:
  1583.     putMsg("n-variable #: ")
  1584.     inputNum(N_4)
  1585.     freeBuf(B_4)
  1586.     insertChar(B_4,"n")
  1587.     toWord(B_4,N_4)
  1588.     insertRgn(B_4,eFile," is ",all)
  1589.     toWord(B_4,n[N_4])
  1590.     putMsg(B_4) >
  1591.  
  1592. Save key command of next key pressed to RAM:pData
  1593. <rAmiga-8:
  1594.     putMsg("Press key to save:")
  1595.     if (getKey(N_4)) saveKeys("RAM:pData",N_4,0)
  1596.     putMsg("")
  1597. >
  1598.  
  1599.  
  1600. Restore key command of next key pressed from RAM:pData
  1601. <rAmiga-9:
  1602.     putMsg("Press key to restore:")
  1603.     if (getKey(N_4)) loadKeys("RAM:pData",N_4,0)
  1604.     putMsg("")
  1605. >
  1606.  
  1607. Set the value of a number variable
  1608. <alt-9:
  1609.     putMsg("Set n-variable #:")
  1610.     inputNum(N_4)
  1611.     putMsg("To value:")
  1612.     inputNum(n[N_4])>
  1613.  
  1614. Show the ASCII value of the character under the cursor
  1615. <ctl-/:
  1616.     copyChar(curFile,N_4)
  1617.     freeBuf(B_4)
  1618.     toWord(B_4,N_4)
  1619.     insertRgn(B_4,sFile,"Character value under cursor was ",all)
  1620.     putMsg(B_4)
  1621.     moveCursor(curFile,eChar) >
  1622.  
  1623. Show the current document size
  1624. <ctl-1:
  1625.     fileSize(curFile,N_4)
  1626.     freeBuf(B_4)
  1627.     insertRgn(B_4,sFile,"File size in bytes: ",all)
  1628.     toWord(B_4,N_4)
  1629.     putMsg(B_4)>
  1630.  
  1631. This is a simple reformat cmd that doesn't refmt indented paragraphs.
  1632. .. <ctl-3: if (reformat) moveCursor(curFile,downLine) >
  1633.  
  1634. Reformat cursor paragraph, starting at cursor line
  1635. <ctl-3:                   .. move down, if blank line, to find par beginning.
  1636.     while (is(curFile,blankLine)) {
  1637.         moveCursor(curFile,downLine)
  1638.         if (!is(curFile,eLine)) moveCursor(curFile,eLine)
  1639.         if (is(curFile,eFile)) returnFalse
  1640.     }
  1641.     equateNum(N_6,0)                                      .. a flag used below
  1642.     equateLoc(curFile,locA,atCursor)                   .. store par beginning
  1643. label(2)                                        .. get indent of 1st par line
  1644.     if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  1645.     while (is(curFile,whiteSpace)) moveCursor(curFile,eChar)
  1646.     locToCol(curFile,N_7,atCursor)                 .. get the 1st line's indent
  1647.  
  1648.     if (eqNum(N_6,0)) {                                 .. if doing FIRST line
  1649.         equateNum(N_1,N_7)                      .. store indent of 1st par line
  1650.         equateNum(N_6,1)                 .. set a flag so won't come back here
  1651.         equateLoc(curFile,locB,atCursor)           .. store 1st text location
  1652.         moveCursor(curFile,downLine)                      .. move to 2nd line
  1653.         if (is(curFile,blankLine)) {                        .. no second line
  1654.             equateNum(N_7,1)
  1655.             goto label(3)
  1656.         }
  1657.         goto label(2)                .. go back and get indent of 2nd par line
  1658.     }
  1659. label(3)
  1660.     moveCursor(curFile,upLine)                       .. move back to 1st line
  1661.     equateNum(N_0,N_7)                              .. store indent of 2nd line
  1662.  
  1663.     if (eqNum(N_0,-1) | geNum(N_0,N_1)) {                  .. was no 2nd line or
  1664.         reformat                       .. 2nd line inset, so do only 1st line
  1665.         goto label(5)                                              .. finished
  1666.     } else {                             .. 2nd line has less or equal indent
  1667.         sub(N_1,N_1,N_0)                     .. par indent = 1st indent minus 2nd
  1668.         colToLoc(curFile,atCursor,N_0)
  1669.         equateLoc(curFile,locA,atCursor)
  1670.         freeBuf(B_4)
  1671.         insertRgn(B_4,eFile,curFile,loc)
  1672.         clearRgn(curFile,loc)              .. wiping out extra 1st line indent
  1673.         do (N_4,1,N_1) insertChar(curFile,"x")                 .. repl with x's
  1674.         moveCursor(curFile,sWord)                          .. made a FAKE WORD
  1675.         equateLoc(curFile,locA,atCursor)                     .. store its loc
  1676.         reformat                              .. now paragrah has SAME indent
  1677.         equateLoc(curFile,locB,atCursor)                  .. store end of par
  1678.         moveCursor(curFile,locA)                      .. go back to fake word
  1679.         while (is(curFile,"x")) clearChar(curFile)
  1680.         insertRgn(curFile,atCursor,B_4,all) .. swap x's for indentation
  1681.         equateLoc(curFile,atCursor,locB)                   .. goto end of par
  1682. label(5)
  1683.         moveCursor(curFile,downLine)                       .. leave paragraph
  1684.     }
  1685. >
  1686.  
  1687. Delete all trailing white-space in current document
  1688. <ctl-4:
  1689.     equateLoc(curFile,locA,atCursor)
  1690.     moveCursor(curFile,sFile)
  1691.     while (nothing) {
  1692.         if (is(curFile,eFile))
  1693.             { equateLoc(curFile,atCursor,locA) return }
  1694.         moveCursor(curFile,eLine)
  1695.         moveCursor(curFile,sChar)
  1696.         while (is(curFile,space) | is(curFile,9))
  1697.             { clearChar(curFile) moveCursor(curFile,sChar) }
  1698.         moveCursor(curFile,eLine)
  1699.     } >
  1700.  
  1701. Save a learn-sequence to disk, saving it under a Name
  1702. <ctl-5:
  1703.     putMsg("Save learn seq under what Name?")
  1704.     freeBuf(B_4)
  1705.     if (inputString(B_4) & !saveLearn(B_4))
  1706.                 putMsg("Couldn't save") >
  1707.  
  1708. Load a learn-sequence stored on disk
  1709. <ctl-6:
  1710.     putMsg("Load what learn seq Name?")
  1711.     freeBuf(B_4)
  1712.     if (inputString(B_4) & !loadLearn(B_4))
  1713.                 putMsg("Not found") >
  1714.  
  1715. Load and run learn-sequence stored on disk
  1716. <ctl-7:
  1717.     putMsg("Load & run what learn seq Name?")
  1718.     freeBuf(B_4)
  1719.     if (inputString(B_4) & loadLearn(B_4)) runLearn
  1720.     else putMsg("Not found") >
  1721.  
  1722.                         *** arithmetic commands ***
  1723.  
  1724. Set running arithmetic total to zero
  1725. <ctl-0: equateNum(SUM_TOTAL,0) >
  1726.  
  1727. Type the running arithmetic total into text at cursor
  1728. <ctl-\:
  1729.     freeBuf(B_4)
  1730.     div(N_2,SUM_TOTAL,100)
  1731.     if (gtNum(0,SUM_TOTAL)) if (eqNum(N_2,0)) insertChar(B_4,"-")
  1732.     toWord(B_4,N_2)
  1733.     insertChar(B_4,".")
  1734.     if (gtNum(0,SUM_TOTAL)) mul(N_2,SUM_TOTAL,-1)
  1735.     else equateNum(N_2,SUM_TOTAL)
  1736.     mod(N_2,N_2,100)
  1737.     if (gtNum(10,N_2)) insertChar(B_4,"0")
  1738.     toWord(B_4,N_2)
  1739.     insertRgn(curFile,atCursor,B_4,all)
  1740.     insertRgn(B_4,sFile,"Inserted total into text ",all)
  1741.     putMsg(B_4) >
  1742.  
  1743. Add the next word (if a number) to arithmetic total & display total
  1744. <ctl-=:
  1745.     moveCursor(curFile,eWord)
  1746.     moveCursor(curFile,sWord)
  1747.     if (!is(curFile,digit)) { moveCursor(curfile,eword) returnFalse }
  1748.     toNumber(N_4,curFile)
  1749.     moveCursor(curFile,eWord)
  1750.     if (is(curFile,".")) {
  1751.         moveCursor(curFile,eChar)
  1752.         if (!is(curFile,digit)) goto label(1)
  1753.         toNumber(N_3,curFile)
  1754.         moveCursor(curFile,eChar)
  1755.         if (!is(curFile,digit)) {
  1756.             mul(N_3,N_3,10)
  1757.             moveCursor(curFile,sChar)
  1758.         }
  1759.         moveCursor(curFile,eWord)
  1760.     } else { label(1) equateNum(N_3,0) }
  1761.     mul(N_4,N_4,100)
  1762.     if (gtNum(0,N_4)) mul(N_2,N_3,-1)
  1763.     else equateNum(N_2,N_3)
  1764.     add(N_4,N_4,N_2)
  1765.     add(SUM_TOTAL,SUM_TOTAL,N_4)
  1766.     freeBuf(B_4)
  1767.     div(N_2,SUM_TOTAL,100)
  1768.     if (gtNum(0,SUM_TOTAL) & eqNum(N_2,0)) insertChar(B_4,"-")
  1769.     toWord(B_4,N_2)
  1770.     insertChar(B_4,".")
  1771.     mod(N_2,SUM_TOTAL,100)
  1772.     if (gtNum(0,SUM_TOTAL)) mul(N_2,-1,N_2)
  1773.     if (gtNum(10,N_2)) insertChar(B_4,"0")
  1774.     toWord(B_4,N_2)
  1775.     insertRgn(B_4,sFile,"Running total is ",all)
  1776.     putMsg(B_4) >
  1777.  
  1778. Subtract the next word (if a number) from arithmetic total & display total
  1779. <ctl--:
  1780.     moveCursor(curFile,eWord)
  1781.     moveCursor(curFile,sWord)
  1782.     if (!is(curFile,digit)) { moveCursor(curfile,eword) returnFalse }
  1783.     toNumber(N_4,curFile)
  1784.     moveCursor(curFile,eWord)
  1785.     if (is(curFile,".")) {
  1786.         moveCursor(curFile,eChar)
  1787.         if (!is(curFile,digit)) goto label(1)
  1788.         toNumber(N_3,curFile)
  1789.         moveCursor(curFile,eChar)
  1790.         if (!is(curFile,digit)) {
  1791.             mul(N_3,N_3,10)
  1792.             moveCursor(curFile,sChar)
  1793.         }
  1794.         moveCursor(curFile,eWord)
  1795.     } else {
  1796. label(1)
  1797.         equateNum(N_3,0)
  1798.     }
  1799.     mul(N_4,N_4,100)
  1800.     if (gtNum(0,N_4)) mul(N_2,N_3,-1)
  1801.     else equateNum(N_2,N_3)
  1802.     add(N_4,N_4,N_2)
  1803.     sub(SUM_TOTAL,SUM_TOTAL,N_4)
  1804.     freeBuf(B_4)
  1805.     div(N_2,SUM_TOTAL,100)
  1806.     if (gtNum(0,SUM_TOTAL) & eqNum(N_2,0)) insertChar(B_4,"-")
  1807.     if (gtNum(0,SUM_TOTAL)) insertChar(B_4,"-")
  1808.     toWord(B_4,N_2)
  1809.     insertChar(B_4,".")
  1810.     mod(N_2,SUM_TOTAL,100)
  1811.     if (gtNum(0,N_2)) mul(N_2,N_2,-1)
  1812.     if (gtNum(10,N_2)) insertChar(B_4,"0")
  1813.     toWord(B_4,N_2)
  1814.     insertRgn(B_4,sFile,"Running total is ",all)
  1815.     putMsg(B_4) >
  1816.  
  1817.                            *** columnar data ***
  1818.  
  1819. Put up msg saying turn ON columnar if it is OFF.
  1820. <virtual-`:
  1821.     if (!getFlag(curFile,columnar)) {
  1822.         alertUser("Turn ON columnar display mode first.  (See Columnar menu.)")
  1823.         abort
  1824.     } >
  1825.  
  1826. Copy and then clear the hilited columnar data
  1827. <shftCtl-1:
  1828.     runKey(virtual-`)
  1829.     freeBuf(COLUMNAR_BUF)
  1830.     copyColData(COLUMNAR_BUF,sFile,curFile,hilite,1)
  1831.     clearColData(curFile,hilite,0)  >
  1832.  
  1833. Space-fill the hilited columnar data, overlaying the original text.  No copy
  1834. <shftCtl-2:
  1835.     runKey(virtual-`)
  1836.     clearColData(curFile,hilite,1) >
  1837.  
  1838. Copy the hilited columnar data into a buffer
  1839. <shftCtl-3:
  1840.     runKey(virtual-`)
  1841.     if (geLoc(curFile,sHilite,eHilite)) returnFalse
  1842.     freeBuf(COLUMNAR_BUF)
  1843.     copyColData(COLUMNAR_BUF,sFile,curFile,hilite,1)>
  1844.  
  1845. Insert copied columnar data at the cursor
  1846. <shftCtl-4:
  1847.     runKey(virtual-`)
  1848.     copyColData(curFile,atCursor,COLUMNAR_BUF,all,1)>
  1849.  
  1850. Overlay copied columnar data onto existing text at the cursor
  1851. <shftCtl-5:
  1852.     runKey(virtual-`)
  1853.     copyColData(curFile,atCursor,COLUMNAR_BUF,all,0)>
  1854.  
  1855. Insert the columnar hilite region at the cursor.  (No intermediate copy.)
  1856. <shftCtl-6:
  1857.     runKey(virtual-`)
  1858.     copyColData(curFile,atCursor,curFile,hilite,1)>
  1859.  
  1860. Overlay the columnar hilite region onto existing text at the cursor
  1861. <shftCtl-7:
  1862.     runKey(virtual-`)
  1863.     copyColData(curFile,atCursor,curFile,hilite,0)>
  1864.  
  1865.                  *** screen types (regular & interlace) ***
  1866.  
  1867. Switch among screen types
  1868. <shft-esc: flipFlag(curFile,lace) toggle(toTiny) toggle(toTiny) >
  1869.  
  1870. Switch to regular screen, 1 bitplane
  1871. <rAmiga-f1: setLocal(curfile, lace, 1) toggle(toTiny) toggle(toTiny) >
  1872.  
  1873. Switch to regular screen, 2 bitplanes
  1874. <rAmiga-f2: setLocal(curfile, lace, 0) toggle(toTiny) toggle(toTiny) >
  1875.  
  1876. Switch to interlace screen, 1 bitplane
  1877. <rAmiga-f3: setLocal(curfile, lace, 3) toggle(toTiny) toggle(toTiny) >
  1878.  
  1879. Switch to interlace screen, 2 bitplanes
  1880. <rAmiga-f4: setLocal(curfile, lace, 2) toggle(toTiny) toggle(toTiny) >
  1881.  
  1882. Assign a name to one of the 4 gadgets (1-4)
  1883. <ctl-esc:
  1884.     putMsg("Enter gadget number (1-4):")
  1885.     if (!inputNum(N_4) | gtNum(N_4,4) | gtNum(1,N_4)) returnFalse
  1886.     putMsg("Enter gadget name (one Space to clear):")
  1887.     freeBuf(B_4)
  1888.     inputString(B_4)
  1889.     if (!isEmpty(B_4)) {
  1890.         gadgetName(N_4,B_4)
  1891.         putMsg("")
  1892.     } >
  1893.  
  1894. Uedit's About... msg
  1895. <shftAltCtl-a:
  1896.     define(top_margin,20)
  1897.     define(side_margin,10)
  1898.     define(bottom_margin,10)
  1899.     updatedisplay
  1900.  
  1901.     while (inputKey(N_4)) nothing
  1902. ... display on blank screen:
  1903.     text("",1,0,0,-2)
  1904.     putMsg("                               About Uedit...")
  1905.  
  1906.     sub(N_0,sWidth,10)                          .. max X for our display
  1907.     sub(N_1,sHeight,10)                         .. max Y
  1908.  
  1909.     do(N_2,20,N_1) {
  1910.       draw(side_margin,top_margin,-1,2,0)
  1911.       draw(N_0,N_2,-1,2,1)
  1912.     }
  1913.  
  1914.     do(N_2,10,N_0) {                            .. 20 is top_margin here
  1915.       draw(10,top_margin,-1,2,0)                        .. side_margin, top_margin
  1916.       draw(N_2,N_1,-1,2,1)
  1917.     }
  1918.  
  1919.     text("UEDIT",3,36,1,0)
  1920.     text("(for AMIGA & PC)",4,30,-1,0)
  1921.     text("(C) 1986-92 by Rick Stiles.   All rights reserved.",6,13,3,0)
  1922.     text("P.O. Box 666,",7,22,-1,0)
  1923.     text(" Washington, IN 47501",-1,-1,-1,0)
  1924.  
  1925.     text(" Uedit is a SHAREWARE programmable text editor for the ",9,10,1,0)
  1926.     text(" technical user.  See Uedit-Tutorial for general info  ",10,10,-1,0)
  1927.     text(" and instructions.                                     ",11,10,-1,0)
  1928.     text("                                                       ",12,10,-1,0)
  1929.     text(" Try Uedit and see how you like it.  If you USE it,    ",13,10,-1,0)
  1930.     text(" become a REGISTERED USER by getting the full package. ",14,10,-1,0)
  1931.     text(" See Uedit-Policy for price and registering info.      ",15,10,-1,0)
  1932.     getserialnum(N_4)
  1933.     text("s/n ",17,33,3,0)
  1934.     text(N_4,-1,-1,-1,0)
  1935.  
  1936.     while (!inputKey(N_4)) nothing
  1937.     sub(N_1,sWidth,50)
  1938.     sub(N_2,sHeight,50)                         .. lower limit of our display
  1939.     do(N_3,50,N_1) {
  1940.       draw(50,50,-1,2,0)                       ..set position of the focus
  1941.       draw(N_3,N_2,-1,2,1)
  1942.     }
  1943.     do(N_3,50,N_2) {
  1944.       draw(50,50,-1,2,0)
  1945.       draw(N_1,N_3,-1,2,1)
  1946.     }
  1947.     do(N_3,50,N_1) {
  1948.       draw(50,50,-1,2,0)                       ..set position of the focus
  1949.       draw(N_3,N_2,-1,2,1)
  1950.     }
  1951.     do(N_3,50,N_2) {
  1952.       draw(50,50,-1,2,0)
  1953.       draw(N_1,N_3,-1,2,1)
  1954.     }
  1955.     while (inputKey(N_4)) nothing
  1956.     fullRefresh
  1957.     putmsg("")
  1958. >
  1959.  
  1960.                                    *****
  1961.  
  1962. Assign new Primitive Mode terminator Ctrl-key
  1963. <normal-esc:
  1964.     putMsg("Enter new Primitive Mode terminator CTRL-key (pmESC)")
  1965.     if (getChar(N_4) & gtNum(32,N_4)) equateNum(pmESC,N_4)
  1966.     putMsg("") >
  1967.  
  1968. Save changed files during idle periods, if their idle-save flag is set
  1969. <idle:
  1970.     getMaxFiles(N_2)
  1971.     decNum(N_2)
  1972.     do (N_4,0,N_2) if (!inputWaiting & getflag(buf[N_4],changed)
  1973.         & getflag(buf[N_4],userLocalA)) saveFile(buf[N_4]) >
  1974.  
  1975.                           *** end of Config!M ***
  1976.  
  1977. <defines: >
  1978.