home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / editor / epmtools / epmmac / stdkeys.e < prev    next >
Encoding:
Text File  |  1993-07-22  |  56.0 KB  |  1,995 lines

  1. define
  2. compile if EVERSION < 5
  3.    NOT_CMD_STATE = '& not command_state()'
  4. compile else
  5.    NOT_CMD_STATE = ' '
  6. compile endif
  7.  
  8. definit
  9.    universal blockreflowflag
  10. compile if defined(HIGHLIGHT_COLOR)
  11.    universal search_len
  12. compile endif
  13. compile if EVERSION < 5
  14.    universal inKstring
  15.    inKstring=0
  16. compile endif
  17.    blockreflowflag=0
  18. compile if defined(HIGHLIGHT_COLOR)
  19.    search_len = 5     -- Initialize to anything, to prevent possible "Invalid number argument"
  20. compile endif
  21.  
  22. compile if WANT_CUA_MARKING & EPM
  23. defkeys edit_keys new clear
  24.  
  25. def otherkeys =
  26.    k = lastkey()
  27.    call process_key(k)
  28.  
  29. defproc process_key(k)
  30.  compile if WANT_CUA_MARKING = 'SWITCH'
  31.    universal CUA_marking_switch
  32.  compile endif
  33.    if length(k)=1 & k<>\0 then
  34.       i_s = insert_state()
  35.  compile if WANT_CUA_MARKING = 'SWITCH'
  36.       if CUA_marking_switch then
  37.  compile endif
  38.          had_mark = process_mark_like_cua()
  39.          if not i_s & had_mark then
  40.             insert_toggle  -- Turn on insert mode because the key should replace
  41.          endif             -- the mark, not the character after the mark.
  42.  compile if WANT_CUA_MARKING = 'SWITCH'
  43.       else
  44.          had_mark = 0  -- set to 0 so we don't toggle insert state later
  45.       endif
  46.  compile endif
  47.       keyin k
  48.       if not i_s & had_mark then
  49.          insert_toggle
  50.       endif
  51.    endif
  52.  
  53. defproc process_mark_like_cua()
  54.    if marktype() then
  55.       getmark firstline,lastline,firstcol,lastcol,markfileid
  56.       getfileid fileid
  57.       if fileid<>markfileid then
  58.          sayerror MARKED_OTHER__MSG
  59.          unmark
  60.       elseif not check_mark_on_screen() then
  61.          sayerror MARKED_OFFSCREEN__MSG
  62.          unmark
  63.       else
  64. compile if WANT_DM_BUFFER
  65.          'Copy2DMBuff'     -- see clipbrd.e for details
  66. compile endif  -- WANT_DM_BUFFER
  67.          firstline; .col=firstcol
  68. compile if EVERSION >= '5.20'
  69.          undoaction 1, junk                -- Create a new state
  70. compile endif
  71.          call pdelete_mark()
  72.          'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  73.          return 1
  74.       endif
  75.    endif
  76.  
  77. defproc shifted
  78.    ks = getkeystate(VK_SHIFT)
  79.    return ks<>3 & ks<>4
  80.  
  81. compile if EVERSION < 5.50
  82. define CHARG_MARK = 'CHAR'
  83. compile else                -- New mark type
  84. define CHARG_MARK = 'CHARG'
  85. compile endif
  86.  
  87. defproc extend_mark(startline, startcol, forward)
  88. ;compile if WANT_CUA_MARKING = 'SWITCH'
  89. ;  universal CUA_marking_switch
  90. ;  if not CUA_marking_switch then return; endif
  91. ;compile endif
  92.    if marktype()='LINE' | marktype()='BLOCK' then return; endif
  93.    getfileid curfileid
  94.    if not marktype() then
  95. compile if EVERSION < 5.50  -- Forwards and backwards acts differently
  96.       call pset_mark(startline, .line, startcol-(not forward), .col-forward, CHARG_MARK, curfileid)
  97. compile else  -- CHARG handles the differences.
  98.       call pset_mark(startline, .line, startcol, .col, CHARG_MARK, curfileid)
  99. compile endif
  100.       return
  101.    endif
  102. compile if EVERSION < 5.50
  103.    getmark firstline,lastline,firstcol,lastcol,markfileid
  104. compile else
  105.    getmarkg firstline,lastline,firstcol,lastcol,markfileid
  106. compile endif
  107.    if markfileid<>curfileid then  -- If mark was in a different file, treat like no mark was set.
  108. compile if EVERSION < 5.50  -- Forwards and backwards acts differently
  109.       call pset_mark(startline, .line, startcol-(not forward), .col-forward, CHARG_MARK, curfileid)
  110. compile else  -- CHARG handles the differences.
  111.       call pset_mark(startline, .line, startcol, .col, CHARG_MARK, curfileid)
  112. compile endif
  113.       return
  114.    endif
  115.    lk = lastkey(0)
  116.    if (lk=s_up & .line=firstline-1) | (lk=s_down & .line=firstline+1) then
  117.       if length(textline(firstline)) < .col then
  118.          firstcol = .col
  119.       endif
  120.    endif
  121.    if startline>firstline | ((startline=firstline) & (startcol > firstcol)) then  -- at end of mark
  122.       if not forward then
  123.          if firstline=.line & firstcol=.col then unmark; return; endif
  124.       endif
  125. compile if EVERSION < '5.50'
  126.       call pset_mark(firstline, .line, firstcol, .col-1, CHARG_MARK, curfileid)
  127. compile else
  128.       call pset_mark(firstline, .line, firstcol, .col, CHARG_MARK, curfileid)
  129. compile endif
  130.    else                                                         -- at beginning of mark
  131.       if forward then
  132.          if lastline=.line & lastcol=.col-1 then unmark; return; endif
  133.       endif
  134.       call pset_mark(lastline, .line, lastcol, .col, CHARG_MARK, curfileid)
  135.    endif
  136.  
  137. ; c_home, c_end, c_left & c_right do different things if the shift key is depressed.
  138. ; The logic is extracted here mainly due to the complexity of the COMPILE IF's
  139. defproc begin_shift(var startline, var startcol, var shift_flag)
  140.  compile if WANT_CUA_MARKING = 'SWITCH'
  141.    universal CUA_marking_switch
  142.  compile endif
  143.    shift_flag = shifted()
  144.  compile if WANT_CUA_MARKING = 'SWITCH'
  145.    if shift_flag or not CUA_marking_switch then
  146.  compile else
  147.    if shift_flag then
  148.  compile endif
  149.       startline = .line; startcol = .col
  150.    else
  151.       unmark
  152.    endif
  153.  
  154. defproc end_shift(startline, startcol, shift_flag, forward_flag)
  155.  compile if WANT_CUA_MARKING = 'SWITCH'
  156.    universal CUA_marking_switch
  157.    if shift_flag & CUA_marking_switch then
  158.  compile else
  159.    if shift_flag then
  160.  compile endif
  161.       call extend_mark(startline, startcol, forward_flag)
  162.    endif
  163. compile else  -- WANT_CUA_MARKING & EPM
  164. defkeys edit_keys new
  165. compile endif  -- WANT_CUA_MARKING & EPM
  166.  
  167. compile if EVERSION < 5
  168. def entry=
  169. compile endif
  170.  
  171. ; Real keys, in alphabetical order.
  172. ; See end of this file for a list of keys unused in standard E.
  173.  
  174. def a_0=    /* same as Alt-Equal, for sake of German keyboards */
  175.    'dolines'
  176.  
  177. ; We now distribute a standard front end for the DIR command, which redirects
  178. ; the output to a file named ".dos dir <dirspec>".  The third line should be
  179. ; "Directory of <dirname>".  If so, we use it.  If not, we use DIRSPEC from the
  180. ; .filename instead, but note that the latter might contain wildcards.
  181. def a_1= /* edit filename on current text line */
  182.    getline line
  183.    parse value .filename with word1 word2 word3 .
  184.    if upcase(word1 word2) = '.DOS DIR' then
  185.       call psave_pos(save_pos)
  186. compile if EVERSION >= '4.12'
  187.       getsearch oldsearch
  188. compile endif
  189.       'xcom l /'DIRECTORYOF_STRING'/c-'
  190.       if not rc then
  191.          getline word3
  192.          parse value word3 with . . word3 .
  193.       endif
  194. compile if EVERSION >= '4.12'
  195.       setsearch oldsearch
  196. compile endif
  197.       call prestore_pos(save_pos)
  198. compile if not E3  -- DOS (box) doesn't see new-format DIR listing
  199.       filename=substr(line,41)                 -- Support HPFS.  FAT dir's end at 40
  200.       if filename='' then                      -- Must be FAT.
  201. compile endif
  202.          filename=strip(substr(line,1,8))
  203.          word2=strip(substr(line,10,3))
  204.          if word2<>'' then filename=filename'.'word2; endif
  205. compile if not E3  -- DOS (box) doesn't see new-format DIR listing
  206.       endif
  207. compile endif
  208.       name=word3 ||                            -- Start with the path.
  209. compile if EVERSION >= '5.17'
  210.            leftstr('\',                        -- Append a '\', but only if path
  211.                    '\'<>rightstr(word3,1)) ||  -- doesn't end with one.
  212. compile else
  213.            substr('\', 1,                      -- Append a '\', but only if path
  214.                   '\'<>substr(word3,length(word3),1)) ||  -- doesn't end with one.
  215. compile endif
  216.            filename                            -- Finally, the filename
  217.       if pos('<DIR>',line) then
  218.          'dir 'name
  219.       else
  220.          'e 'name
  221.       endif
  222.    else  -- Not a DIR listing
  223. compile if not E3
  224.       parse value line with w1 rest
  225.       p=lastpos('(', w1)
  226.       if p then
  227.          filename = substr(w1, 1, p-1)
  228.          parse value substr(w1, p+1) with line ')'
  229.          parse value line with line ':' col
  230.          'e 'filename
  231.          line
  232.          if col<>'' then .col = col; endif
  233.       else
  234. compile endif
  235.          'e 'line
  236. compile if not E3
  237.       endif
  238. compile endif
  239.    endif
  240.  
  241. compile if WANT_WINDOWS
  242. def a_4=call psplit4()            -- routine defined in WINDOW.E
  243. compile endif
  244.  
  245. def a_a=
  246. compile if WANT_CHAR_OPS
  247.    call pcommon_adjust_overlay('A')
  248. compile else
  249.    adjustblock
  250. compile endif
  251.  
  252. def a_b
  253.    markblock
  254. compile if EVERSION >= 5
  255.    'Copy2SharBuff'       /* Copy mark to shared text buffer */
  256. compile endif
  257.  
  258. def a_c=
  259. compile if EPM
  260.    if marktype() then
  261. compile endif
  262.       call pcopy_mark()
  263. compile if EPM
  264.    else                 /* If no mark, look to in Shared Text buffer */
  265.       'GetSharBuff'     /* see clipbrd.e for details                 */
  266.    endif
  267. compile endif
  268.  
  269. def a_d=
  270. compile if WANT_DM_BUFFER
  271.    'Copy2DMBuff'     -- see clipbrd.e for details
  272. compile endif
  273.    call pdelete_mark()
  274. compile if EVERSION > 5
  275.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  276. compile endif
  277.  
  278. def a_e= call pend_mark()
  279.  
  280. def a_equal=
  281.    'dolines'   -- Code is a separate command in STDCMDS.E.
  282.  
  283. def a_f= /* Now accepts key from macro. */
  284.    call checkmark()
  285. compile if EVERSION < 5
  286.    k=mgetkey("Type a character, or Esc to cancel.")
  287.    if length(k)>1 then           -- Do something with extended keys.
  288.       if     k=esc      then ;   -- Let user abort w/o Ctrl-break.
  289.       elseif k=padstar  then k='*'
  290.       elseif k=padplus  then k='+'
  291.       elseif k=padminus then k='-'
  292.       else   k=substr(k,2,1)      endif
  293.    endif
  294.    if k<>esc then call pfill_mark(k); endif
  295. compile else
  296.    call pfill_mark()
  297. compile endif
  298.  
  299. def a_f1= keyin '║ ╠ ╔ ╚ ╩ ═ ╦ ╝ ╗ ╣ ╬ │ ├ ┌ └ ┴ ─ ┬ ┘ ┐ ┤ ┼ █ ▓ ▒ ░'
  300.  
  301. def a_f7,c_F7=   -- Can't use the old A_F7 in EPM.  PM uses it as an accelerator key.
  302.    shift_left
  303. compile if SHIFT_BLOCK_ONLY
  304.    if marktype()='BLOCK' then  -- code by Bob Langer
  305.       getmark fl,ll,fc,lc,fid
  306.       call pset_mark(fl,ll,lc,MAXCOL,'BLOCK',fid)
  307.       shift_right
  308.       call pset_mark(fl,ll,fc,lc,'BLOCK',fid)
  309.    endif
  310. compile endif
  311.  
  312. def a_f8,c_F8=   -- Can't use the old A_F8 in EPM.  PM uses it as an accelerator key.
  313. compile if SHIFT_BLOCK_ONLY
  314.    if marktype()='BLOCK' then  -- code by Bob Langer
  315.       getmark fl,ll,fc,lc,fid
  316.       call pset_mark(fl,ll,lc,MAXCOL,'BLOCK',fid)
  317.       shift_left
  318.       call pset_mark(fl,ll,fc,lc,'BLOCK',fid)
  319.    endif
  320. compile endif
  321.    shift_right
  322.  
  323. compile if EVERSION < 5
  324.  compile if EVERSION < '4.10'          -- Early E doesn't support enh. kbd.
  325. def a_f10,c_P= call pprevfile()       -- routine defined in WINDOW.E
  326.  compile else
  327. def a_f10,F11,c_P= call pprevfile()       -- routine defined in WINDOW.E
  328.  compile endif
  329. compile else
  330. /* We can't use a_f10 for previous file any more, PM uses that key. */
  331. /* I like F11 and F12 to go back and forth.                         */
  332. def a_f10,F11,c_P=  -- a_F10 is usual E default; F11 for enh. kbd, c_P for EPM.
  333.    prevfile
  334. compile endif
  335.  
  336. def a_j=
  337.    call joinlines()
  338.  
  339. def a_l=
  340.    mark_line
  341. compile if EVERSION >= 5
  342.    'Copy2SharBuff'       /* Copy mark to shared text buffer */
  343. compile endif
  344.  
  345. def a_m=call pmove_mark()
  346. compile if UNMARK_AFTER_MOVE
  347.    unmark
  348.  compile if EVERSION > 5
  349.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  350.  compile endif
  351. compile endif
  352.  
  353. def a_minus =
  354.  compile if EOS2
  355.    display 0
  356.  compile endif
  357.  compile if EVERSION < '5.50'
  358.    sayat '', .cursory, .cursorx, WHITE + REDB + BLINK, 1
  359.  compile elseif EVERSION >= '5.60'
  360.    circleit 5, .line, .col-1, .col+1, 16777220
  361.  compile else
  362.    circleit 2, .line, .col-1, .col+1, WHITE + REDB + BLINK
  363.  compile endif
  364.  compile if EPM & EVERSION < '5.50'
  365.    call dynalink('DOSCALLS', '#32', atol_swap(1000))  -- 1 second DOSSLEEP
  366.    refresh
  367.  compile endif
  368.  compile if EOS2
  369.    k=getkey()
  370.    display 1
  371.    executekey k
  372.  compile endif
  373.  
  374. def a_n=  /* Type the full name of the current file. */
  375.   keyin .filename
  376.  
  377. def a_o=
  378. compile if EPM
  379.    if marktype() then
  380. compile endif
  381. compile if WANT_CHAR_OPS
  382.       call pcommon_adjust_overlay('O')
  383. compile else
  384.       overlay_block
  385. compile endif
  386. compile if EPM
  387.    else                 /* If no mark, look to in Shared Text buffer */
  388.       'GetSharBuff O'   /* see clipbrd.e for details                 */
  389.    endif
  390. compile endif
  391.  
  392. def a_p=
  393.    /* Protect the user from accidentally reflowing a marked  */
  394.    /* area not in the current file, and give a good message. */
  395.    mt = substr(marktype(), 1, 1)
  396.    if mt='B' or mt='L' then
  397.       getmark firstline,lastline,firstcol,lastcol,markfileid
  398.       getfileid fileid
  399.       if fileid<>markfileid then
  400.          sayerror CANT_REFLOW__MSG'  'OTHER_FILE_MARKED__MSG
  401.          return
  402.       endif
  403.    endif
  404.  
  405.    if mt<>' ' then
  406.       if not check_mark_on_screen() then
  407. compile if EVERSION < 5
  408.          do while testkey()/==''; call getkey(); end
  409.          sayerror MARK_OFF_SCRN_YN__MSG
  410.          loop
  411.             ch=upcase(getkey())
  412.             if ch=YES_CHAR then sayerror 0; leave; endif
  413.             if ch=NO_CHAR or ch=esc then sayerror 0; stop; endif
  414.          endloop
  415. compile else
  416.          sayerror MARK_OFF_SCREEN__MSG
  417.          stop
  418. compile endif
  419.       endif
  420.    endif
  421.  
  422.    if mt='B' then
  423.       'box r'
  424.    elseif mt='C' then
  425.       sayerror WRONG_MARK__MSG
  426.    elseif mt='L' then
  427.       reflow
  428.    else  -- Standard text reflow split into a separate routine.
  429.       call text_reflow()
  430.    endif
  431.  
  432. definit                         -- Variable is null if alt_R is not active.
  433.    universal alt_R_active       -- For E3/EOS2, it's 1 if alt_R is active.
  434.    alt_R_active = ''            -- For EPM, it's set to querycontrol(messageline).
  435.  
  436. def a_r=
  437.    universal alt_R_active,tempofid
  438. compile if EPM
  439.    universal alt_R_space
  440. compile endif
  441.  
  442.    if alt_R_active<>'' then
  443. compile if EPM
  444.       call pblock_reflow(1,alt_R_space,tempofid)     -- Complete the reflow.
  445.  compile if EVERSION < '5.21'
  446.       .messageline=''                        -- Turn off the message.
  447.  compile else
  448.        'setmessageline '\0
  449.  compile endif
  450.  compile if EVERSION >= '5.53'
  451.       'toggleframe 2 'alt_R_active           -- Restore status of messageline.
  452.  compile else
  453.       'togglecontrol 8 'alt_R_active         -- Restore status of messageline.
  454.  compile endif
  455.       alt_R_active = ''
  456.       return
  457. compile else
  458.       activatefile tempofid                  -- Release tempo
  459.       .modify=0
  460.       'xcom q'
  461. compile endif
  462.    endif
  463.    if pblock_reflow(0,alt_R_space,tempofid) then
  464.       sayerror PBLOCK_ERROR__MSG      /* HurleyJ */
  465.       return
  466.    endif
  467. ;  if marktype() <> 'BLOCK' then
  468.       unmark
  469. ;  endif
  470. compile if EPM
  471.  compile if EVERSION >= '5.53'
  472.    alt_R_active = queryframecontrol(2)         -- Remember if messageline on or off
  473.    'toggleframe 2 1'                    -- Force it on
  474.  compile else
  475.    alt_R_active = querycontrol(8)         -- Remember if messageline on or off
  476.    'togglecontrol 8 1'                    -- Force it on
  477.  compile endif
  478.  compile if EVERSION < '5.21'
  479.    .messageline = BLOCK_REFLOW__MSG
  480.  compile else
  481.    'setmessageline BlockReflow: Mark the new block size with Alt-B; press Alt-R again (Esc cancels)'
  482.  compile endif
  483. compile else
  484.    alt_R_active = 1
  485.    sayerror BLOCK_REFLOW__MSG
  486.    loop
  487.       k=getkey()
  488.       if k==a_r then  /* Alt-R ? */
  489.          call pblock_reflow(1,alt_R_space,tempofid)
  490.          leave
  491.       endif
  492.       if k==esc then  /* Esc ? */
  493.          /* release tempo */
  494.          activatefile tempofid
  495.          .modify=0
  496.          'xcom q'
  497.          unmark
  498.          sayerror NOFLOW__MSG
  499.          leave
  500.       endif
  501.       executekey k
  502.    endloop
  503.    alt_R_active = ''
  504. compile endif
  505.  
  506. def a_s=
  507.    call splitlines()
  508.  
  509. def a_t = call pcenter_mark()
  510.  
  511. def a_u=
  512.    unmark
  513. compile if EVERSION > 5
  514.    'ClearSharBuff'       /* Remove Content in EPM shared text buffer */
  515. compile endif
  516.  
  517. def a_w = call pmark_word()
  518.  
  519. ;  EPM:  Haven't yet figured out a way to do Alt-X=escape.  It used a getkey().
  520. compile if EVERSION < 5
  521. def a_x=escape
  522. compile endif
  523.  
  524. def a_y= call pbegin_mark()
  525.  
  526. compile if WANT_CHAR_OPS
  527. def a_z=mark_char
  528.  compile if EVERSION > 5
  529.    'Copy2SharBuff'       /* Copy mark to shared text buffer */
  530.  compile endif
  531. compile endif
  532.  
  533. compile if EVERSION < 5
  534. def backspace=
  535. compile else
  536. def backspace, s_backspace =
  537. compile endif
  538.  compile if WANT_STREAM_MODE = 'SWITCH'
  539.    universal stream_mode
  540.  compile endif
  541.  compile if WANT_CUA_MARKING = 'SWITCH'
  542.    universal CUA_marking_switch
  543.    if CUA_marking_switch then
  544.  compile endif
  545.  compile if WANT_CUA_MARKING
  546.   compile if EVERSION < 5
  547.    if command_state() then rubout; return; endif
  548.   compile endif
  549.    if process_mark_like_cua() then return; endif
  550.  compile endif
  551.  compile if WANT_CUA_MARKING = 'SWITCH'
  552.    endif
  553.  compile endif
  554. compile if WANT_STREAM_MODE
  555.  compile if WANT_STREAM_MODE = 'SWITCH'
  556.    if .col=1 & .line>1 & stream_mode $NOT_CMD_STATE then
  557.  compile else
  558.    if .col=1 & .line>1 $NOT_CMD_STATE then
  559.  compile endif
  560.       up
  561.       l=length(textline(.line))
  562.       join
  563.       .col=l+1
  564.    else
  565. compile endif
  566. compile if EVERSION >= '5.50'
  567.       old_level = .levelofattributesupport
  568.       if old_level & not (old_level%2 - 2*(old_level%4)) then
  569.          .levelofattributesupport = .levelofattributesupport + 2
  570.          .cursoroffset = -300
  571.       endif
  572. compile endif
  573.       rubout
  574. compile if EVERSION >= '5.50'
  575.       .levelofattributesupport = old_level
  576. compile endif
  577. compile if WANT_STREAM_MODE
  578.    endif
  579. compile endif
  580.  
  581. def c_2 = keyin \0                  -- C_2 enters a null.
  582. def c_6 = keyin \170                -- C_6 enters a "not" sign
  583. compile if EVERSION >= '5.50'
  584. def c_9 = keyin '{'
  585. def c_0 = keyin '}'
  586. compile endif
  587.  
  588. compile if WANT_WINDOWS
  589. def c_a= call pnextwindowstyle()  -- routine defined in WINDOW.E
  590. compile endif
  591.  
  592. compile if WANT_BOOKMARKS
  593. def c_B = 'listmark'
  594. compile endif
  595.  
  596. def c_backspace=
  597. compile if EVERSION >= '5.20'
  598.    undoaction 1, junk                -- Create a new state
  599. compile endif
  600. compile if EVERSION >= '5.50'
  601.    if .levelofattributesupport then
  602.       if (.line==.last and .line<>1) then       -- this is the last line
  603.          destinationLine=.line-1                -- and there is a previous line to store attributes on
  604.          getline prevline,DestinationLine
  605.          DestinationCol=length(prevline)+1      -- start search parameters
  606.                                                 -- destination of attributes
  607.          findoffset=-300                        -- start at the begin of the attr list
  608.          findline=.line                         -- of the first char on this line
  609.          findcolumn=1
  610.  
  611.          do forever        -- search until no more attr's (since this is last line)
  612.             FINDCLASS=0          -- 0 is anyclass
  613.             Attribute_action FIND_NEXT_ATTR_SUBOP, findclass, findoffset, findcolumn, findline
  614.             if not findclass or (findline<>.line) then  -- No attribute, or not on this line
  615.                leave
  616.             endif
  617.             query_attribute theclass,thevalue, thepush, findoffset, findcolumn, findline   -- push or pop?
  618.             if not thePush then       -- ..if its a pop attr and ..
  619.                matchClass=theClass
  620.                MatchOffset=FindOffset
  621.                MatchLine=FindLine
  622.                MatchColumn=FindColumn  -- ..and if its match is not on this line or at the destination
  623.                Attribute_Action FIND_MATCH_ATTR_SUBOP, MatchClass, MatchOffset, Matchcolumn, MatchLine
  624.                if ((Matchline==DestinationLine) and (Matchcolumn==destinationcol)) then
  625.                   -- then there is a cancellation of attributes
  626.                   Attribute_action Delete_ATTR_SUBOP, theclass, Findoffset, Findcolumn, Findline
  627.                   Attribute_action Delete_ATTR_SUBOP, Matchclass, Matchoffset, Matchcolumn, Matchline
  628.                elseif (MatchLine<>.line)  then
  629.                   -- .. then move attribute to destination (before attributes which have been scanned so its OK.)
  630.                   -- insert attr at the end of the attr list (offset=0)
  631.                   Insert_Attribute theclass, thevalue, 0, 0, DestinationCol, DestinationLine
  632.                   Attribute_action Delete_ATTR_SUBOP, theclass, Findoffset, Findcolumn, Findline
  633.                endif -- end if attr is on line or at destination
  634.             endif -- end if found attr is a pop
  635.          enddo  -- end search for attr's
  636.       elseif .line < .last then  -- put the attributes after the line since there may not
  637.                                  -- be a line before this line (as when .line==1)
  638.          DestinationCol=1
  639.          DestinationLine=.line+1         -- error point since this puts attr's after last line if .line=.last
  640.          findoffset=0                    -- cant make it .line-1 cause then present attributes there become
  641.          findline=.line                  -- after these attributes which is wrong
  642.          findcolumn=MAXCOL
  643.  
  644.          do forever
  645.             FINDCLASS=0
  646.             Attribute_action FIND_PREV_ATTR_SUBOP, findclass, findoffset, findcolumn, findline
  647.             if not findclass or (findline<>.line) then  -- No attribute, or not on this line
  648.                leave
  649.             endif
  650.              /* Move Attribute */
  651.             query_attribute theclass,thevalue, thepush, findoffset, findcolumn, findline
  652.             -- only move push/pop model attributes (tags are just deleted)
  653.             if ((thepush==0) or (thepush==1)) then
  654.                -- move attribute to destination, if cancellation delete both attributes
  655.                FastMoveAttrToBeg(theclass, thevalue, thepush, DestinationCol, DestinationLine, findcolumn, findline, findoffset)
  656.                findoffset=findoffset+1  -- since the attr rec was deleted and all attr rec's were shifted to fill the vacancy
  657.                                         -- and search is exclusive
  658.             endif
  659.          enddo
  660.       endif -- endif .line=.last and .line=1
  661.    endif -- .levelofattributesupport
  662. compile endif
  663.    delete
  664. compile if EVERSION >= '5.20'
  665.    undoaction 1, junk                -- Create a new state
  666. compile endif
  667. compile if EVERSION < 5
  668.    if command_state() then
  669.       begin_line
  670.    endif
  671. compile endif
  672.  
  673. def c_c=
  674. compile if EVERSION < 5
  675.   right
  676. compile else
  677.   'c'    -- EPM c_c is used for change next
  678. compile endif
  679.  
  680. ; Ctrl-D = word delete, thanks to Bill Brantley.
  681. def c_d =  /* delete from cursor until beginning of next word, UNDOable */
  682. compile if EVERSION < 5
  683.    if command_state() then
  684.       getcommand cmdline, begcur, cmdscrPos
  685.       lenCmdLine=length(cmdline)
  686.       if lenCmdLine >= begcur then
  687.          for i = begcur to lenCmdLine /* delete remainder of word */
  688.             if substr(cmdline,i,1)<>' ' then
  689.                deleteChar
  690.             else
  691.                leave
  692.             endif
  693.          endfor
  694.          for j = i to lenCmdLine /* delete delimiters following word */
  695.             if substr(cmdline,j,1)==' ' then
  696.                deleteChar
  697.             else
  698.                leave
  699.             endif
  700.          endfor
  701.       endif
  702.    else
  703. compile endif
  704.       getline line
  705.       begcur=.col
  706.       lenLine=length(line)
  707.       if lenLine >= begcur then
  708.          for i = begcur to lenLine /* delete remainder of word */
  709.             if substr(Line,i,1)<>' ' then
  710.                deleteChar
  711.             else
  712.                leave
  713.             endif
  714.          endfor
  715.          for j = i to lenLine /* delete delimiters following word */
  716.             if substr(Line,j,1)==' ' then
  717.                deleteChar
  718.             else
  719.                leave
  720.             endif
  721.          endfor
  722.       endif
  723. compile if EVERSION < 5
  724.    endif
  725. compile endif
  726.  
  727. compile if EVERSION >= '4.10'
  728. def c_e, c_del=erase_end_line  -- Ctrl-Del is the PM way.
  729. compile else
  730. def c_e=erase_end_line
  731. compile endif
  732.  
  733. compile if WANT_KEYWORD_HELP
  734. def c_h = 'kwhelp'
  735. compile endif
  736.  
  737. def c_end=
  738.  compile if WANT_STREAM_MODE = 'SWITCH'
  739.    universal stream_mode
  740. compile endif
  741. compile if WANT_CUA_MARKING
  742.    call begin_shift(startline, startcol, shift_flag)
  743. compile endif
  744. compile if WANT_STREAM_MODE = 'SWITCH'
  745.    if stream_mode then
  746. compile endif
  747. compile if WANT_STREAM_MODE
  748.       bottom; endline
  749. compile endif
  750. compile if WANT_STREAM_MODE = 'SWITCH'
  751.    else
  752. compile endif
  753. compile if WANT_STREAM_MODE <> 1
  754.       if .line=.last and .line then endline; endif
  755.       bottom
  756. compile endif
  757. compile if WANT_STREAM_MODE = 'SWITCH'
  758.    endif
  759. compile endif
  760. compile if WANT_CUA_MARKING
  761.    call end_shift(startline, startcol, shift_flag, 1)
  762. compile endif
  763.  
  764. compile if ENHANCED_ENTER_KEYS & C_ENTER_ACTION <> ''  -- define each key separately
  765. ; Nothing - defined below along with ENTER
  766. compile else
  767.  compile if EVERSION >= '4.10'
  768. def c_enter, c_pad_enter=     -- 4.10:  new key for enhanced keyboard
  769.  compile else
  770. def c_enter=
  771.  compile endif
  772.    call my_c_enter()
  773.  compile if E3 and SHOW_MODIFY_METHOD
  774.    call show_modify()
  775.  compile endif
  776. compile endif
  777.  
  778. def c_f=
  779. compile if defined(HIGHLIGHT_COLOR)
  780.    universal search_len
  781.  compile if EOS2
  782.    universal inKstring
  783.  compile endif
  784. compile endif
  785. compile if EVERSION > 5
  786.    sayerror 0
  787. compile endif
  788.    repeat_find       /* find next */
  789. compile if EVERSION < 5
  790.    if not rc then
  791.       cursor_data
  792.  compile if defined(HIGHLIGHT_COLOR)
  793.       refresh
  794.       sayat '', .windowy+.cursory-1,.windowx+.cursorx-1,
  795.             HIGHLIGHT_COLOR, min(search_len, .windowwidth - .cursorx + 1)
  796.   compile if EOS2
  797.       if inKstring <=0 then
  798.          k=mgetkey()
  799.          executekey k
  800.       endif
  801.   compile endif
  802.  compile endif
  803.    endif
  804. compile elseif defined(HIGHLIGHT_COLOR)
  805.    if not rc then
  806.  compile if EVERSION < '5.50'
  807.       refresh
  808.       sayat '', .cursory, .cursorx, HIGHLIGHT_COLOR, min(search_len, .windowwidth - .cursorx + 1)
  809.  compile elseif EVERSION >= '5.60'
  810.       circleit LOCATE_CIRCLE_STYLE, .line, .col, .col+getpminfo(EPMINFO_LSLENGTH)-1, LOCATE_CIRCLE_COLOR1, LOCATE_CIRCLE_COLOR2
  811.  compile elseif EVERSION >= '5.51'
  812.       circleit LOCATE_CIRCLE_STYLE, .line, .col, .col+getpminfo(EPMINFO_LSLENGTH)-1, HIGHLIGHT_COLOR
  813.  compile else
  814.       circleit LOCATE_CIRCLE_STYLE, .line, .col, .col+search_len-1, HIGHLIGHT_COLOR
  815.  compile endif
  816.    endif
  817. compile endif
  818.  
  819. def c_f1=
  820. compile if EVERSION < 5
  821.    call init_operation_on_commandline()
  822. compile endif
  823.    call psave_mark(save_mark)
  824.    call pmark_word()
  825.    call puppercase()
  826.    call prestore_mark(save_mark)
  827. compile if EVERSION < 5
  828.    call move_results_to_commandline()
  829. compile endif
  830.  
  831. def c_f2=
  832. compile if EVERSION < 5
  833.    call init_operation_on_commandline()
  834. compile endif
  835.    call psave_mark(save_mark)
  836.    call pmark_word()
  837.    call plowercase()
  838.    call prestore_mark(save_mark)
  839. compile if EVERSION < 5
  840.    call move_results_to_commandline()
  841. compile endif
  842.  
  843. def c_f3= call puppercase()
  844.  
  845. def c_f4= call plowercase()
  846.  
  847. def c_f5=
  848. compile if EVERSION < 5
  849.    call init_operation_on_commandline()
  850. compile endif
  851.    call pbegin_word()
  852. compile if EVERSION < 5
  853.    call move_results_to_commandline()
  854. compile endif
  855.  
  856. def c_f6=
  857. compile if EVERSION < 5
  858.    call init_operation_on_commandline()
  859. compile endif
  860.    call pend_word()
  861. compile if EVERSION < 5
  862.    call move_results_to_commandline()
  863. compile endif
  864.  
  865. compile if EPM
  866. def c_g='ring_more'
  867. compile endif
  868.  
  869. def c_home=
  870. compile if WANT_STREAM_MODE = 'SWITCH'
  871.    universal stream_mode
  872. compile endif
  873. compile if WANT_CUA_MARKING
  874.    call begin_shift(startline, startcol, shift_flag)
  875. compile endif
  876. compile if WANT_STREAM_MODE = 'SWITCH'
  877.    if stream_mode then
  878. compile endif
  879. compile if WANT_STREAM_MODE
  880.       top; begin_line
  881. compile endif
  882. compile if WANT_STREAM_MODE = 'SWITCH'
  883.    else
  884. compile endif
  885. compile if WANT_STREAM_MODE <> 1
  886.       if .line=1 then begin_line endif
  887.       top
  888. compile endif
  889. compile if WANT_STREAM_MODE = 'SWITCH'
  890.    endif
  891. compile endif
  892. compile if WANT_CUA_MARKING
  893.    call end_shift(startline, startcol, shift_flag, 0)
  894. compile endif
  895.  
  896. compile if WANT_WINDOWS
  897. def c_h=call psplith()            -- routine defined in WINDOW.E
  898. compile endif
  899.  
  900. def c_k=      -- Duplicate a line
  901.   getline line
  902.   insertline line,.line+1
  903.  
  904. def c_l =
  905.    if .line then
  906.       getline line
  907. compile if EPM
  908.       'commandline 'line
  909. compile else
  910.       if not command_state() then
  911.          cursor_command
  912.          begin_line;erase_end_line
  913.       endif
  914.       keyin line
  915. compile endif
  916.    endif
  917.  
  918. def c_left=
  919. compile if WANT_STREAM_MODE = 'SWITCH'
  920.    universal stream_mode
  921. compile endif
  922. compile if EVERSION < 5
  923.    call init_operation_on_commandline()
  924. compile endif
  925. compile if WANT_CUA_MARKING
  926.    call begin_shift(startline, startcol, shift_flag)
  927. compile endif
  928. compile if WANT_STREAM_MODE
  929.    if not .line then
  930.       begin_line
  931.  compile if WANT_STREAM_MODE = 'SWITCH'
  932.    elseif .line>1 & .col=max(1,verify(textline(.line),' ')) & stream_mode $NOT_CMD_STATE then
  933.  compile else
  934.    elseif .line>1 & .col=max(1,verify(textline(.line),' ')) $NOT_CMD_STATE then
  935.  compile endif
  936.       up; end_line
  937.    endif
  938. compile endif
  939.    backtab_word
  940. compile if EVERSION < 5
  941.    call move_results_to_commandline()
  942. compile endif
  943. compile if WANT_CUA_MARKING
  944.    call end_shift(startline, startcol, shift_flag, 0)
  945. compile endif
  946.  
  947. compile if WANT_BOOKMARKS
  948. def c_m = 'setmark'
  949. compile else  -- [The following doesn't apply to EPM.]
  950. ; This C-M definition allows external cut-and-paste utilities to
  951. ; feed text into E via the keyboard stream.  Most such utilities end each line
  952. ; of text with ASCII character 13.  This definition is needed because E
  953. ; distinguishes that as a different key (Ctrl-M) than Enter.
  954. def c_m =
  955.    insert
  956. compile endif
  957.  
  958. def c_pgup=
  959. compile if WANT_CUA_MARKING
  960.  compile if WANT_CUA_MARKING = 'SWITCH'
  961.    universal CUA_marking_switch
  962.    if CUA_marking_switch then
  963.  compile endif
  964.       unmark
  965.  compile if WANT_CUA_MARKING = 'SWITCH'
  966.    endif
  967.  compile endif
  968. compile endif
  969.    .cursory=1
  970.  
  971. def c_pgdn=
  972. compile if WANT_CUA_MARKING
  973.  compile if WANT_CUA_MARKING = 'SWITCH'
  974.    universal CUA_marking_switch
  975.    if CUA_marking_switch then
  976.  compile endif
  977.       unmark
  978.  compile if WANT_CUA_MARKING = 'SWITCH'
  979.    endif
  980.  compile endif
  981. compile endif
  982.    .cursory=.windowheight
  983.  
  984. compile if EVERSION < 5
  985. /************************************************************/
  986. /* Create a string of keys in Kstring variable.             */
  987. /* All control keys have the same character (X'00') as the  */
  988. /* first character of a two-character string.               */
  989. /*                                                          */
  990. /* The number of keys that may be stored is given by:       */
  991. /*           256 > n + 2*e                                  */
  992. /* where:                                                   */
  993. /*       n are normal data keys (one byte from BIOS)        */
  994. /*       e are extended code keys (two bytes from BIOS)     */
  995. /************************************************************/
  996. def c_r=
  997.    universal Kstring,Kins_state,Kcom_state,inKstring
  998.  
  999.    inKstring=-1      /* Set recording flag; see defproc mgetkey(). */
  1000.    sayerror CTRL_R__MSG
  1001.    oldKins_state=Kins_state
  1002.    oldKstring   =Kstring
  1003.    oldKcom_state=Kcom_state
  1004.    Kins_state   =insert_state()
  1005.    Kstring      =''
  1006.    Kcom_state   =command_state()
  1007.    Kct=0
  1008.    loop
  1009.       k=getkey()
  1010.       if k==c_r then  /* Ctrl-R ? */
  1011.          sayerror REMEMBERED__MSG
  1012.          leave
  1013.       endif
  1014.       if k==c_t then  /* Ctrl-T ? */
  1015.          leave
  1016.       endif
  1017.       if k==c_c then  /* cancel? */
  1018.          Kstring   =oldKstring
  1019.          Kins_state=oldKins_state
  1020.          Kcom_state=oldKcom_state
  1021.          sayerror CANCELLED__MSG'  'OLD_KEPT__MSG
  1022.          leave
  1023.       endif
  1024.       Kstring=Kstring||k
  1025.       Kct=length(Kstring)
  1026.       executekey k         /* execute AFTER adding to string */
  1027.       if Kct > MAXCOL then
  1028.          sayerror CTRL_R_ABORT__MSG
  1029.          Kstring=oldKstring
  1030.          Kins_state=oldKins_state
  1031.          Kcom_state=oldKcom_state
  1032.          loop
  1033.             k=getkey()
  1034.             if k==esc or k==c_c then leave endif   /* accept either */
  1035.          endloop
  1036.          sayerror OLD_KEPT__MSG
  1037.          leave
  1038.       endif
  1039.    endloop
  1040.    inKstring=0       /* lower state flag */
  1041.    if k==c_t then    /* Was it Ctrl-T? */
  1042.       sayerror 0     /* refresh the function keys */
  1043.       executekey k
  1044.    endif
  1045. compile endif
  1046.  
  1047. compile if EPM
  1048. def c_r
  1049.    -- Query to see if we are already in recording
  1050.    if windowmessage(1,  getpminfo(EPMINFO_EDITCLIENT),
  1051.                     5393,
  1052.                     0,
  1053.                     0)
  1054.    then
  1055.       call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  1056.                          5392,
  1057.                          0,
  1058.                          0)
  1059.       sayerror REMEMBERED__MSG
  1060.    else
  1061.       sayerror CTRL_R__MSG
  1062.       call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  1063.                          5390,
  1064.                          0,
  1065.                          0)
  1066.    endif
  1067. compile endif
  1068.  
  1069. def c_right=
  1070. compile if WANT_STREAM_MODE = 'SWITCH'
  1071.    universal stream_mode
  1072. compile endif
  1073. compile if EVERSION < 5
  1074.    call init_operation_on_commandline()
  1075. compile endif
  1076. compile if WANT_CUA_MARKING
  1077.    call begin_shift(startline, startcol, shift_flag)
  1078. compile endif
  1079. compile if WANT_STREAM_MODE
  1080.    getline line
  1081.  compile if WANT_STREAM_MODE = 'SWITCH'
  1082.    if not .line | lastpos(' ',line)<.col & .line<.last & stream_mode $NOT_CMD_STATE then
  1083.  compile else
  1084.    if not .line | lastpos(' ',line)<.col & .line<.last $NOT_CMD_STATE then
  1085.  compile endif
  1086.       down
  1087.       call pfirst_nonblank()
  1088.    else
  1089. compile endif
  1090.       tab_word
  1091. compile if WANT_STREAM_MODE
  1092.    endif
  1093. compile endif
  1094. compile if EVERSION < 5
  1095.    call move_results_to_commandline()
  1096. compile endif
  1097. compile if WANT_CUA_MARKING
  1098.    call end_shift(startline, startcol, shift_flag, 1)
  1099. compile endif
  1100.  
  1101. -- Pop up Search dialog
  1102. compile if EVERSION > 5
  1103. def c_s=
  1104.    'searchdlg'
  1105. compile endif
  1106.  
  1107. compile if EVERSION < 5
  1108. /************************************************************/
  1109. /* Execute the string of keys in Kstring variable.          */
  1110. /* All control keys have the same character (X'00') as the  */
  1111. /* first character of a two-character string                */
  1112. /*                                                          */
  1113. /* The number of keys that may be stored is given by:       */
  1114. /*           256 > n + 2*e                                  */
  1115. /* where:                                                   */
  1116. /*       n are normal data keys (one byte from BIOS)        */
  1117. /*       c are extended code keys (two bytes from BIOS)     */
  1118. /************************************************************/
  1119. def c_t=
  1120.    universal Kstring,Kins_state,Kcom_state,inKstring
  1121.  
  1122.    if Kstring=='' then
  1123.       sayerror NO_CTRL_R__MSG              /* HurleyJ */
  1124.       return
  1125.    endif   /* Has a string been recorded? */
  1126.    if Kins_state/==insert_state()   then  insert_toggle endif
  1127.    if Kcom_state/==command_state() then command_toggle endif
  1128.  
  1129.    inKstring=1    /* Set replaying flag; see defproc mgetkey(). */
  1130.    loop
  1131.       k=substr(Kstring,inKstring,1)
  1132.       ksize=1
  1133.       if k==substr(esc,1,1) then       /* extended key ? */
  1134.          k=substr(Kstring,inKstring,2) /* Yes, 2 bytes for extended key. */
  1135.          ksize=2
  1136.       endif
  1137.       inKstring=inKstring+ksize        /* bump index AFTER execution */
  1138.       executekey k
  1139.       if inKstring > length(Kstring) then leave endif
  1140.    endloop
  1141.    inKstring=0
  1142. compile endif
  1143.  
  1144. compile if EPM
  1145. def c_t
  1146.    call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  1147.                       5392,
  1148.                       0,
  1149.                       0)
  1150.    call windowmessage(0,  getpminfo(EPMINFO_EDITCLIENT),
  1151.                       5391,
  1152.                       0,
  1153.                       0)
  1154. compile endif
  1155.  
  1156. compile if not E3
  1157. def c_tab = keyin \9
  1158. compile endif
  1159.  
  1160. compile if EVERSION >= '5.20'
  1161. def c_u = 'undodlg'
  1162. compile endif
  1163.  
  1164. compile if WANT_WINDOWS
  1165. def c_v= call psplitv()           -- routine defined in WINDOW.E
  1166. def c_w= call pnextwindow()       -- routine defined in WINDOW.E
  1167. def c_z= call pzoom()             -- routine defined in WINDOW.E
  1168. compile endif
  1169.  
  1170. compile if EPM
  1171. def c_W=
  1172.    if marktype()<>'' then
  1173.       sayerror -279  -- 'Text already marked'
  1174.       return
  1175.    endif
  1176.    if find_token(startcol, endcol) then
  1177.       getfileid fid
  1178.       call pset_mark(.line, .line, startcol, endcol, 'BLOCK', fid)
  1179.    endif
  1180. compile endif
  1181.  
  1182. compile if EVERSION >= '5.50'
  1183. def c_Y = 'fontlist'
  1184. compile endif
  1185.  
  1186. def del=
  1187. compile if WANT_STREAM_MODE = 'SWITCH'
  1188.    universal stream_mode
  1189. compile endif
  1190. compile if WANT_CUA_MARKING & EPM
  1191.  compile if WANT_CUA_MARKING = 'SWITCH'
  1192.    universal CUA_marking_switch
  1193.    if marktype() & CUA_marking_switch then    -- If there's a mark, then
  1194.  compile else
  1195.    if marktype() then    -- If there's a mark, then
  1196.  compile endif
  1197.       if process_mark_like_cua() then return; endif
  1198.    endif
  1199. compile endif
  1200. compile if WANT_STREAM_MODE
  1201.    if .line then
  1202.       l=length(textline(.line))
  1203.    else
  1204.       l=.col    -- make the following IF fail
  1205.    endif
  1206.  compile if WANT_STREAM_MODE = 'SWITCH'
  1207.    if .col>l & stream_mode $NOT_CMD_STATE then
  1208.  compile else
  1209.    if .col>l $NOT_CMD_STATE then
  1210.  compile endif
  1211.       join
  1212.       .col=l+1
  1213.    else
  1214. compile endif  -- WANT_STREAM_MODE
  1215. compile if EVERSION >= '5.50'
  1216.       old_level = .levelofattributesupport
  1217.       if old_level & not (old_level%2 - 2*(old_level%4)) then
  1218.          .levelofattributesupport = .levelofattributesupport + 2
  1219.          .cursoroffset = 0
  1220.       endif
  1221. compile endif
  1222.       delete_char
  1223. compile if EVERSION >= '5.50'
  1224.       .levelofattributesupport = old_level
  1225. compile endif
  1226. compile if WANT_STREAM_MODE
  1227.    endif
  1228. compile endif
  1229.  
  1230. def down=
  1231. compile if WANT_CUA_MARKING
  1232.  compile if WANT_CUA_MARKING = 'SWITCH'
  1233.    universal CUA_marking_switch
  1234.    if CUA_marking_switch then
  1235.  compile endif
  1236.       unmark
  1237.  compile if WANT_CUA_MARKING = 'SWITCH'
  1238.    endif
  1239.  compile endif
  1240. compile endif
  1241. compile if WANT_STREAM_MODE
  1242.    call updownkey(1)
  1243. compile else
  1244.    down
  1245. compile endif
  1246.  
  1247. compile if WANT_CUA_MARKING & EPM
  1248. def s_down=
  1249.  compile if WANT_CUA_MARKING = 'SWITCH'
  1250.    universal CUA_marking_switch
  1251.  compile endif
  1252.    startline = .line; startcol = .col
  1253. compile if WANT_STREAM_MODE
  1254.    call updownkey(1)
  1255. compile else
  1256.    down
  1257. compile endif
  1258. ;compile if WANT_CUA_MARKING = 'SWITCH'
  1259. ;  if CUA_marking_switch then
  1260. ;compile endif
  1261.    if startline then call extend_mark(startline, startcol, 1); endif
  1262. ;compile if WANT_CUA_MARKING = 'SWITCH'
  1263. ;  endif
  1264. ;compile endif
  1265. compile endif
  1266.  
  1267. def end=
  1268. compile if WANT_CUA_MARKING
  1269.  compile if WANT_CUA_MARKING = 'SWITCH'
  1270.    universal CUA_marking_switch
  1271.    if CUA_marking_switch then
  1272.  compile endif
  1273.       unmark
  1274.  compile if WANT_CUA_MARKING = 'SWITCH'
  1275.    endif
  1276.  compile endif
  1277. compile endif
  1278.    end_line
  1279.  
  1280. compile if WANT_CUA_MARKING & EPM
  1281. def s_end =
  1282.    startline = .line; startcol = .col
  1283.    end_line
  1284.    call extend_mark(startline, startcol, 1)
  1285. compile endif
  1286.  
  1287. compile if ENHANCED_ENTER_KEYS & ENTER_ACTION <> ''  -- define each key separately
  1288. def enter =
  1289.    universal enterkey
  1290.  compile if WANT_EPM_SHELL & EPM_SHELL_PROMPT = '@prompt epm: $p $g'
  1291.    if leftstr(.filename, 15) = ".command_shell_" then
  1292.       shellnum=substr(.filename,16)
  1293.       getline line
  1294.       x = pos('>',line)
  1295.       text = substr(line,x+1)
  1296.       if leftstr(line,5)='epm: ' & x & shellnum & text<>'' then
  1297.          if .line=.last then .col=x+1; erase_end_line; endif
  1298.          'shell_write' shellnum text
  1299.       else
  1300.          call enter_common(enterkey)
  1301.       endif
  1302.    else
  1303.  compile endif
  1304.       call enter_common(enterkey)
  1305.  compile if WANT_EPM_SHELL & EPM_SHELL_PROMPT = '@prompt epm: $p $g'
  1306.   endif
  1307.  compile endif
  1308. def a_enter =
  1309.    universal a_enterkey
  1310.    call enter_common(a_enterkey)
  1311. def c_enter =
  1312.    universal c_enterkey
  1313.    call enter_common(c_enterkey)
  1314. def s_enter =
  1315.    universal s_enterkey
  1316.    call enter_common(s_enterkey)
  1317. def padenter =
  1318.    universal padenterkey
  1319.    call enter_common(padenterkey)
  1320. def a_padenter =
  1321.    universal a_padenterkey
  1322.    call enter_common(a_padenterkey)
  1323. def c_padenter =
  1324.    universal c_padenterkey
  1325.    call enter_common(c_padenterkey)
  1326. def s_padenter =
  1327.    universal s_padenterkey
  1328.    call enter_common(s_padenterkey)
  1329. compile else
  1330.  compile if EVERSION >= '4.10'
  1331.   compile if EVERSION < 5
  1332. def enter, pad_enter, a_enter, a_pad_enter=  --4.10: new enhanced keyboard keys
  1333.   compile else
  1334. def enter, pad_enter, a_enter, a_pad_enter, s_enter, s_padenter=
  1335.   compile endif
  1336.  compile else
  1337. def enter=
  1338.  compile endif
  1339.  compile if WANT_EPM_SHELL & EPM_SHELL_PROMPT = '@prompt epm: $p $g'
  1340.    if leftstr(.filename, 15) = ".command_shell_" then
  1341.       shellnum=substr(.filename,16)
  1342.       getline line
  1343.       x = pos('>',line)
  1344.       text = substr(line,x+1)
  1345.       if leftstr(line,5)='epm: ' & x & shellnum & text<>'' then
  1346.          if .line=.last then .col=x+1; erase_end_line; endif
  1347.          'shell_write' shellnum text
  1348.       else
  1349.          call my_enter()
  1350.       endif
  1351.    else
  1352.  compile endif
  1353.    call my_enter()
  1354.  compile if E3 and SHOW_MODIFY_METHOD
  1355.    call show_modify()
  1356.  compile endif
  1357.  compile if WANT_EPM_SHELL & EPM_SHELL_PROMPT = '@prompt epm: $p $g'
  1358.   endif
  1359.  compile endif
  1360. compile endif  -- ENHANCED_ENTER_KEYS & ENTER_ACTION <> ''
  1361.  
  1362. compile if not defined(NO_ESCAPE)
  1363.    const NO_ESCAPE = 0
  1364. compile endif
  1365.  
  1366. compile if EVERSION < 5
  1367. def esc=
  1368.    command_toggle
  1369.  compile if E3 and SHOW_MODIFY_METHOD
  1370.    call show_modify()
  1371.  compile endif
  1372. compile else  -- else EPM
  1373.  compile if NO_ESCAPE  -- Blame CUA  :-(
  1374. def esc=
  1375.   compile if TOGGLE_ESCAPE
  1376.    universal ESCAPE_KEY
  1377.   compile endif
  1378.  compile else
  1379. def esc, C_I=
  1380.  compile endif
  1381.    universal alt_R_active
  1382.  
  1383.    sayerror 0
  1384.    if alt_R_active<>'' then
  1385.  compile if EVERSION < '5.21'
  1386.       .messageline=''                        -- Turn off the message.
  1387.  compile else
  1388.        'setmessageline '\0
  1389.  compile endif
  1390.  compile if EVERSION >= '5.53'
  1391.       'toggleframe 2 'alt_R_active         -- Restore status of messageline.
  1392.  compile else
  1393.       'togglecontrol 8 'alt_R_active         -- Restore status of messageline.
  1394.  compile endif
  1395.       alt_R_active = ''
  1396.  compile if NO_ESCAPE
  1397.   compile if TOGGLE_ESCAPE
  1398.    elseif ESCAPE_KEY then
  1399.       'commandline'
  1400.   compile endif
  1401.    endif
  1402. def c_I='commandline'
  1403.  compile else
  1404.    else
  1405.       'commandline'
  1406.    endif
  1407.  compile endif  -- no Escape
  1408. compile endif  -- EPM
  1409.  
  1410. def f1= 'help'
  1411.  
  1412. def f2=
  1413. compile if SMARTSAVE
  1414.    if .modify then           -- Modified since last Save?
  1415.       'Save'                 --   Yes - save it
  1416.    else
  1417.  compile if EPM
  1418.       'commandline Save '
  1419.  compile else
  1420.       if not command_state() then
  1421.          cursor_command
  1422.       endif
  1423.       begin_line;erase_end_line
  1424.       keyin 'Save '
  1425.  compile endif
  1426.       sayerror 'No changes.  Press Enter to Save anyway.'
  1427.    endif
  1428. compile else
  1429.    'Save'
  1430. compile endif
  1431.  
  1432. def f3= 'quit'
  1433.  
  1434. def f4=
  1435. compile if SMARTFILE
  1436.    if .modify then           -- Modified since last Save?
  1437.       'File'                 --   Yes - save it and quit.
  1438.    else
  1439.       'Quit'                 --   No - just quit.
  1440.    endif
  1441. compile else
  1442.    'File'
  1443. compile endif
  1444.  
  1445. compile if EVERSION < 5
  1446. def f7=cursor_command; delete; begin_line; keyin 'Name '
  1447. def f8=cursor_command; delete; begin_line; keyin 'Edit '
  1448. compile else
  1449.                     /* keys by EPM */
  1450. def f5, c_O='OPENDLG'
  1451. def f7='rename'
  1452. def f8=
  1453.  compile if RING_OPTIONAL
  1454.    universal ring_enabled
  1455.    if not ring_enabled then
  1456.       sayerror NO_RING__MSG
  1457.       return
  1458.    endif
  1459.  compile endif
  1460.    'OPENDLG EDIT'
  1461. compile endif
  1462.  
  1463. compile if EVERSION < 5
  1464. def f9=undo
  1465. compile else
  1466. def f9, a_backspace = undo
  1467. compile endif
  1468.  
  1469.  
  1470. compile if EVERSION < 5
  1471.  compile if EVERSION < '4.10'          -- Early E doesn't support enh. kbd.
  1472. def f10,c_N= call pnextfile()             -- routine defined in WINDOW.E
  1473.  compile else
  1474. def f10,f12,c_N= call pnextfile()         -- routine defined in WINDOW.E
  1475.  compile endif
  1476. compile else
  1477. def f10,f12,c_N=   -- F10 is usual E default; F12 for enhanced kbd, c_N for EPM.
  1478.    nextfile
  1479. compile endif
  1480.  
  1481.  
  1482. def home =
  1483. compile if WANT_CUA_MARKING
  1484.  compile if WANT_CUA_MARKING = 'SWITCH'
  1485.    universal CUA_marking_switch
  1486.    if CUA_marking_switch then
  1487.  compile endif
  1488.       unmark
  1489.  compile if WANT_CUA_MARKING = 'SWITCH'
  1490.    endif
  1491.  compile endif
  1492. compile endif
  1493.    begin_line
  1494.  
  1495. compile if WANT_CUA_MARKING & EPM
  1496. def s_home =
  1497.    startline = .line; startcol = .col
  1498.    begin_line
  1499.    call extend_mark(startline, startcol, 0)
  1500. compile endif
  1501.  
  1502. def ins=insert_toggle
  1503. compile if EVERSION >='5.50'
  1504.    call fixup_cursor()
  1505. compile endif
  1506.  
  1507. def left=
  1508. compile if WANT_CUA_MARKING = 'SWITCH'
  1509.    universal CUA_marking_switch
  1510. compile endif
  1511. compile if WANT_STREAM_MODE = 'SWITCH'
  1512.    universal stream_mode
  1513.    if .line>1 & .col=1 & stream_mode $NOT_CMD_STATE then up; end_line; else left; endif
  1514. compile elseif WANT_STREAM_MODE
  1515.    if .line>1 & .col=1 $NOT_CMD_STATE then up; end_line; else left; endif
  1516. compile else
  1517.    left
  1518. compile endif
  1519. compile if WANT_CUA_MARKING
  1520.  compile if WANT_CUA_MARKING = 'SWITCH'
  1521.    if CUA_marking_switch then
  1522.  compile endif
  1523.       unmark
  1524.  compile if WANT_CUA_MARKING = 'SWITCH'
  1525.    endif
  1526.  compile endif
  1527. compile endif
  1528.  
  1529. compile if WANT_CUA_MARKING & EPM
  1530. def s_left =
  1531.    startline = .line; startcol = .col
  1532.    if .line>1 & .col=1 then up; end_line; else left; endif
  1533.    call extend_mark(startline, startcol, 0)
  1534. compile endif
  1535.  
  1536. compile if EVERSION < 5
  1537. def padminus=keyin '-'
  1538. def padplus=keyin '+'
  1539.  compile if EVERSION >= '4.10'
  1540. def padslash, c_padslash =keyin '/'     -- 4.10 for enhanced keyboard
  1541.  compile endif
  1542. def padstar=keyin '*'
  1543. compile endif
  1544. def pgup =
  1545. compile if WANT_CUA_MARKING
  1546.  compile if WANT_CUA_MARKING = 'SWITCH'
  1547.    universal CUA_marking_switch
  1548.    if CUA_marking_switch then
  1549.  compile endif
  1550.       unmark
  1551.  compile if WANT_CUA_MARKING = 'SWITCH'
  1552.    endif
  1553.  compile endif
  1554. compile endif
  1555.    page_up
  1556.  
  1557. def pgdn =
  1558. compile if WANT_CUA_MARKING
  1559.  compile if WANT_CUA_MARKING = 'SWITCH'
  1560.    universal CUA_marking_switch
  1561.    if CUA_marking_switch then
  1562.  compile endif
  1563.       unmark
  1564.  compile if WANT_CUA_MARKING = 'SWITCH'
  1565.    endif
  1566.  compile endif
  1567. compile endif
  1568.    page_down
  1569.  
  1570. def right=
  1571. compile if WANT_STREAM_MODE = 'SWITCH'
  1572.    universal stream_mode
  1573. compile endif
  1574. compile if WANT_CUA_MARKING
  1575.  compile if WANT_CUA_MARKING = 'SWITCH'
  1576.    universal CUA_marking_switch
  1577.    if CUA_marking_switch then
  1578.  compile endif
  1579.       unmark
  1580.  compile if WANT_CUA_MARKING = 'SWITCH'
  1581.    endif
  1582.  compile endif
  1583. compile endif
  1584. compile if WANT_STREAM_MODE
  1585.    if .line then l=length(textline(.line)); else l=.col; endif
  1586.  compile if WANT_STREAM_MODE = 'SWITCH'
  1587.    if .line<.last & .col>l & stream_mode $NOT_CMD_STATE then
  1588.  compile else
  1589.    if .line<.last & .col>l $NOT_CMD_STATE then
  1590.  compile endif
  1591.       down; begin_line
  1592.  compile if WANT_STREAM_MODE = 'SWITCH'
  1593.    elseif .line=.last & .col>l & stream_mode $NOT_CMD_STATE then   -- nop
  1594.  compile else
  1595.    elseif .line=.last & .col>l $NOT_CMD_STATE then  -- nop
  1596.  compile endif
  1597.    else
  1598.       right
  1599.    endif
  1600. compile else
  1601.    right
  1602. compile endif
  1603.  
  1604. compile if WANT_CUA_MARKING & EPM
  1605. def s_right =
  1606.    startline = .line; startcol = .col
  1607.    if .line then l=length(textline(.line)); else l=.col; endif
  1608.    if .line<.last & .col>l then
  1609.       down; begin_line
  1610.    elseif .line<>.last | .col<=l then
  1611.       right
  1612.    endif
  1613.    call extend_mark(startline, startcol, 1)
  1614. compile endif
  1615.  
  1616.  
  1617. def s_f1= /* scroll left */
  1618. compile if WANT_CUA_MARKING
  1619.  compile if WANT_CUA_MARKING = 'SWITCH'
  1620.    universal CUA_marking_switch
  1621.    if CUA_marking_switch then
  1622.  compile endif
  1623.       unmark
  1624.  compile if WANT_CUA_MARKING = 'SWITCH'
  1625.    endif
  1626.  compile endif
  1627. compile endif
  1628.    oldcursorx=.cursorx
  1629.    if .col-.cursorx then
  1630.       .col=.col-.cursorx
  1631.       .cursorx=oldcursorx
  1632.    elseif .cursorx>1 then
  1633.       left
  1634.    endif
  1635.  
  1636. def s_f2= /* scroll right */
  1637. compile if WANT_CUA_MARKING
  1638.  compile if WANT_CUA_MARKING = 'SWITCH'
  1639.    universal CUA_marking_switch
  1640.    if CUA_marking_switch then
  1641.  compile endif
  1642.       unmark
  1643.  compile if WANT_CUA_MARKING = 'SWITCH'
  1644.    endif
  1645.  compile endif
  1646. compile endif
  1647.   oldcursorx=.cursorx
  1648.   a=.col+.windowwidth-.cursorx+1
  1649.   if a<=MAXCOL then
  1650.      .col=a
  1651.      .cursorx=oldcursorx
  1652.   elseif .col<MAXCOL then
  1653.      right
  1654.   endif
  1655.  
  1656. def s_f3= /* scroll up */
  1657. compile if WANT_CUA_MARKING
  1658.  compile if WANT_CUA_MARKING = 'SWITCH'
  1659.    universal CUA_marking_switch
  1660.    if CUA_marking_switch then
  1661.  compile endif
  1662.       unmark
  1663.  compile if WANT_CUA_MARKING = 'SWITCH'
  1664.    endif
  1665.  compile endif
  1666. compile endif
  1667.   oldcursory=.cursory
  1668.   if .line-.cursory>-1 then
  1669.      .cursory=1
  1670.      up
  1671.      .cursory=oldcursory
  1672.   elseif .line then
  1673.      up
  1674.   endif
  1675.  
  1676. def s_f4= /* scroll down */
  1677. compile if WANT_CUA_MARKING
  1678.  compile if WANT_CUA_MARKING = 'SWITCH'
  1679.    universal CUA_marking_switch
  1680.    if CUA_marking_switch then
  1681.  compile endif
  1682.       unmark
  1683.  compile if WANT_CUA_MARKING = 'SWITCH'
  1684.    endif
  1685.  compile endif
  1686. compile endif
  1687.    oldcursory=.cursory
  1688.    if .line -.cursory+.windowheight<.last then
  1689.       .cursory=.windowheight
  1690.       down
  1691.       .cursory=oldcursory
  1692.    elseif .line<.last then
  1693.       down
  1694.    endif
  1695.  
  1696. def s_f5= /* center current line */
  1697. compile if WANT_CUA_MARKING
  1698.  compile if WANT_CUA_MARKING = 'SWITCH'
  1699.    universal CUA_marking_switch
  1700.    if CUA_marking_switch then
  1701.  compile endif
  1702.       unmark
  1703.  compile if WANT_CUA_MARKING = 'SWITCH'
  1704.    endif
  1705.  compile endif
  1706. compile endif
  1707.    oldline=.line
  1708.    .cursory=.windowheight%2
  1709.    oldline
  1710.  
  1711. compile if WANT_TAGS
  1712. def s_f6 = 'findtag'
  1713. def s_f7 = 'findtag *'
  1714. def s_f8 = 'tagsfile'
  1715. def s_f9 = 'maketags *'
  1716. compile endif -- WANT_TAGS
  1717.  
  1718. compile if EVERSION < 5
  1719. def s_pad5=keyin '5'
  1720. compile endif
  1721.  
  1722. def s_tab=
  1723.    universal matchtab_on
  1724. compile if WANT_CUA_MARKING
  1725.  compile if WANT_CUA_MARKING = 'SWITCH'
  1726.    universal CUA_marking_switch
  1727.    if CUA_marking_switch then
  1728.  compile endif
  1729.       unmark
  1730.  compile if WANT_CUA_MARKING = 'SWITCH'
  1731.    endif
  1732.  compile endif
  1733. compile endif
  1734. compile if EVERSION < 5
  1735.    call init_operation_on_commandline()
  1736. compile endif
  1737.    if matchtab_on & .line>1 $NOT_CMD_STATE then
  1738.       up
  1739.       backtab_word
  1740.       down
  1741.    else
  1742.       backtab
  1743.    endif
  1744. compile if EVERSION < 5
  1745.    call move_results_to_commandline()
  1746. compile endif
  1747.  
  1748. compile if EPM
  1749. def space, s_space, c_space  /* New in EPM.  Space is a virtual key under PM.*/
  1750.  compile if WANT_CUA_MARKING
  1751.   compile if WANT_CUA_MARKING = 'SWITCH'
  1752.    universal CUA_marking_switch
  1753.    if CUA_marking_switch then
  1754.   compile endif
  1755.       call process_mark_like_cua()
  1756.   compile if WANT_CUA_MARKING = 'SWITCH'
  1757.    endif
  1758.   compile endif
  1759.  compile endif
  1760.  compile if EVERSION >= '5.20'
  1761.    k=lastkey(1)
  1762.  compile endif
  1763.    keyin ' '
  1764.  compile if EVERSION >= '5.20'
  1765.    if k<>' ' then
  1766.       undoaction 1, junk                -- Create a new state
  1767.    endif
  1768.  compile endif
  1769. compile endif
  1770.  
  1771. def tab=
  1772. compile if WANT_STREAM_MODE = 'SWITCH'
  1773.    universal stream_mode
  1774. compile endif
  1775.    universal matchtab_on
  1776. compile if TOGGLE_TAB
  1777.    universal TAB_KEY
  1778. compile endif
  1779. compile if WANT_CUA_MARKING = 'SWITCH'
  1780.    universal CUA_marking_switch
  1781. compile endif     -------Start of logic:
  1782. compile if TOGGLE_TAB
  1783.    if TAB_KEY then
  1784.  compile if WANT_CUA_MARKING
  1785.   compile if WANT_CUA_MARKING = 'SWITCH'
  1786.       if CUA_marking_switch then
  1787.   compile endif
  1788.           process_key(\9)
  1789.   compile if WANT_CUA_MARKING = 'SWITCH'
  1790.       else
  1791.   compile endif
  1792.  compile endif  -- WANT_CUA_MARKING
  1793.          keyin \9
  1794.  compile if WANT_CUA_MARKING = 'SWITCH'
  1795.       endif
  1796.  compile endif
  1797.    else
  1798. compile endif  -- TOGGLE_TAB
  1799. compile if WANT_CUA_MARKING
  1800.  compile if WANT_CUA_MARKING = 'SWITCH'
  1801.    if CUA_marking_switch then
  1802.  compile endif
  1803.       unmark
  1804.  compile if WANT_CUA_MARKING = 'SWITCH'
  1805.    endif
  1806.  compile endif
  1807. compile endif
  1808. compile if EVERSION < 5
  1809.    call init_operation_on_commandline()
  1810. compile endif
  1811.    oldcol=.col
  1812.    if matchtab_on and .line>1 $NOT_CMD_STATE then
  1813.       up
  1814.       c=.col
  1815.       tab_word
  1816.       if oldcol>=.col then
  1817.          .col=oldcol
  1818.          tab
  1819.       endif
  1820.       down
  1821.    else
  1822.       tab
  1823.    endif
  1824. compile if WANT_STREAM_MODE
  1825.  compile if WANT_STREAM_MODE = 'SWITCH'
  1826.    if insertstate() & stream_mode $NOT_CMD_STATE then
  1827.  compile else
  1828.    if insertstate() $NOT_CMD_STATE then
  1829.  compile endif
  1830.       numspc=.col-oldcol
  1831.       if numspc>0 then
  1832.          .col=oldcol
  1833.          keyin substr('',1,numspc)
  1834.       endif
  1835.    endif
  1836. compile endif
  1837. compile if EVERSION < 5
  1838.    call move_results_to_commandline()
  1839. compile endif
  1840. compile if TOGGLE_TAB
  1841.    endif
  1842. compile endif  -- TOGGLE_TAB
  1843.  
  1844.  
  1845. def up=
  1846. compile if WANT_CUA_MARKING
  1847.  compile if WANT_CUA_MARKING = 'SWITCH'
  1848.    universal CUA_marking_switch
  1849.    if CUA_marking_switch then
  1850.  compile endif
  1851.       unmark
  1852.  compile if WANT_CUA_MARKING = 'SWITCH'
  1853.    endif
  1854.  compile endif
  1855. compile endif
  1856. compile if WANT_STREAM_MODE
  1857.    call updownkey(0)
  1858. compile else
  1859.    up
  1860. compile endif
  1861. compile if not TOP_OF_FILE_VALID
  1862.    if not .line then '+1'; endif
  1863. compile endif
  1864.  
  1865. compile if WANT_CUA_MARKING & EPM
  1866. def s_up=
  1867.  compile if WANT_CUA_MARKING = 'SWITCH'
  1868.    universal CUA_marking_switch
  1869.  compile endif
  1870.    startline = .line; startcol = .col
  1871.  compile if WANT_STREAM_MODE
  1872.    call updownkey(0)
  1873.  compile else
  1874.    up
  1875.  compile endif
  1876. ;compile if WANT_CUA_MARKING = 'SWITCH'
  1877. ;  if CUA_marking_switch then
  1878. ;compile endif
  1879.    if .line then call extend_mark(startline, startcol, 0); endif
  1880. ;compile if WANT_CUA_MARKING = 'SWITCH'
  1881. ;  endif
  1882. ;compile endif
  1883.  compile if not TOP_OF_FILE_VALID
  1884.    if not .line then '+1'; endif
  1885.  compile endif
  1886. compile endif
  1887.  
  1888. compile if EPM  -- Standard PM clipboard functions.
  1889. def s_del = 'cut'
  1890.  
  1891. def s_ins =
  1892.  compile if WANT_CUA_MARKING = 'SWITCH'
  1893.    universal CUA_marking_switch
  1894.    if CUA_marking_switch then
  1895.  compile endif
  1896.  compile if WANT_CUA_MARKING
  1897.       call process_mark_like_cua()
  1898.  compile endif
  1899.  compile if WANT_CUA_MARKING = 'SWITCH'
  1900.    endif
  1901.  compile endif
  1902.    'paste' DEFAULT_PASTE
  1903.  
  1904. def c_ins = 'copy2clip'
  1905. compile endif
  1906.  
  1907. compile if WANT_STREAM_MODE
  1908. defproc updownkey(down_flag)
  1909.    universal save_cursor_column
  1910.  compile if WANT_STREAM_MODE = 'SWITCH'
  1911.    universal stream_mode
  1912.    if stream_mode then
  1913.  compile endif
  1914.       lk = lastkey(1)
  1915.  compile if EPM
  1916.       updn = pos(leftstr(lk,1),\x18\x16) & pos(substr(lk,2,1),\x02\x0A\x12)   -- VK_DOWN or VK_UP, plain or Shift or Ctrl
  1917.  compile else
  1918.       updn = substr(lk,1,1)=\0 & pos(substr(lk,2,1),\x48\x50\x98\xA0\x8d\x91) -- Up, down, a_up, a_down, c_up, c_down
  1919.  compile endif
  1920.       if not updn then save_cursor_column = .col; endif
  1921.  compile if WANT_STREAM_MODE = 'SWITCH'
  1922.    endif
  1923.  compile endif
  1924.  
  1925.    if down_flag then down else up endif
  1926.  
  1927.  compile if WANT_STREAM_MODE = 'SWITCH'
  1928.    if .line & stream_mode then
  1929.  compile else
  1930.    if .line then
  1931.  compile endif
  1932.       l = length(textline(.line))
  1933.       if updn & l>=save_cursor_column then
  1934.          .col = save_cursor_column
  1935.       elseif updn | l<.col then
  1936.          end_line
  1937.       endif
  1938.    endif
  1939. compile endif  -- WANT_STREAM_MODE
  1940.  
  1941. /* ------ Keys unused in standard E ------------------------------------------
  1942.  
  1943. a_2, a_3, a_5, a_6, a_7, a_8, a_9
  1944.  
  1945. a_f2, a_f3, a_f4, a_f5, a_f6, a_f9
  1946.  
  1947. a_g, a_h, a_i, a_k, a_q, a_v
  1948.  
  1949. c_6, c_minus, c_backslash
  1950.  
  1951. c_leftbracket, c_rightbracket, (EOS2 only:) a_leftbracket, a_rightbracket
  1952.  
  1953. c_f9, c_f10
  1954.  
  1955. c_g, c_i, c_j, c_prtsc, c_q, c_u
  1956.  
  1957. f5
  1958.  
  1959. s_f6, s_f7, s_f8, s_f9, s_f10
  1960.  
  1961. -----  The following is for EOS2 4.10 or above only.  -----
  1962.  
  1963. New keys that work on even older unenhanced AT keyboards:
  1964.    c_up, c_down
  1965.    pad5, c_pad5
  1966.    c_padminus, c_padplus, c_padstar
  1967.    c_ins, c_del
  1968.    c_tab, a_tab
  1969.    a_leftbracket, a_rightbracket
  1970.  
  1971. On an enhanced keyboard only:
  1972.    f11, f12, and c_,s_,a_
  1973.    pad_enter               is defined the same as enter
  1974.    a_enter and a_padenter are defined the same as enter
  1975.    c_pad_enter             is defined the same as c_enter
  1976.    pad_slash               is defined the same as '/'
  1977.    c_padslash              is defined the same as '/'
  1978.  
  1979. -----  The following is for EPM only.  -----
  1980.   * Since we are using only keys defined by PM (and not looking at
  1981.     scan codes), we no longer have the keys:
  1982.       padplus, c_padplus, c_padstar
  1983.       pad_slash, c_padslash
  1984.       pad5, c_pad5
  1985.    * We gained the new keys:
  1986.     - space, s_space, c_space, and a_space
  1987.          (The space bar is a virtual key to PM, not a character key.  If you
  1988.          want to bind an action to the space key, write  def space=  instead of
  1989.          the old  def ' '= .  The good news is that you get all the shift
  1990.          states of the space bar, although alt_space is preempted by PM.)
  1991.     - c_1 through c_0
  1992.          (So now we have a complete set of alt- and ctrl-digits.)
  1993. ---------------------------------------------------------------------------- */
  1994.  
  1995.