> I am a new user to VEDIT. In the convert function under edit there is an
> option all lines same length. I understand that there is a macro called
> padlines.vdm that actually performs this function. Can someone help me to
> convert this to a macro that I can use with a command line
> invocation of vedit to just find the longest line and automatically pad
> with spaces to that length ?
This should be straightforward: in the user.mnu that comes with Vedit,
you will find an single line macro "find longest line", which can be
the core of your macro:
//(1) find longest line
#103=#104=0
Begin_Of_File()
while (! AT_EOF) {
EOL()
if (Cur_Col>#103) { #103=Cur_Col #104=Cur_Pos }
Line(1,ERRBREAK) }
Goto_Pos(#104)
As you see, It writes the position of the longest line to #104. Now you can
simply take this value and "redefine" it as the value of the current
Column, e.g. in NReg #105.
Then, you can go sequentially through the file and pad any line that is shorter
than #105:
// (2) pad lines
#105=Cur_Col // use value of #104 als # of Cur_Col
BOF() // Goto begin of file
While(! At_EOF){ // loop:
EOL() // Goto end of line
if (Cur_Col<#105) { ins_indent(#105) } // pad lines
line(1,errbreak) //next line, break out at EOF
}
Fritz
|
|