Topic: strange behaviour of macro exec'd in event macro (1 of 7), Read 40 times, 3 File Attachments
Conf: VEDIT Macro Language Support
From: Manfred Marten
Date: Friday, March 11, 2005 12:30 PM

the following drives me nuts and it seems to be a VEDIT-bug:
(I have compressed it to a few lines, the real code is more complex, but fully working as such (alt-m-x)!)
- try txt-pseudo-open.vdm by load/exec user macro (alt-m-x) in any file: this works (appends something to 1st line, goes to line 10; a file in another buffer and window is opened and perfectly closed, including buffer and window)
- now try the same vediting any .txt after first enabling event macros for .txt-extension (sample txt.cft included):
everything as expected except that a 2nd "buffer"/"window" rests open!!! (You can close it by pressing alt-f-c, by a command window and buf_quit(ok) etc)
- and not only rests this 2nd useless "buffer" open, there are 2 different behaviours:
- a) launch VEDIT, open .txt -> cursor remains in this 2nd buffer, even if the last command in the txt-pseudo-open.vdm is buf_switch("main")!
- b) launch .txt by double-clicking on it in Explorer (I use PowerDesk) -> 2nd buffer still open, but cursor correctly in 1st buffer!

- what's going on here? Any solutions? I launch VEDIT programmatically opening my source code and I don't want to alt-f-c these useless additional buffers hundreds of times daily...

kind regards

M. Marten

 
TXT-PSEUDO-OPEN.VDM (1KB)
 
TXT.CFT (1KB)
 
Screenshot

 


Topic: Re: strange behaviour of macro exec'd in event macro (2 of 7), Read 33 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Friday, March 11, 2005 04:16 PM

On Fri, 11 Mar 2005 00:30:00 -0500, Manfred Marten wrote:

>the following drives me nuts and it seems to be a VEDIT-bug:
>...
>- now try the same vediting any .txt after first enabling event macros
>for .txt-extension (sample txt.cft included):
>everything as expected except that a 2nd "buffer"/"window" rests open!
>...
>- what's going on here?

Manfred:

I can confirm that behaviour.

To make it a bit easier I stripped your example macro down to:

#99=Buf_Num
Begin_Of_File()
End_Of_Line()
Ins_Text("some text added")
File_Open('D:\temp\test2.txt',NOEVENT)
Buf_Quit(OK)
Buf_Switch(#99)
goto_line(10)


And it's not necessary to use the txt.cft.

Simply adding your two lines
Reg_Load(110,"c:\vedit\user-mac\txt-pseudo-open.vdm")
Config( F_E_F_MACRO, "Enable file open/close event macros",1)
to startup.vdm does it too.

(BTW: IMHO that is the better approach to load a
File-Open-Event-Macro, since it is active for all file types.)


So I too don't know what is going on here, but perhaps Ted has an
idea.


Christian

 


Topic: Re: strange behaviour of macro exec'd in event macro (3 of 7), Read 35 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, March 12, 2005 03:07 AM

Now I reduced the demo macro again.

// FOE-BUG.VDM - File-open-event macro demonstrating strange vedit bug
//
// To replicate:
// Add the following two lines to STARTUP.VDM:
// Reg_Load(110,"c:\vedit\user-mac\FOE-BUG.vdm")
// Config(F_E_F_MACRO, "Enable file open/close event macros",1)
//


// for "debugging"
//
if (WStat($)<0) { WinReserved($,5,BOTTOM) }
?

File_Open("|(VEDIT_TEMP)\test.txt",NOEVENT)
Buf_Quit(OK+MAINBUF+DELETE)

// if single-stepping up to here one can see that the buffer
// is closed as expected
// but then there is one buffer opened again and so this macro
// leaves an empty buffer open!

Buf_Switch(1) // (dummy command, only for stepping)


Christian - still puzzled

 


Topic: Re: strange behaviour of macro exec'd in event macro (5 of 7), Read 39 times
Conf: VEDIT Macro Language Support
From: Manfred Marten
Date: Saturday, March 12, 2005 09:28 AM

"// if single-stepping up to here one can see that the buffer
// is closed as expected
// but then there is one buffer opened again and so this macro
// leaves an empty buffer open!"

exactly, I forgot to mention this. And the 2nd thing I forgot: I'm using the latest VEDIT, V6.13.1 01/25/05, and there's no difference in the above behaviour between the 32- and 64-Bit versions.

Manfred

 


Topic: Re: strange behaviour of macro exec'd in event macro (6 of 7), Read 36 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Sunday, March 13, 2005 11:02 PM

At 03:07 AM 3/12/2005, you wrote:
>Now I reduced the demo macro again.
>
>// FOE-BUG.VDM - File-open-event macro demonstrating strange vedit bug
>//
>Christian - still puzzled

I will look into it this week. Thank you for simplifying it.

Ted.

 


Topic: Re: strange behaviour of macro exec'd in event macro (4 of 7), Read 34 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, March 12, 2005 08:43 AM

Ted:

Another observation:

While testing the above behaviour I found a possible internal string
error.


I had set Config( F_E_F_MACRO, "Enable file open/close event
macros",1)
and placed these two lines into T-Reg 110 as File-Open-Event-Macro:

?
Reg_type(121)

When opening a file now it shows that T-Reg 121 holds its path and
filename,
but with two trailing Null-Bytes:

Instead of "D:\vedit\test1.txt"
there is "D:\vedit\test1.txt**" with the asterisks being ASCII-0x00


I don't know if that is an error or not, but now you are informed ;-)


Christian

 


Topic: Re: strange behaviour of macro exec'd in event macro (7 of 7), Read 16 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Friday, April 15, 2005 06:17 PM

At 01:34 PM 3/11/2005, you wrote:
>From: "Manfred Marten"
>
>the following drives me nuts and it seems to be a VEDIT-bug:

You are trying to open another file in the middle of a File_Open(); we never intended to allow this as it would require making the File_Open() code recursive. We have tried to "fix" this, but it got too complex and we have
instead decided to explicitly disallow it.

Therefore the event macros cannot contain a File_Open() command.

You should be able to perform your function with File_Open_Read() and
File_Open_Write() commands; these are simpler commands which don't try
to open new buffer or new windows, nor do they support wildcards.

Please give this a try and let me know how it works.

Also, I am assuming the file-open event macro is trying to open/update
a log file. That seems like a reasonable thing to do; just use the
File_Open_Read() and File_Open_Write() commands.

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