Loading ...
Sorry, an error occurred while loading the content.

Re[2]: [jasspa] "graphical" string-rectangle ?

Expand Messages
  • Steven Phillips
    Below is a version of string-rectangle with suggested changes, if no one objects this will be in the next release. Steve ... ; string-rectangle; The user is
    Message 1 of 7 , Jun 5, 2005
    • 0 Attachment
      Below is a version of string-rectangle with suggested changes, if no one
      objects this will be in the next release.

      Steve

      -----------------------------
      ; string-rectangle; The user is prompted for a string which is inserted at
      ; the same horizontal position on all lines spanned by the current region.
      define-macro string-rectangle
      set-variable #l0 $window-line
      set-variable #l3 $window-col
      exchange-point-and-mark
      set-variable #l2 $window-line
      exchange-point-and-mark
      ; Compute the top line.
      !if &gre #l0 #l2
      set-variable #l1 #l2
      set-variable #l2 #l0
      !else
      set-variable #l1 #l0
      !endif
      ; Get the string to insert
      !force set-variable #l6 @1
      !if ¬ $status
      set-variable #l6 @ml "String"
      !endif
      ; Fill all of the lines in the region from the first column.
      set-variable $window-line #l1
      !repeat
      ; Move to the column
      beginning-of-line
      !while &les $window-col #l3
      !if ¬ &seq @wc "\n"
      forward-char
      !else
      insert-string " "
      !endif
      !done
      ; Insert the string
      insert-string #l6
      !if ¬ &les $window-line #l2
      ; done the last line, return
      set-variable $window-line #l0
      set-variable $window-col &add #l3 &len #l6
      !return
      !endif
      forward-line
      !until 0
      !emacro
      -----------------------------
    Your message has been successfully submitted and would be delivered to recipients shortly.