SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: Dswag89 on October 27, 2006, 08:30:04 PM
-
I'm not a huge macro user, but I sporadically record "one-time" macros to clean up a set of data to be saved off. I've noticed some problems with SlickEdit 11 (currently using 11.0.2) and am wondering if this is a bug or a purposeful modification to how macros work. First off, here's the "dirty text".
vector_error_17( void )
6 0 11 0.545 ------
vector_error_1a( void )
6 0 11 0.545 ------
vector_error_1d( void )
6 0 11 0.545 ------
white_space( U_8 )
To set up my macro, I first perform a "CTRL+F" and search for '('. That places the cursor on (and highlights) the open-paren after vector_error_17. Then, I type:
CTRL+F11 (turns Macro Recording On)
SHIFT+END (highlight to end of line)
DELETE (Delete everything after the end of the open-paren)
CTRL+G (go to next open-paren)
CTRL+F12 (turns Macro Recording Off)
I saved this macro as "no_works" because when I run it, it successfully finds each "next" open-paren, but it does not delete the stuff from the current open-paren to the end of the line (like it did when I initially recorded it).
To get this macro to work, I had to do something slightly different.
Starting at the same point (cursor on and highlighting the open-paren after vector_error_17), I type:
CTRL+F11 (turns Macro Recording On)
LEFT ARROW (to get rid of selection)
RIGHT ARROW (to get back beside open paren)
SHIFT+END (highlight to end of line)
DELETE (Delete everything after the end of the open-paren)
CTRL+G (go to next open-paren)
CTRL+F12 (turns Macro Recording Off)
I saved this macro as "works" because it does exactly what I wanted. My question is, why do I have to do the left-arrow + right-arrow thing to deselect before doing the rest of my macro? I know I didn't have to do this back with SE6.
Thanks for any help/guidance!
For further info, here's the Slick-C code for both of the macros:
_command works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
_macro('R',1);
_deselect();
cursor_left();
cursor_right();
deselect();
_select_char('','E');
end_line();
select_it('CHAR','','E');
delete_selection();
find_next();
}
_command no_works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
_macro('R',1);
end_line();
select_it('CHAR','','E');
delete_selection();
find_next();
}
-
In order to delete a character selection block, you need to set up both a starting and an ending point to define the block. In your sample code (no_works), I only see one call to select_it()... after you move to the end of line. Put in another call to select_it() before moving to the end of line and it will work:
_command no_works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
_macro('R',1);
select_it('CHAR','','E'); // start block
end_line();
select_it('CHAR','','E'); // end block
delete_selection();
find_next();
}
-
Or use delete-end-line in this use case.
Maybe there is an issue w/ hiliting and really selecting ...
In general it's seems more 'save' to explicitely set start and end of a selection in the desired mode.
Or to specify more sophisticated regexps (and use replace) ;)
HS2
-
Thanks for the thoughts, but like I've said in the past... I'm really not a power-user. I just hack-through these types of edits and then throw away the macros. The "no-works" key sequences work in SE6 but don't work now... so I think something has changed. As for using more sophisticated reg-exs, it would take me 5 times as long to figure out the regular expression to setup as it did to figure out the work-around. I really don't use them often enough to have them in my head. I don't really think it is worth reporting as a bug to "Support", but I know that the developers watch this forum quite closely and if one of them picks it up, we'll see where it leads...
-
...take me 5 times as long to figure out the regular expression...
Me too - that's the reason for the ;) ...
HS2