home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311CMD.ZIP / SENTENCE.CMD < prev    next >
OS/2 REXX Batch file  |  1990-06-19  |  2KB  |  114 lines

  1. ;; macro 29 next sentence -- defn:  go to beginning of word following either a
  2. ;; "." or \n\n
  3. 29 store-macro
  4.     add-mode "magic"
  5.     set %ccol $curcol
  6.     set %cline $curline
  7.     !force search-forward "\."
  8.     !if $status 
  9.         set %pcol $curcol
  10.         set %pline $curline
  11.     !else
  12.          set %pcol 0
  13.         end-of-file
  14.         set %pline $curline
  15.     !endif
  16.     set $curline %cline
  17.     set $curcol %ccol
  18.     !force search-forward "~n *~n"
  19.     !if $status 
  20.         set %ncol $curcol
  21.         set %nline $curline
  22.     !else
  23.         set %ncol 0
  24.         end-of-file
  25.         set %nline $curline
  26.     !endif
  27.     set $curline %cline
  28.     set $curcol %ccol
  29.     delete-mode "magic"
  30.     !if &less %pline %nline
  31. ;;        period before newlines
  32.         set $curline %pline
  33.         set $curcol %pcol
  34.         next-word
  35.  
  36.     !else
  37.         !if &and &equal %nline %pline &less %pcol %ncol
  38. ;;        here is both on same line and new line after. so .
  39.             set $curline %pline
  40.             set $curcol %pcol
  41.             next-word
  42.         !else
  43.             set $curline %nline
  44.             set $curcol %ncol
  45.         !endif
  46.     !endif
  47.  
  48. !endm
  49. ;; macro 28 previous sentence -- defn:  go to beginning of word following either a
  50. ;; "." or \n\n after a reverse search
  51. 28    store-macro
  52.     set %scol $curcol
  53.     set %sline $curline
  54. *rep28
  55.     set %ccol $curcol
  56.     set %cline $curline
  57.     add-mode "magic"
  58.     !force search-reverse "\."
  59.     !if $status 
  60.         set %pcol $curcol
  61.         set %pline $curline
  62.     !else
  63.         set %pcol 0
  64.         set %pline 1
  65.     !endif
  66.     set $curline %cline
  67.     set $curcol %ccol
  68.     !force search-reverse "~n *~n"
  69.     !if $status 
  70.         set %ncol $curcol
  71.         set %nline $curline
  72.     !else
  73.         set %ncol 0
  74.         set %nline 1
  75.     !endif
  76.     delete-mode "magic"
  77.     !if &less %nline %pline
  78. ;;        period after newlines so .
  79.         set $curline %pline
  80.         set $curcol %pcol
  81.         next-word
  82.  
  83.     !else
  84.         !if &and &equal %nline %pline &less %ncol %pcol
  85. ;;        here both on same line and new line before ncol. so period.
  86.             set $curline %pline
  87.             set $curcol %pcol
  88.             next-word
  89.         !else
  90. ;;    use newlines
  91.             set $curline %nline
  92.             set $curcol %ncol
  93.             !if &and &equal $curcol 0 &equal $curline 1
  94.                 !return
  95.             !else
  96.                 2 forward-character
  97.             !endif
  98.         !endif
  99.     !endif
  100. ;;    now see if the current position is at or to the right of the starting
  101. ;;    position.  if yes, then return
  102.     !if &less $curline %sline
  103.         !return
  104.     !else
  105.         !if &less $curcol %scol
  106.             !return
  107.         !endif
  108.     !endif
  109.     previous-word
  110.     !goto rep28
  111. !endm
  112. bind-to-key execute-macro-29 M-FNF
  113. bind-to-key execute-macro-28 M-FNB
  114.