home *** CD-ROM | disk | FTP | other *** search
- /********************************/
- /* COLEDIT: Column Editing Mode */
- /********************************/
- /*
-
- This is an EPM version of the Static Column Insert mode developed in E3
- PROCS by Russ Williams and Pat LaVarre. It is implemented as a key set
- in EPM, which gives it more power. The Column Editing mode is active
- even if the insert mode is not, so you have to assign a key (such as
- Ctrl + Ins) to toggle in and out of the mode.
-
- The current "column" ends at the first occurrence of two spaces after
- the cursor. Most editing functions only effect text within the current
- column. The following keys will behave differently:
- - characters typed in insert mode
- - backspace
- - del
- - Ctrl + D (delete word)
- Note that F9 behaves as expected.
-
- Column Editing does not work for block functions, Proof, and a few other
- miscellaneous things.
-
- If you want to try it out just once without recompiling EPM, you can
- just use the EPM command:
- relink coledit (typed in the command box of EPM)
- This would enter the column edit mode immediately; use Ctrl + Ins to
- exit.
-
- To make COLEDIT a normal part of EPM, you will need to create COLEDIT.EX
- by compiling COLEDIT.E:
- ET COLEDIT (typed in the command box of EPM)
- To incorporate it in your EPM, you need the following statement in
- MYKEYS.E or somewhere:
- def c_ins = link 'coledit'
- Then EPM will have to be recompiled (ETPM EPM).
-
- Problems & ideas:
- - Delete & Backspace don't do anything if used in space at the
- beginning of a line.
- - Home & End could work inside the current column, or switch between
- columns if already at the beginning or end of the current column.
- - Maybe use line characters as column limits as well as double spaces.
-
- Randy Bertram, RBERTRAM at LEXCJN1
-
- */
-
- compile if not defined( coledit_key )
- const coledit_key ='c_ins'
- compile endif
-
- definit
- keys coledit_keys
- if not insertstate() then
- inserttoggle
- endif
- sayerror 'Column Editing Mode.'
-
- defkeys coledit_keys
-
- def $coledit_key =
- sayerror 'Column Editing cancelled.'
- keys edit_keys
-
- def ''-'~', del, c_d, backspace, space=
-
- /* Get the line */
- getline celine
- protectcol = pos(' ',celine, .col)
- if protectcol then
- protectcol = verify(celine, ' ', , protectcol)
- endif
-
- /* Do the key */
- keys edit_keys
- executekey lastkey()
- keys coledit_keys
-
- /* Fix up the line if necessary */
- getline newline
- ceprefix = ''
- cesuffix = ''
- if length(newline) > length(celine) then
- cesuffix = substr(' ',1,length(newline)-length(celine))
- endif
- if length(newline) < length(celine) then
- ceprefix = substr(' ',1,length(celine)-length(newline))
- endif
- if protectcol > 0 and length(ceprefix || cesuffix) then
- curcol = .col
- .col = protectcol-length(ceprefix)
- curins = insertstate()
- if curins then
- inserttoggle
- endif
- keyin ceprefix || substr(celine, protectcol) || cesuffix
- if curins then
- inserttoggle
- endif
- .col = curcol
- endif
-
-