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