home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / MARKQUOT.E < prev    next >
Text File  |  1996-01-18  |  1KB  |  41 lines

  1. ; Here's a command to mark a quoted string.  I've defined the Ctrl+quote key
  2. ; to execute the command, so you can simply place the cursor anywhere inside
  3. ; the quotes and press Ctrl+' to have the contents of the string (without the
  4. ; surrounding quotes) marked.                     by Larry Margolis
  5. ;
  6. ; Best way to install is to add to your MYSTUFF.E:
  7. ;    include 'markquot.e'
  8. ; (without the ';' in col. 1) and then recompile the macros (ETPM EPM).
  9.  
  10.  
  11. compile if not defined(AF_CHAR)
  12.    include 'stdconst.e'
  13. compile endif
  14.  
  15. definit
  16.    universal activeaccel
  17.    buildacceltable activeaccel, 'markquote', AF_CHAR+AF_CONTROL,   39, 61000  -- c+'
  18.    activateacceltable  activeaccel
  19.  
  20. defc markquote =
  21.    getline line
  22.    q1 = lastpos("'", line, .col)
  23.    q2 = lastpos('"', line, .col)
  24.    if not (q1 + q2) then
  25.       sayerror 'No quotes!'
  26.       return
  27.    endif
  28.    if not q1 then
  29.       q1 = q2
  30.    elseif q2 then
  31.       q1 = min(q1, q2)
  32.    endif
  33.    q = substr(line, q1, 1)
  34.    q2 = pos(q, line, q1+1)
  35.    if not q2 then
  36.       sayerror 'Unmatched quotes!'
  37.       return
  38.    endif
  39.    getfileid fid
  40.    call pset_mark(.line, .line, q1+1, q2-1, 'BLOCK', fid)
  41.