Topic: User Macro Mangles Long Lines (1 of 15), Read 24 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 11:20 AM

My problem is that my user macros are mangling long (> about 72 chars) lines when the word wrap display is enabled, but handles them fine when word wrap display is disabled.

I would have thought that the display settings would not affect a file being edited or the macro acting upon it, but such does not seem to be the case.

I have posted a ZIP file containing a macro, an input file, output files created with and without word wrap display enabled, and a readme describing the problem and my system:

http://members.cox.net/dalehcook/macro.zip

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (2 of 15), Read 26 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, December 17, 2005 11:42 AM

On Sat, 17 Dec 2005 11:20:00 -0500, Dale Cook wrote:

>My problem is that my user macros are mangling long (> about 72 chars) lines
>when the word wrap display is enabled, but handles them fine when word wrap
>display is disabled.
>
>I would have thought that the display settings would not affect a
>file being edited or the macro acting upon it, but such does not
>seem to be the case.

Dale:

Perhaps you mixed up
"Enable word wrap (hard CR/LF)"
with
"Display long lines with word wrap" ?


The first one changes the file!
The second one changes the display only.


Christian

 


Topic: Re: User Macro Mangles Long Lines (3 of 15), Read 26 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 12:11 PM

> Perhaps you mixed up
> "Enable word wrap (hard CR/LF)"
> with
> "Display long lines with word wrap" ?
>
> The first one changes the file!
> The second one changes the display only.

Christian -

Nope - I understand the difference. I never use the hard CR/LF wrap - it isn't useful with the way I write HTML.

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (4 of 15), Read 24 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, December 17, 2005 01:36 PM

On Sat, 17 Dec 2005 00:11:00 -0500, Dale Cook wrote:

>Nope - I understand the difference. I never use the hard CR/LF wrap
>- it isn't useful with the way I write HTML.

Dale:

It was worth a try ;-)


I executed your macro now and can confirm a difference in the
resulting file when word wrap is enabled.

At a first glance I can't see the reason for that.
I think I can remember a problem with virtual EOL's (due to word wrap)
but not the details...

I'll search a bit.


Christian

 


Topic: Re: User Macro Mangles Long Lines (5 of 15), Read 26 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, December 17, 2005 03:32 PM

On Sat, 17 Dec 2005 13:36:00 -0500, Christian Ziemski wrote:

>On Sat, 17 Dec 2005 00:11:00 -0500, Dale Cook wrote:
>
>>Nope - I understand the difference. I never use the hard CR/LF wrap
>>- it isn't useful with the way I write HTML.

Unfortunately VEDIT seems to have a problem recognizing virtual EOL's.

In your macro the following loop causes the strange behavior:

Begin_Of_File
while (!At_EOB) {
Replace(' ',' ',NOERR)
Line(1,NOERR)
}

The Line(1) forwards the cursor not only a real line down but also a
virtual one.

You can easily replicate it:
Open a file and enable "Display long lines with word wrap" so that
there are wrapped lines.

Then open the little command mode window and move through the file
with Line(1) commands.


I think for now you have to make sure that Word wrap is disabled when
running macros.
(I didn't find the older posting/mail yet, regarding that already
known problem with the command EoL)


Christian

 


Topic: Re: User Macro Mangles Long Lines (6 of 15), Read 25 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 03:46 PM

> I think for now you have to make sure that Word wrap is
> disabled when running macros.

Christian -

That is what I will do - I expect it won't take too long to find the cause of the odd behavior. :)

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (7 of 15), Read 24 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Saturday, December 17, 2005 04:05 PM

At 11:20 AM 12/17/2005, you wrote:
>My problem is that my user macros are mangling long (> about 72 chars) lines when the word wrap display is enabled, but handles them fine when word wrap display is disabled.

When "Word wrap display" is enabled, the definition of a "line" changes significantly. If this is a problem, your macro must turn it off.

Ted.

 


Topic: Re: User Macro Mangles Long Lines (8 of 15), Read 26 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, December 17, 2005 04:48 PM

On Sat, 17 Dec 2005 16:05:00 -0500, Ted Green wrote:

>When "Word wrap display" is enabled, the definition of a "line"
>changes significantly.
>If this is a problem, your macro must turn it off.


I assume that most (if not all) macros would have a problem with that.

So a
Config( D_DSP_WRAP, "Enable word wrap (display) (*)", 0 )
is almost mandantory in a macro...

Wouldn't it make sense to disable Word wrap automatically for macros?


Christian

 


Topic: Re: User Macro Mangles Long Lines (9 of 15), Read 23 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 05:37 PM

On Sat, 17 Dec 2005 16:05:00 -0500, Ted Green wrote:

> When "Word wrap display" is enabled, the definition of a
> "line" changes significantly.
> If this is a problem, your macro must turn it off.

That is what had me puzzled - I expected that a display setting would affect only the display and not the file being edited.



And on Sat, 17 Dec 2005 16:48:00 -0500, Christian Ziemski wrote:

> So a
> Config( D_DSP_WRAP, "Enable word wrap (display) (*)", 0 )
> is almost mandantory in a macro...

I have added that, and the matching "1" command to re-enable, to my macros.

> Wouldn't it make sense to disable Word wrap automatically
> for macros?

It would to me. :)

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (10 of 15), Read 23 times
Conf: VEDIT Macro Language Support
From: Ian Binnie
Date: Saturday, December 17, 2005 05:56 PM

On 12/17/2005 5:37:22 PM, Dale Cook wrote:
>On Sat, 17 Dec 2005 16:05:00 -0500, Ted
>Green wrote:

> When "Word wrap display"
>is enabled, the definition of a
> "line"
>changes significantly.
> If this is a
>problem, your macro must turn it
>off.

That is what had me puzzled - I
>expected that a display setting would
>affect only the display and not the file
>being edited.



And on Sat, 17 Dec 2005
>16:48:00 -0500, Christian Ziemski
>wrote:

> So a
> Config( D_DSP_WRAP,
>"Enable word wrap (display) (*)", 0 )
>
>is almost mandantory in a macro...

I
>have added that, and the matching "1"
>command to re-enable, to my macros.

>
>Wouldn't it make sense to disable Word
>wrap automatically
> for macros?

It
>would to me. :)

Dale,
There were problems with this (discussed in the link below).

Christian, Ted et al,
I encountered this problem in 2004 (see the thread:-
http://webboard..../read?18400,30e#18400)

I now routinely disable word wrap in macros, but thought the change Ted mentioned effectively resolved the problem.

Dale does not mention what version he is using.

 


Topic: Re: User Macro Mangles Long Lines (11 of 15), Read 23 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 07:07 PM

On Saturday, December 17, 2005 05:56 PM, Ian Binnie wrote:

> Dale does not mention what version he is using.

6.13.1

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (14 of 15), Read 21 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Sunday, December 18, 2005 03:07 AM

On 12/17/2005 5:56:06 PM, Ian Binnie wrote:
>
>There were problems with this (discussed in the link below).
>
>I encountered this problem in 2004 (see the thread:-
>http://webboard..../read?18400,30e#18400)
>
>I now routinely disable word wrap in macros, but thought the change Ted
>mentioned effectively resolved the problem.

Thanks Ian for finding that thread.
Really interesting to read again!

Christian

 


Topic: Re: User Macro Mangles Long Lines (12 of 15), Read 21 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Saturday, December 17, 2005 09:20 PM

At 05:37 PM 12/17/2005, you wrote:

>That is what had me puzzled - I expected that a display setting would affect only the display and not the file being edited.

I pondered this for a long time and experimented with different ways. If you are viewing the file differently, then a macro often needs to "view" it in the same way. For example, print.vdm prints very differently depending on the display mode.

Some editing functions are implemented internally in the macro language.

Ted.

 


Topic: Re: User Macro Mangles Long Lines (13 of 15), Read 20 times
Conf: VEDIT Macro Language Support
From: Dale Cook
Date: Saturday, December 17, 2005 10:06 PM

On Saturday, December 17, 2005 09:20 PM, Ted Green wrote:

> I pondered this for a long time and experimented with
> different ways. If you are viewing the file differently,
> then a macro often needs to "view" it in the same way. For
> example, print.vdm prints very differently depending on the
> display mode.

Ted -

I'll gladly leave those decisions to you. What is important is that I posted my problem and had a cure in a matter of hours. I've owned Vedit for about 15 years, and just re-upped my SSP the other day. The support I have gotten from you, your staff, and other folks in the forums over the years is one of the reasons why I consider the SSP a bargain.

Dale H. Cook

 


Topic: Re: User Macro Mangles Long Lines (15 of 15), Read 20 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Sunday, December 18, 2005 03:36 PM

At 10:06 PM 12/17/2005, you wrote:
>I'll gladly leave those decisions to you. What is important is that I posted my problem and had a cure in a matter of hours. I've owned Vedit for about 15 years, and just re-upped my SSP the other day. The support I have gotten from you, your staff, and other folks in the forums over the years is one of the reasons why I consider the SSP a bargain.

Dale:

Thank you for the kind words.

Ted.


Ted.
-------------------------------------------------------------------------
Ted Green (ted@...) Greenview Data, Inc.
Web: www.... Fax: 734-996-1308 PO Box 1586, Ann Arbor, MI 48106
Tel: (734) 996-1300 Desk: 734-369-3550 VEDIT - Text/Data/Binary Editor
-------------------------------------------------------------------------
www.SpamStopsHere.com ranked #1 in accuracy by Network Computing Magazine