home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / utilities / editors / ced-programs / markright.ced < prev    next >
Text File  |  1994-06-23  |  2KB  |  82 lines

  1. /*
  2.  * Mark.ced                                                    «
  3.  *                                                             «
  4.  * Marks current block/line with "«" on the right margin.      «
  5.  *                                                             «
  6.  * Author: Stefan Winterstein (winter@cs.uni-sb.de)            «
  7.  * Status: Public Domain                                       «
  8.  *
  9.  */
  10.  
  11. defmarker = '«'
  12. LF  = '0A'X
  13.  
  14. options results            /* Allow CygnusEd to pass status variables */
  15.  
  16. address 'rexx_ced'        /* Tell ARexx to talk to CygnusEd */
  17.  
  18. status 9
  19. word_wrap_on = result
  20. if word_wrap_on then 'word wrap'    /* turn Word-Wrap off */
  21.  
  22. status 47                /* get current line number */
  23. start = result
  24.  
  25. status 69                /* get start of block */
  26.     end = result
  27.  
  28. if end = -1 then do        /* No block marked */
  29.     end = start+1
  30. end
  31. else do
  32.     'mark block'        /* turn bock marking off */
  33. end
  34.  
  35. marker = defmarker
  36.  
  37. /*
  38.  * 'getstring' '"'defmarker'"' '"Mark block with:"'
  39.  * if (result = "") then exit
  40.  * else if (result = "RESULT") then marker = defmarker
  41.  *      else marker = result
  42.  */
  43.  
  44. if start > end then do    /* swap start with end */
  45.     t = start
  46.     start = end
  47.     end = t
  48. end
  49.  
  50. 'jump to line' start+1    /* goto start of block */
  51.  
  52. /*
  53.  * status 14                /* get right margin */
  54.  * maxwidth = result
  55.  */
  56. maxwidth = 79
  57.  
  58. do line = start while line < end
  59.     status 59            /* get length of line (including LF) */
  60.     maxwidth = max(maxwidth, result+1)
  61.     'down'
  62. end
  63.  
  64. 'jump to line' start+1    /* goto start of block */
  65. 'beg of line'
  66.  
  67. do line = start while line < end
  68.     'end of line'
  69.     status 46            /* get column number */
  70.     column = result+1
  71.     'text' copies(' ', abs(maxwidth - column)+1) /* fill in spaces */
  72.     'text' marker
  73.     'down'
  74. end
  75.  
  76. 'jump to line' start+1
  77. 'beg of line'
  78.  
  79. if word_wrap_on then 'word wrap'    /* turn Word-Wrap on again */
  80.  
  81. exit
  82.