home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Applications / PlainText Folder / PlainText Worksheet next >
Encoding:
Text File  |  1994-10-26  |  23.7 KB  |  478 lines  |  [TEXT/MRPH]

  1. ;----------------------------------------------------------------------------
  2. ;                                 Worksheet
  3. ;
  4. ; Use this window as a scratch pad for keeping notes and as a space for 
  5. ; temporary and intermediate work. Its contents are saved between launches
  6. ; of the PlainText program. If you don’t like the idea of having a work-
  7. ; that is always open, select the “No Worksheet” option in the Edit Menu.
  8. ;
  9. ;                                            Mel Park, Memphis, Tennessee
  10. ;----------------------------------------------------------------------------
  11.  
  12.     This is the documentation for version 1.3.7 of PlainText.
  13.     
  14.     You should make a copy of this file and save it somewhere with a different
  15. name. One way of doing this is to select the “Save a Copy” item from the File 
  16. Menu. Name the copy “Original PlainText Worksheet” or some such.
  17.  
  18. File Menu
  19.     This is standard Mac stuff. PlainText will open any text file. Printing is
  20. pretty ordinary. There is no way to change print margins or lines per page.
  21. A short vertical line appears at the top of every text window which indicates 
  22. the recommended right margin. Text wrapped to this width will be centered on 
  23. the printed page. PlainText prints the page number at the bottom of every page.
  24.     
  25.     If you hold the option key down while selecting the Open menu item, then
  26. all files, not just text files, are displayed and can be opened. Files opened 
  27. in this way are read only. You can copy data from them to the clipboard but 
  28. not change them in any way.
  29.  
  30.     The “Save” menu item is only activated when a file has been changed by
  31. adding or removing characters. The term “dirty” is commonly used to describe 
  32. text files in this state. Non-editing changes, such as changing the font or 
  33. adding a mark do not dirty a file. However, all such changes, even scroll 
  34. position and selection range, are always saved to disk when you close a file. 
  35. So, don’t be surprised by disk activity when you close a file
  36. in which you have made no text changes.
  37.  
  38. Edit Menu
  39.     “Shift Right” and “Shift Left” add or remove one tab on each line or, 
  40. when word wrap is on, each paragraph within the selection region. At the 
  41. same time, it converts all space runs to the corresponding number of tabs.
  42. “Align” aligns all subsequent lines to the first line in the selection
  43. region.
  44.  
  45.     The Undo function provides the one level of undo that you expect with a
  46. Macintosh application. “No Worksheet” will close the worksheet window and
  47. set PlainText to not open a worksheet window in the future. It is reversed
  48. by the “Use Worksheet” menu item which becomes an option when there is no
  49. worksheet. When in the No-Worksheet mode, PlainText will open a blank untitled
  50. window, like most Mac applications, when lauched. The Format dialog of the Edit
  51. Menu is where you select fonts and font size, turn wordwrapping on or off (ON 
  52. is the default), select tab width, and show or not show invisible characters. 
  53. These settings are remembered for each document and retained between launches. 
  54. (Naturally, this is a Mac.)
  55.  
  56.     The “Format…” menu item calls a dialog for changing text font, text size,
  57. and certain preferences. The “Show Invisibles” check box prints ‘¿’ for all
  58. non-printing characters, ‘Δ’ for tabs, ‘¬’ for carriage returns, and ‘◊’
  59. for spaces. Automatic word wrap can be turned off or on and made to occur
  60. when text exceeds the width of the text’s window or a particular number of
  61. characters (Line Length). This line length parameter is also used for the
  62. “Hard Wrap to Length” item in the Convert Menu. The “Auto Indent” feature
  63. will look at the preceding line, when word wrap is off, or paragraph, when
  64. word wrap is on, and indent each new line to align with it. Clicking the
  65. okay button (or typing the return or enter key) applies those settings to
  66. the front window. Clicking the cancel button (or typing escape or
  67. command-period) cancels the dialog and does not make any changes to the
  68. front window. Clicking on the “All Files” button applies the settings to
  69. the front window and saves them as default settings that will be applied to
  70. all new windows and any foreign file that has not been previously opened by
  71. PlainText, MPW, or Alpha.
  72.  
  73. Find Menu
  74.     “Find, Replace…” implement the pretty standard and pretty intuitive search
  75. and replace functions for text windows. The search string can be a
  76. selection expression, that is, an expression that contains wildcards. (See
  77. the “Selection Expression” section, below. Try a search using *menu as the
  78. selection expression. Choose “Find…” and type “*menu” (without the quotes)
  79. and click the “Selection Expression” radio button. Now click the Find
  80. button (or hit the return key). See how a line containing “menu” has been
  81. found? Command-G repeats the search.
  82.  
  83.     If the selection expression is a number, it is interpreted as a line
  84. number. Try 86 as a selection expression.
  85.  
  86.     This line, the 86th in this window, will be selected.
  87.  
  88.     If you hold down the shift key when you choose any of the Find menu items,
  89. then the search will be in the reverse direction. This is handiest when
  90. used in conjunction with the keyboard equivalents command-H and command-G.
  91.  
  92.     “Cut Lines Containing…” and “Copy Lines Containing…” allow you to cut or 
  93. copy all lines, or paragraphs if word wrap is on, to the clipboard. Note that
  94. there are command line equivalents, “cutline and “copylines” (see below).
  95.  
  96. Mark Menu
  97.     Marks are like bookmarks that you can place in a text file so that you 
  98. can recall previous selections. When you select a mark from the Mark Menu, 
  99. the text corresponding to that mark is selected and the window scrolls to 
  100. show it. You can add new marks with the Mark menu item and remove them with
  101. Unmark. You can alphabetize the order in which marks are displayed in the
  102. Mark Menu by selecting the Alphabetize menu item. Selecting it again restores 
  103. the original order. Look at the Marks that I have made for this file by 
  104. opening the Marks Menu.
  105.  
  106. Window Menu
  107.     Stack and Tile Windows resize the windows in either a stack or tiled so
  108. that each window is visible on the screen. The remaining menu items are a 
  109. catalog of open windows. The menu item for the front window is checked. The 
  110. target window is indicated by the bullet symbol (•). Windows whose changes 
  111. have not yet been saved to disk are underlined.
  112.  
  113. Convert Menu
  114.     If you spot bugs in them, be sure to let me know. This set of functions,
  115. by the way, was selected from those I find myself using many times a day in
  116. Vantage, the desk accessory editor I have used for years. The big, full-
  117. featured editors, like Pete Keleher’s Alpha and BBEdit, by Rich Siegel, have 
  118. these features, plus many more, as well. Strip Linefeeds is the way to
  119. convert an MS/DOS text file to the Mac convention. Strip Controls removes
  120. all characters with an Ascii code of 31 or less, except carriage returns
  121. and tabs. Form Paragraphs and Straight to Curly Quotes gets it ready for
  122. pasting into a word processor. Hard Wrap to Window and Curly to Straight
  123. quotes reverses those steps, as when you want to prepare text for e-mail.
  124. Both Hard Wrap functions insert hard carriage returns at line ends, where a
  125. line end is either defined by the size of the window (Hard Wrap to Window)
  126. of the line length parameter set in the Format Dialog (Hard Wrap to
  127. Length).
  128.  
  129.     Besides being fast and able to handle even very large files, PlainText has
  130. these built-in features:
  131.  
  132.     1.    Double-clicking selects a whole word. Note that double-clicking
  133.         the space after a word selects the preceeding word and the space.
  134.         This is a bug that is close enough to being a feature that I am 
  135.         not fixing it.
  136.     2.    Triple-clicking selects a whole line.
  137.     3.    Double clicking on or just before a bracket or parenthesis (i.e. 
  138.         “[”, “{”, etc.) causes all the text between the bracket or 
  139.         parenthesis and its matching bracket or parenthesis to become 
  140.         selected.
  141.     4.    Cutting, pasting, and undoing are fully implemented.
  142.     5.    The arrow keys work to move the insertion point or selection (hold
  143.         the shift key down) in the expected ways.
  144.     6.    Command-option-uparrow moves the insertion point to the top of the
  145.         file. Command-option-downarrow does the opposite. Holding the shift
  146.         key down while doing either of these extends the selection to either
  147.         the top or bottom of the document.
  148.     7.    Command-right arrow moves the insertion point to the end of the 
  149.         current line. Option-right arrow moves the cursor by words. The left
  150.         arrow combinations work in the same way, of course, and holding the
  151.         shift key down with any of these combinations extends the selection.
  152.         This is the standard Macintosh use of the arrow keys.
  153.     8.    It is a command-line interpreter in its own right. Simply type a 
  154.         command that PlainText understands and then hit the enter (not
  155.         return) key. This will work in any text window.
  156.  
  157.         The following commands can be executed from any text window: 
  158.         ls (same as dir in DOS), cd (change directory), chcre (change file
  159.         creator), chtyp (change file type, copylines, cutlines, file, open,
  160.         find, line. “Open” opens the named file and makes it the front window.
  161.         File is similar except the window is made the target window (second
  162.         from front). “line n” selects selects the nth line of the target
  163.         window (n is a number. “Find exp” searchs the target window for the
  164.         string “exp.” If there are embedded spaces within the search string,
  165.         enclose it in double (") or single (') quotes. Enclosing the search
  166.         string with the right slash (/) will cause it to be interpreted as
  167.         a regular expression. (See “Selection Expressions,” below.) The same
  168.         rules apply for the search strings used for the "copylines" and
  169.         "cutlines" commands. If there is a standard set of lines, like
  170.         e-mail headers, that you need to remove from files on a regular
  171.         basis, save a list of appropriate cutlines commands in your work-
  172.         sheet.
  173.  
  174.         In summary, hitting the enter key causes the current line or current 
  175.         selection, whichever is smaller, to be interpreted as a command line.
  176.  
  177.         Commands implemented:
  178.  
  179.             cd             Change default directory (folder). Note, the Mac 
  180.                          file system uses the colon to designate the present 
  181.                          or higher folders. Thus “cd ::” changes the default
  182.                          directory one level up.
  183.             chcre         Change a file’s creator. For example, 
  184.                          chcre ‘MRPH’ ‘Current File’ makes PlainText the
  185.                          creator of the file named ‘Current File.’
  186.             chtyp         Change the file type of a file, using the same
  187.                          syntax (chtyp type filename) as chcre.
  188.             copylines ss copy all lines containing the search string, ss.
  189.             cutlines ss  cut all lines containing the search string
  190.             file         Open a file and make it the target
  191.             find ss         Find a string in the target window
  192.             ls             List a directory’s contents
  193.             ls -l         Give a full listing of a directory’s contents
  194.             line nn         Select line nn in the target window
  195.             open ff         Open a file
  196.             stats         Prints the statistics of the target window
  197.  
  198. Target Window
  199.     Note that the “line” and “find” comands operate on the TARGET window. The
  200. target window is the window behind the front-most window.
  201.  
  202. Large Files
  203.     PlainText must load its text files entirely into memory. If you get an
  204. out-of-memory error message when trying to open a very large file, just
  205. increase the partition (in the Finder’s Get-Info box for PlainText) to be
  206. larger than the file being opened. In System 7, turn on virtual memory if
  207. necessary.
  208.  
  209. Selection Expressions
  210.  
  211. PlainText implements a subset of the regular expressions as implemented in
  212. unix and related to those implemented in MPW. The search string is interpreted
  213. as a regular expresson when the  “Selection Expression” radio button is 
  214. selected in the “Find and Replace” or “Cut/Copy Lines Containing” dialogs.
  215. The following is implemented:
  216.  
  217. Wildcards
  218.     * and ≈ (option-x) select any text from the beginning of a line or to 
  219.     the end of a line.
  220.     ? selects any single character.
  221. Sets
  222.     Characters appearing between square brackets represents a set, any one 
  223.     of which will be a valid match. Sets can include ranges. A range is 
  224.     represented by two characters separated by a hyphen. They will match 
  225.     any character with an ascii code within the range. Thus [0-9] (or [0-9])
  226.     will match any digit. [a-z] will match any lower-case letter. If the 
  227.     “Case Sensistive” check box is off, the [a-z] is the same as [a-zA-Z]. 
  228. Repeats
  229.     The plus sign (+) following any character or a set will match a sequence 
  230.     of one or more of the preceeding set or character.
  231. Special characters and escape
  232.     Any ascii code can be represented as a two-digit hex following the dollar
  233.     sign ($) or it’s equivalent on your international keyboard. Thus, $20 is 
  234.     the space character and $0C is the formfeed character.
  235.     
  236.     The backslash character is used to represent special characters and to 
  237.     make interpretation of any following character literal.
  238.     
  239.         \t        tab 
  240.         \r        return ($0D)
  241.         \l        linefeed ($0A)
  242.         \f        formfeed ($0C)
  243.         
  244.     and
  245.         \\        backslash
  246.         \[        right square bracket, etc.
  247.         
  248.     Hex ($00) and backslash character codes are the only elements of the 
  249.     selection expression syntax that can appear in the Replace string of 
  250.     the “Find and Replace” dialog and then only if the “Selection Expression” 
  251.     radio button is selected.
  252.  
  253. Bug Reports
  254.  
  255.     Send comments and complaints to:
  256.  
  257.         Mel Park
  258.         Associate Professor
  259.         Department of Anatomy and Neurobiology
  260.         University of Tennessee
  261.         855 Monroe Avenue
  262.         Memphis, TN 38163
  263.         (901) 448-5984
  264.         mpark@utmem1.utmem.edu
  265.  
  266. PlainText is free.
  267.  
  268. Revision History
  269.  
  270. 0.4:     Fixed Standard File System 6 incompatibilities.
  271. 0.5:     Wordwrap is now the default.
  272.          Horizontal scroll bar occurs when it should.
  273.          Wordwrap to window correctly updates window.
  274.          Fixed Out of Memory problem with add linefeeds.
  275. 0.6:     Worksheet is an option.
  276.          Added font scaling and changing.
  277.          Open, file, and line commands now work in System 6.
  278.          All text moved to resources so that PlainText can now be
  279.            internationalized.
  280. 0.7:     Added Align, Shift Left, and Shift Right functions.
  281.          Fixed bug in which a strings just past the cursor were not
  282.            found in a forward search.
  283.          Open with option key down shows all files, not just text
  284.            files.
  285. 0.8:     SaveAFile stores resources properly and no longer causes
  286.            crashes.
  287.          The Standard File dialog is no longer displayed twice for new 
  288.            files.
  289.          Typing no longer overwrites the horizontal scroll bar.
  290.          Fixed some minor annoyances in v. 0.8a, like new windows coming
  291.            up with the wrong horizonal scroll bar and the cursor not being
  292.            erased when a window is deselected.
  293. 0.9:     There were bad crashes after some combinations of “Returns to
  294.            Linefeeds” and Saves or Closes, due to an old bug in the Mac
  295.            Menu Manager. Fixed now.
  296.          Similar bug was causing the Edit Menu to disappear when “No 
  297.            Worksheet” was selected.
  298.          Worksheet and non-worksheet windows open with or without a 
  299.            Go-Away Box as they should.
  300.          Added partial support for extended keyboard (Undo, cut, paste,
  301.            copy, page up, page down).
  302.          In System 7, opening from the finder directs Standard File package
  303.            to proper directory.
  304.          Horizonal arrow keys work properly except anchor point not yet
  305.            implemented.
  306. 0.91:     Extended keyboard fully implemented.
  307.          Fixed crashes due to Menu Manager bug.
  308. 1.0:     Added entab and detab functions.
  309.          Added word wrap to line lengths
  310.          Added autoindent
  311.          These last required additions to Format dialog.
  312.          Horizontal arrow keys now have an anchor point.
  313.          Word wrap to window is default for foreign text files as well
  314.            as new ones.
  315.          Command-arrow key functions now update the scroll bars.
  316.          Fixed conditions that would could cause a window to forget 
  317.            that it was dirty, with subsequent loss of most-recently 
  318.            typed data.
  319.          Text inserted at end of a line now drawn properly.
  320.          Errors in calculating buffer length in this last condition
  321.            also fixed.
  322.          Blinking cursor no longer interferes with text.
  323.          Show Invisibles with proportional fonts now works properly.
  324.          Go-Away box appears when it should in all conditions. 
  325.          Fixed System 6 bugs--can now open from finder.
  326.          Hiliting of selection range is now always in the right place.
  327.          Inserting text beginning with a carriage return used to foul up
  328.            the line starts array. This could cause a crash.
  329.          Crashes related to marks and selections beyond the text buffer
  330.            fixed.
  331. 1.1:     Fixed crashes due to errors in writing resources.
  332.          This means that resource forks are no longer corrupted.
  333.          Word wrap to length now works for newly opened documents.
  334.          Marks stopped working in v.1.0. Fixed.
  335.          Text now updated after Tile or Stack Windows.
  336.           Scroll bars now properly hilited after Tile and Stack Windows.
  337. 1.2:     Format and date in ls -l command now correct.
  338.          Searches for Entire Word now work.
  339.          All Clipboard window deficiencies fixed, i.e. it is now updated
  340.            as it should be after cuts and copies, Menus are properly
  341.            updated when this is the selected window, and the blinking
  342.            cursor is disabled.
  343.          In large files, the blinking cursor would be displayed as a long
  344.            vertical line when the window was scrolled more than 32K pixels
  345.            beyond the insertion point. Fixed.
  346.          Line length default really set to 75. This means that the “Word 
  347.            Wrap to Length” menu item works from the very beginning.
  348.          Implemented “Revert to Saved.”
  349.          Fixed scrolling error when large blocks of text deleted.
  350. 1.2a:     When word wrap is on, Autoindent indents paragraphs, not lines.
  351.          PlainText will now open documents on locked volumes.
  352.          Saving now always flushes files to disk with every Save, even if 
  353.            it is a sleeping PowerBook disk.
  354.          Tile and Stack Windows now work properly when there is no 
  355.            worksheet.
  356.          No longer asks to save a saved new document when quitting.
  357.          Short lines nolonger pirate* the up and down arrow key cursor
  358.            movements.
  359.          Shift and align improved to work on word-wrapped paragraphs.
  360. 1.2b:     Marks now aligned after pasting text.
  361.          Will now print beyond 32K of text.
  362. 1.2c:     Marks now updated after large selections of text deleted.
  363.          Will now print invisible characters and tabs.
  364. 1.2d:     Added page numbers to printed page.
  365. 1.2.1:     First non-beta release to public servers, i.e. Info-Mac.
  366.           Restored “File open in another application” alert.
  367.           In word wrap, adding or deleting text that caused rewrapping of
  368.             paragraphs with more than 32 lines used to blank part of the 
  369.             window above the changed text. Fixed.
  370. 1.2.2     “Tile Windows” formally tiled the Worksheet window and not the 
  371.            last text window. It now excludes the Worksheet from tiling.
  372.          Added support for a Preferences file for storing defaults.
  373.          Added the stats command-line option.
  374.          Added a four-pixel tick mark at the top of each window to indicate
  375.            the printed page width, minus 1” right and left margins.
  376.          Tabs now aligned when typing in the middle of a line.
  377. 1.2.3     1.2.2 introduced a bug that caused characters typed at the beginning
  378.            of an empty window to either not be draw are drawn in the wrong
  379.            position.
  380. 1.2.4     There was still misalignment when tabs were typed. Fixed.
  381.          Added chtyp and chcre commands.
  382.          The “Find Selection” menu item now activated for locked windows.
  383.          Added the “Strip Controls” menu item.
  384. 1.2.5     Fixed curor misplacement when typing returns at the end of a text 
  385.            file with AutoIndent on.
  386.          Files without resource forks would not open. I think this bug also
  387.            caused drag-and-drop to fail for these files.
  388.          Fixed the sometimes garbled text in the confirmation dialogs.
  389.          Cut and paste now works in the Find and Replace dialogs.
  390.          “Revert to Saved” previously caused a scrolling error.
  391. 1.2.6     Deleting an entire file would not delete the file’s marks. Fixed.
  392.          Cursor initialized with each activate event.
  393. 1.2.7     “Save As…” and “Save A Copy…” will now replace an existing file in
  394.            the proper way.
  395.          Added “P” as the keyboard equivalent for printing.
  396. 1.2.8     Zooming is now to the best size for a text window and not full screen.
  397.          All other Apple guidelines for zooming now conformed to.
  398.          Scroll bars no longer drawn twice in zooming.
  399.          Stats command now works at all times.
  400.          New window opened to ideal size.
  401. 1.2.9     Fixed zooming bug introduced in 1.2.8 that caused crashes in System 6.
  402.          Several obscure coding errors turned up in using the MetroWerks
  403.            compiler. These were probably never seen by users.
  404. 1.2.9a     Further fix of zooming bug. (Thanks to Bruce Craven and Joel Martin.)
  405. 1.3         Replace now doesn’t insert an extra character.
  406.          Dialog for find and replace now modeless (thanks to David Wright).
  407.          Strip Controls no longer deletes accented characters.
  408.           The line length parameter is saved.
  409.           Tabs to Spaces used to skip every other sequential tab.
  410.           Added “Cut/Copy Lines Containing” dialog.
  411. 1.3.1     Fixed version 1.3 crashes when closing the “Unmark…” dialog.
  412.          Implemented and fixed the full set of selection expressions.
  413. 1.3.2     Prior to this, the Find function would search past the end of text. 
  414.            In some cases, this caused extra replacements in global search and
  415.            replace. That was benign. However, it caused fatal freezes in the
  416.            “Cut Lines Containing” function.
  417. 1.3.3     Added "cutlines" and "copylines" command-line equivalents. 
  418.          Command-line searchs now use the right slash (/) to indicate that
  419.            the search string is a regular expression.
  420.          Added delay to page scrolling.
  421.          Cut and paste in Standard File dialog now uses proper scrap.
  422. 1.3.4     Special characters (e.g. \t or \r) in the Replace string were ignored
  423.            if not followed by one or more ordinary characters. Fixed.
  424.          When reopening a long document, the place in view was not the same as
  425.            the one when the document was closed. Fixed.
  426.          An already open document window is now brought to the front when 
  427.            its icon is double clicked or it is selected in the “Open…” dialog.
  428.          When not using the Worksheet option, PlainText now opens a blank 
  429.            untitled window upon launch.
  430. 1.3.5     Fixed bug that made wordwrapped documents open viewing a page or so
  431.            higher than when closed. This bug had also been causing wordwrapping
  432.            to be calculated twice when a document was opened.
  433.          Fixed error in opening foreign text files in which selection 
  434.            highliting is wrong, or there are even crashes when shift-clicking
  435.            to select a region.
  436. 1.3.6     Previously, expression searches ignored the last character in a file.
  437.            Fixing this bug involved a general improvement of memory management
  438.            for PlainText and its TextEdit core code (TE32K.c).
  439.          Changing to “Word Wrap to Length” from no word-wrapping previously 
  440.            caused an error in the horizontal scroll bar. (It was either absent
  441.            or set to the wrong values.)
  442.          Find now scrolls to position found text at the upper 1/3 of a window.
  443.          Read-only files now do not change the resource fork of file they open.
  444.          Also fixed some other logic errors that allowed read-only files to be
  445.            modified.
  446.          Scrap now converted at program launch.
  447. 1.3.7     Added more error checking when opening the worksheet window.
  448.          “Save As…” and “Save A Copy…” still had a bug. New windows were not
  449.            replacing existing files. 
  450.          
  451. Known bugs
  452.      Marks are not properly updated after entab and detab functions.
  453.      Marks sometimes not updated properly during normal editing. (Probably 
  454.        fixed in v.1.2b.)
  455.      Unbroken text (i.e. containing no spaces) is wrapped to window width.
  456.      If no printer is selected, new windows do not appear on the screen.
  457.      Windows sometimes do not appear on the screen in other conditions,
  458.        perhaps related to memory overflow.
  459.      Vertical scroll bars are not shown if the number of lines in a file
  460.        exceeds 32K.
  461.      Hard Wrap to Length will incorrectly wrap some lines when word wrapping
  462.        to length is turned on. (Probably fixed in v.1.3.)
  463.  
  464. Features to be added:
  465.      Compile in PowerPC native mode.
  466.      Floating window for display of text stats.
  467.      Saving a default directory
  468.  
  469. Thanks to  Bruce Craven, Doug Dyment, Scott Gruby, Ralph Muha, Florin Neumann,
  470. Robert J. Rockefeller, Michael O’Henly, Russel N. Owen, Ted Ripberger, Rich 
  471. Siegel, David Wright, and particularly to Rich Scarlet for their many helpful
  472. comments.
  473.  
  474. ------------
  475.  
  476. * Geo-speak. A stream is pirated when its flow is diverted into a 
  477.   neighboring water course.
  478.