copy line block to column location

0 views
Skip to first unread message

Larry

unread,
Nov 10, 2009, 11:46:15 AM11/10/09
to GoogleSemWare TSE, TsePro
/***
Just to complete the circle, this macro will convert a line block into a
column block and copy it to the cursor position, even if the cursor is
in another file.
 
The block-copy is the normal column block 'push' copy.
 
As an example, say you have 10000 lines containing something or other in
a column, but you only want to copy 5000 lines to another file at a
column location. With this macro, you can use the easy line-block to
mark those 5000 lines of column data without having to manually find the
longest line in the marked block, place the cursor at the desired
location, execute the macro, and those 5000 lines will smoothly fit into
the column position at that location.
 
Of course, you can always adapt it to 'move' and/or 'overwrite'.
***/
 
// macro source starts here
// jigcopyline2col.s - copies a line block to a column block
 
<ctrlshift x><l> execmacro("jigcopyline2col")
 
/***
This macro will convert a line block into a column block
and copy it to the cursor position.
***/
 
proc main()
 
integer ll=0
integer bl=query(blockbegline)
integer el=query(blockendline)
 
if isblockmarked()==_line_
  pushposition()
  gotoblockbegin()
  pushposition()
  createtempbuffer()
  copyblock()
  ll=longestlineinbuffer()
  abandonfile()
  popposition()
  markcolumn(bl,1,el,ll)
  popposition()
  copyblock()
else
  sound(60,40)
  warn("No Line Block Marked. Ending.")
  goto ending
endif
sound(9000,40)
 
goto ending
ending:
 
end
// macro source ends here
Reply all
Reply to author
Forward
0 new messages