home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / utilities / zap / LineEditor / !ReadMe next >
Encoding:
Text File  |  1994-08-30  |  18.0 KB  |  414 lines

  1.                         LineEditor Module release 2.63
  2.                         ==============================
  3.  
  4. ***  Source, binaries and documentation Copyright (C) Oliver Betts, 1994  ***
  5.  
  6. This software is provided as is - it has been tested to a reasonable extent,
  7. but probably has a few lurking bugs.  I take no responsibility for any loss
  8. or damage, directly or indirectly caused.
  9.  
  10. UNIX is a trademark of AT&T; 4DOS is a trademark of JP Software Inc.
  11. Incidentally, I highly recommend 4DOS if you have to use DOS.
  12.  
  13. Versions with a letter suffix are test versions and may only be distributed
  14. with express permission from me.  Other versions may be distributed freely
  15. provided all files are supplied intact and that no profit is made.  You may
  16. bundle it with other freeware software provided these distribution
  17. restrictions are met, but please make sure you're supplying the latest
  18. version.  If you want to distribute it in some other way, get in touch.
  19.  
  20. *****************************************************************************
  21.  
  22. This module started out as some modifications to version 2.30 of Richard K.
  23. Lloyd's LineEditor module, to make it work better with TaskWindows
  24. (specifically to use the same *FX4 and *FX 220-228 settings as the Wimp).
  25.  
  26. However, RKL seems not to respond to email or snail mail, and so not having
  27. his permission to release my modified version, I have entirely rewritten the
  28. module.  In doing so I have fixed a number of bugs which were in the original
  29. and added many extra features, some of which were inspired by tcsh (for UNIX)
  30. and 4DOS (for DOS!).
  31.  
  32. I'm still actively working on this program, so watch out for new versions.
  33. Please let me know if you find any bugs or problems (read this file first
  34. though!).  I'll release the source with future versions.
  35.  
  36. Files in this release:
  37.  
  38. !ReadMe    - this file
  39. LineEditor - the module
  40. RebindKeys - obey file to change key bindings
  41. Actions    - a list of the actions which can be bound to keys
  42. DfltKeys   - default key bindings
  43. OllyKeys   - the bindings I use -- provided as an example
  44. Rebinder   - used by RebindKeys -- don't run directly
  45.  
  46. The keys file has a very similar layout to the !Zap keys file.  The
  47. mechanism for rebinding is a bit nasty, and will be improved when I get some
  48. spare time.
  49.  
  50. For a list of the default key bindings, load the LineEditor module and type
  51. "*Help Editor".
  52.  
  53. Random note:  Ctrl-N is now mapped to Next-line (same as cursor down), so to
  54. turn paged scrolling on, you need to type Ctrl-Q Ctrl-N.  Similarly for
  55. some other useful Ctrl-<letter> combinations.  I've bound csL csN csO csT
  56. and csZ to "vanilla" by default, so you can use Ctrl-Shift-N, etc instead.
  57.  
  58. A few comments on use with !Zap (see also !Zap's !Help file):
  59.  
  60. * To use function keys and Control + key you need to type Ctrl-Q first to
  61.   "Quote" the key - otherwise !Zap will process the key.  The cursor keys,
  62.   TAB and PageUp/PageDown are passed through and so don't need quoting.
  63.  
  64. * COPYing works - activated by the command COPY which is bound to COPY and
  65.   Shift-COPY by default.
  66.  
  67. * TaskWindows under RISC OS 2: The TaskWindow module supplied with !Edit on
  68.   RISC OS 2 Application Disc 1 (v 0.03) won't work with !Zap - you need the
  69.   one supplied with the C/Asm DDE (about 0.29) or above.  0.03 only works
  70.   with !Edit 1.00 and not very well.  The RISC OS 3.1 TaskWindow module
  71.   works best of all, but you can't legally get it without having RO 3.1...
  72.  
  73. * With the default keymap supplied with !Zap 1.10, Enter on the numeric
  74.   keypad acts like Ctrl-J in TaskWindows, ie the line isn't stored in the
  75.   history.  You can make it act like Return by altering the appropriate
  76.   line in the keys file from:
  77.    kENTER        &166    RETURN
  78.   to:
  79.    kENTER        &166    CHAR &0D
  80.   which makes Enter behave like Return in TaskWindows, and in other modes.
  81.  
  82. * Due to a bug in !Zap 1.10, Ctrl-Q Ctrl-@ in a TaskWindow gives an `R',
  83.   rather than setting the mark.  A work around is to use Ctrl-Q Ctrl-SPACE
  84.   instead in TaskWindows.
  85.  
  86. Use with !Edit/!SrcEdit:
  87.  
  88. * !Edit/!SrcEdit TaskWindows don't "understand" the codes to move the cursor
  89.   left and right (&08 and &09) so things don't work terribly well.  Also, the
  90.   code for a beep (&07) is ignored, so failing filename completions don't
  91.   beep.
  92.  
  93. * My version and RKL's seem to work equally well/badly (simple recall and
  94.   filename completion work okay).
  95.  
  96. * I don't think it's possible to work around not having VDU 8 - get !Zap if
  97.   you want to use TaskWindows much - it's much faster too!
  98.  
  99. Use with RISC OS 2:
  100.  
  101. * I've added code to versions 2.34 and above to read the task handles of
  102.   TaskWindows under RISC OS 2, so local history buffers should now work.
  103.  
  104. * The TaskWindow modules supplied with RISC OS 2 and the Acorn C DDE (0.03
  105.   and 0.29 anyway) have a problem - if the LineEditor is loaded, closing a
  106.   TaskWindow doesn't release the memory allocated to the task.  This would
  107.   seem to be a TaskWindow bug [it occurs if you soft-load 0.03 or 0.29 with
  108.   RISC OS 3.1, and with RKL's version].  My best advice (other than to get
  109.   RISC OS 3.1) is to reduce the next slot before starting a TaskWindow and
  110.   not to close task windows that you might want again.
  111.  
  112. * There's a problem with the cursor keys producing symbols rather than being
  113.   interpreted as cursor keys with some setups when using TaskWindow 0.29.
  114.  
  115. Comments and suggestions are greatly encouraged - email will get a reply (if
  116. I can get through), snail mail will eventually, but don't hold your breath. 
  117. If email bounces, I read the usenet group comp.sys.acorn regularly.  Please
  118. try to give as much detail as possible in bug-reports - steps to demonstrate
  119. the bug from loading in the module are very helpful indeed.
  120.  
  121. Thanks to Andy Hayward, David Moore and Dom Symes for testing and comments.
  122. Also to Clive Jones for suggesting how to find the current task's handle
  123. under RISC OS 2 (though his idea didn't work ;) ).  Also, thanks to everyone
  124. who's reported bugs.
  125.  
  126. You can obtain the latest version by anonymous ftp from ftp.mantis.co.uk in
  127. the directory /pub/users/olly - the file should be le???.arc
  128.  
  129. If you can't ftp, send me an email with "req-lineed" in the subject line, and
  130. my mailer will automagically uuencode and mail you the latest version.
  131.  
  132. Olly Betts, 1994.08.30
  133.  
  134. Internet email:         olly@mantis.co.uk
  135.  
  136. Indirected snail mail:  Olly Betts,
  137.                         24 Morgans Road,
  138.                         Hertford,
  139.                         Herts,
  140.                         SG13 8BS,
  141.                         UK
  142.  
  143.  
  144. Improvements/bugfixes over RKL's 2.30:
  145. ======================================
  146.  
  147. More TaskWindow compatible:
  148. ---------------------------
  149.  
  150. Changed to use same *FX4 and *FX 220-228 settings as Wimp, so using the
  151. line editor in a TaskWindow doesn't screw up the cursor keys.
  152.  
  153. More values are stored in registers or blocks rather than absolute locations,
  154. which greatly improves behaviour with multiple TaskWindows.
  155.  
  156. Each TaskWindow now has a separate currently-recalled-line pointer.  If
  157. Global history is on, when lines are deleted (by Shift-Insert, or when the
  158. history buffer gets full), the pointers for each TaskWindow are adjusted
  159. appropriately.
  160.  
  161. Function keys work separately in each TaskWindow.
  162.  
  163. You can't *RMKill the LineEditor module while a line is being entered.
  164.  
  165. Miscellaneous bugs fixed:
  166. -------------------------
  167.  
  168. Ctrl-H performs backspace (RKL's interprets it as Ctrl-Delete and erases
  169. the entire contents of the history buffer!)
  170.  
  171. Backspace in overtype mode didn't delete characters on the screen.
  172.  
  173. RKL's gave incorrect underline cursor in non-BBC gap modes (eg MODE 17).
  174.  
  175. Escape now moves cursor to end of line before exiting.
  176.  
  177. You can now enter all top-bit-set characters; Eg With RKL's version, you
  178. can't enter LOAD"Ý" (to type "Ý" hold down ALT and type 221 on the numeric
  179. keypad, then release ALT - RKL's reads it as Shift-Insert).
  180.  
  181. Filename completion code now copes with long leafnames (RKL's would break
  182. for leafnames >11 characters eg AUTOEXEC/BAT is 12).
  183.  
  184. RKL's used CMOS locations 37 and 38, but his !Trash also uses bits 0-2 of
  185. location 38 - I use location 37 and bits 3-7 of location 38.
  186.  
  187. R12 wasn't being passed to readlinev - RKL had just hacked around this...
  188.  
  189. V flag is explicitly cleared on errorless exit from ReadLineV routine, as
  190. OS_CallAVector doesn't clear V on entry (RISC OS 2 PRMs, vol I, page 30).
  191.  
  192. Module initialisation code would call OS_GenerateError upon failure - it
  193. should return with V set and R0 -> error block (RO3 PRMs, page 1-204).
  194.  
  195. Other changes which I view as improvements:
  196. -------------------------------------------
  197.  
  198. You can now have separate history buffers for each TaskWindow (controlled by
  199. bit 0 of *Configure EdFlags).  Ctrl-Delete wipes *current* history buffer;
  200. *EraseHistory and Shift-Ctrl-Delete wipe *all* history buffers.  When in
  201. local buffer mode, *Recall and *EdStatus put a '*' by the last used buffer.
  202. If the command was typed in using OS_ReadLine, this will be the "current"
  203. buffer, but results may be less meaningful if the command is executed by a
  204. program.
  205.  
  206. Added PageUp/PageDown to scroll through lines with start matching entered
  207. line (also on shift-cursor-up/down) [like Instigator and cursor up/down in
  208. 4DOS].
  209.  
  210. Added Emacs-like bindings [mostly from tcsh]:
  211. Duplicating existing keys:
  212.  ^A ^E start/end of line ^B ^F cursor left/right ^N ^P next/prev line
  213.  ^D delete right
  214. New actions:
  215.  ^Q quote next key, ^T transpose, ^K delete to end of line, ^@ place mark,
  216.  ^X exchange cursor with mark (Emacs ^X ^X), ^W delete region,
  217.  Shift-^D delete to end of word, ^Y yank back last text deleted with ^K, ^W,
  218.  or Shift-^D
  219.  
  220. Added another style of filename completion (like 4DOS).  Shift-Tab completes
  221. fully on first match, then Shift-Tab and Ctrl-Shift-Tab step through other
  222. matches.
  223.  
  224. Removed nasty hacky "Supervisor awareness" as it didn't work for RO 3.x or
  225. at ShellCLI prompt (f12 from desktop). Replaced with better system (for
  226. Acc.Fred[Tab] it looks first for "Acc.Fred*"; if that fails it then looks
  227. for "Fred*" [on the assumption that Acc. is an abbreviated *-command]).
  228.  
  229. There is no longer a limit on the number of lines in the history buffer,
  230. only on the size of the buffer.
  231.  
  232. You can specify a minimum length of line to record in the history (currently
  233. you set bits 4-7 of the flags byte to one less than this length, so 4 records
  234. all lines of 5 characters or more).
  235.  
  236. Doesn't display copyright message on start-up and reset.
  237.  
  238. Syntax messages added for commands.
  239.  
  240. Code doesn't bother trying to change cursor shape in TaskWindows (as VDU
  241. sequences are ignored and only slow things up more).
  242.  
  243. The code is "lazier" about inserting and deleting characters during filename
  244. completion - this gives a slight speed increase in TaskWindows.
  245.  
  246. My completion code doesn't insert `delete' characters into the keyboard
  247. buffer, which might have caused problems if you pressed Shift or Ctrl at
  248. just the wrong moment.
  249.  
  250. Next/previous word treat '(' and ')' as word breaks (same as !Zap 1.10).
  251.  
  252. Module help messages compacted using OS dictionary.
  253.  
  254. Ctrl-L & HOME now redraw current line (bit like tcsh).
  255.  
  256. ^J still behaves like RETURN but doesn't store line in history.
  257.  
  258. Doesn't do *Unset LineEditor$Dir (was done incorrectly for *EraseHistory for
  259. example).
  260.  
  261. Buffers for filename completion code are only allocated when they're needed.
  262.  
  263. No swi-padding code as it is *not* needed (slightly faster and smaller).
  264.  
  265. Added option to assemble with less verbose help text.
  266.  
  267. You can configure completion to add a '.' when completing a directory name,
  268. (a bit like tcsh adds a '/').  However "ls foo/" works and "cat foo."
  269. doesn't, so this is configurable (set bit 1 of EdFlags to turn it on).  It
  270. also is not currently done for 4DOS style completion, as the dot would stop
  271. the stepping through the current directory - I might recode to fix this
  272. later.
  273.  
  274. You can configure overtype mode to be on by default if you prefer (though
  275. why you would is beyond me - still, DOS 6 does it...)
  276.  
  277.  
  278. Shortfalls compared to RKL's version:
  279. =====================================
  280.  
  281. Changes to *Configure EdSize don't affect existing history buffer(s), but are
  282. used for new buffers.  I'm not sure if this is actually a shortfall or a
  283. useful feature - may be fixed.
  284.  
  285. No wimp frontend (or is that an improvement?) - seriously, let me know if
  286. you think a Wimp frontend is needed - I might write one if it's wanted...
  287.  
  288. Hasn't been tested with Arthur (the Archimedes OS before RISC OS) - the help
  289. text is compacted but otherwise I think all the new OS calls used fail-safe.
  290. Do let me know if you try it...
  291.  
  292. Minor "feature" - *FX216,0 no longer stops current function key expansion
  293. during OS_ReadLine, but this is no big deal really - it could be solved by
  294. intercepting OS_Byte, but I can't see much point.
  295.  
  296.  
  297. Possible future additional features:
  298. ====================================
  299.  
  300. Getting there:
  301.  Add completion of *-commands (I have a prototype working)
  302.  Improve key redefining stuff
  303.  
  304. Improve this documentation!
  305.  
  306. Some actions can be pretty slow (eg type a very long line with no spaces in
  307. a taskwindow, go to the start and delete word (Ctrl-Shift-D).  Then go and
  308. put the kettle on if you have an ARM 2.  This could be improved if the code
  309. was lazier and redrew only the finished result - although as it stands it
  310. does look quite slick on the command line with an ARM 3 or above.
  311.  
  312. Doesn't work wonderfully in VDU5 mode [neither does RKL's] - maybe fix.
  313.  
  314. Maybe add Ctrl-Page-Up/Down to scroll case sensitive.
  315.  
  316. Maybe change the name (?)
  317.  
  318. If we allow the size of existing buffers to change, we should preserve as
  319. much of the history as will fit in new size buffer.
  320.  
  321. As with RKL's, you can recall lines which have characters in which are
  322. outside the range specified by R2 and R3 on entry to OS_ReadLine - the only
  323. solutions I can see are to strip them out (not wonderful) or to only allow
  324. recall if all chars in the range &20-&FF are allowed (this applies to
  325. ShellCLI, BASIC, and GOS (TaskWindows)).  The problem also applies to
  326. filename completion.  Ideas on this one are especially welcome.
  327.  
  328. Other (please specify): ....................................................
  329.  
  330. Revision History:
  331. =================
  332.  
  333. 2.63 Shift-SPACE now produces a SPACE in the Default map (and Olly's)
  334.      Keypad /*-+. and Enter now work in the Default map (and Olly's)
  335.      Fixed bug in code which works out !Zap key numbers - discovered via
  336.       dropped characters in combination with Brian Brunswick's Bits module
  337.      Fixed non-freeing of a small amount of RMA if allocation of a new buffer
  338.       fails part-way through
  339.      Fixed problem of "LineEditor in use" when it had never been used
  340.  
  341. 2.62 With global history, if you hadn't used a non-TaskWindow command line,
  342.       then the history was lost if all TaskWindows were closed - fixed
  343.  
  344. 2.61 Fixed bug with reading value of EdFlags
  345.      Fixed off-by-one error in interpretation of minimum line length to store
  346.  
  347. 2.60 Cursor probably didn't get redefined for RISC OS 2 - should be now
  348.      Fixed bug which recalled junk on pressing cursor-up on a non-empty
  349.       line when history was empty
  350.      Streamlined service call handler for "nothing of interest" case
  351.      Should cope better if any SWI OS_Write* returns an error (and hence
  352.       corrupts R0) - eg if *Spool-ing output and the disk becomes full
  353.      All case-insensitive matching code rewritten to be smaller and faster
  354.      Next/previous word now works just like in Zap 1.10 - ie ' ', '(' and ')'
  355.       are treated as word breaks
  356.      Now allocates leafname buffers for filename completion on-the-fly, so
  357.       we can now cope with arbitrarily long leafnames. Tested with Jason
  358.       Tribbeck's LongFilenames module (version 0.08)
  359.      Added ^Y to yank back text deleted with ^K, ^W (like emacs)
  360.      Filename completion now works properly in overtype mode
  361.      *Help Editor output tweaked to fit better on 80x32 screen
  362.      Ctrl-Shift-D deletes to end of word (Emacs Meta-D)
  363.      Keypresses now decoded using !Zap key codes and a 512 byte table to
  364.       enable easy re-mapping
  365.      Compacted help messages using own dictionary
  366.      You can specify a minimum length of line to record in the history -
  367.       currently you set bits 4-7 of EdFlags to one less (eg 4 to store lines
  368.       of 5 chars or more), so 1 <= min. length <= 16
  369.      Doesn't output VDU sequences to change cursor on start-up now (stops
  370.       empty window appearing when LineEditor module run from Filer)
  371.      Ctrl-Down on typed line with empty history gave garbage - fixed
  372.      Delete word can be yanked back
  373.  
  374. 2.53 Path buffer for filename completion now allocated on the fly
  375.  
  376. 2.52 Routine `free' now returns R0=0
  377.      Explicitly clear V on errorless exit from ReadLineV (bug-fix over RKL)
  378.      Fettled help messages and compacted a little more
  379.      R12 is mostly derefenced on entry (smaller and faster)
  380.      OS_GBPB buffer allocated on the fly
  381.      Print padded decimal routine uses 12 bytes of stack for workspace
  382.  
  383. 2.51 Dom suggested adding a '.' when filename completion completed to a
  384.       directory - controlled by bit 1 of EdFlags
  385.      Set bit 2 of EdFlags to turn overtype mode on by default
  386.  
  387. 2.50 [Bundled in !Zap 1.10 release]
  388.      Pressing Tab/^I on an empty line incorrectly moved the cursor left one
  389.       character if a completion occured
  390.      Deleting left at the end of a recalled line didn't set the modified flag
  391.      With empty history, typing something and pressing PageUp recalled crap
  392.      Added 4DOS style filename completion:  Shift-Tab completes fully, then
  393.       steps thru' completions - Shift-Ctrl-Tab steps backwards
  394.      Shift-Copy does the same as Copy (to match !Zap defaults)
  395.      Updated and tidied output from *Help Editor
  396.  
  397. 2.40 Tidied up a little for release with !Zap 1.10 ('cept it's been delayed)
  398.  
  399. 2.35 TaskWindow tracking workspace if now freed on soft-reset
  400.      If a claim for RMA fails, a beep is emitted and something sensible done
  401.       (start-up gives an error, a function key is ignored, starting a new
  402.       TaskWindow reverts to the default OS_ReadLine routine)
  403.      Fixed minor bug in filename expansion code (introduced in 2.34)
  404.      PageUp and PageDown now don't insert start line into the history
  405.  
  406. 2.34 Fixed minor bug in filename completion code
  407.      Added code to find task handle for RISC OS 2 (easier than I thought)
  408.      Now marks "current" buffer with a '*' in *Recall and *EdStatus if
  409.       local history is in operation
  410.      Recoded filename completion to enter characters directly, rather than
  411.       via keyboard buffer
  412.  
  413. 2.33 First beta release
  414.