Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What is the last letter in the word "SlickEdit":
How many LETTERS are in the following? "a1b2c3":
Which number is missing?  "12345689":

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: lwb-ztexas
« on: February 06, 2024, 07:05:34 PM »

FYI... I found my old macro:

#include "slick.sh"
#pragma option( strict, on )

_command void SearchWorkspaceForWord() name_info(','VSARG2_EDITORCTL|VSARG2_READ_ONLY)
{
   typeless old_pos, old_mark;
   save_pos( old_pos );
   save_selection( old_mark );
   _str ch = get_text( -1 );

   if ( _isSpaceChar( ch ) ) left();
   
   int start_col;
   old_search_string = cur_word(start_col);

   find_in_files();
}
Posted by: lwb-ztexas
« on: May 12, 2023, 09:03:18 PM »

I should have known you were right!  ::)

I had to look at "cur_word()", it wanted a defined parameter for the reference.

This works like a charm!

Thanks!


#include "slick.sh"
#pragma option( strict, on )

_command void SearchWorkspaceForWord() name_info(','VSARG2_EDITORCTL|VSARG2_READ_ONLY)
{
   typeless old_pos, old_mark;
   save_pos( old_pos );
   save_selection( old_mark );
   _str ch = get_text( -1 );

   if ( _isSpaceChar( ch ) ) left();
   
   int start_col;
   old_search_string = cur_word(start_col);

   find_in_files();
}
Posted by: patrick
« on: May 10, 2023, 08:23:46 PM »

That should be defined in the slick.sh you're including.  What version are you on, and what's the error it's giving you?
Posted by: lwb-ztexas
« on: May 10, 2023, 05:44:55 PM »

Hmmm...

This won't compile...
    old_search_string = word;

Is it possible this is a function call? (makes sense to not use a global...)

Or, is there a list of all the globals used by the internals of the editor?

Thanks
Posted by: lwb-ztexas
« on: May 10, 2023, 04:53:02 PM »

Genius! Thanks!
Posted by: patrick
« on: May 05, 2023, 10:15:04 AM »

For that one, there's a lot of code doing things with the search string combo box, and you can't pass the search string in through the form parameters, so I'd probably take a different approach to avoid possibly fighting it.  There's a var called old-search-string that find-in-files will put in the search string box as long as the options still have the default setting of using the search history.  So you could sneak in your current word like this:

Code: [Select]
#include "slick.sh"
#import "stdcmds.e"
#pragma option( strict, on )

_command void SearchWorkspaceForWord() name_info(','VSARG2_EDITORCTL|VSARG2_READ_ONLY)

{
   typeless old_pos, old_mark;
   save_pos( old_pos );
   save_selection( old_mark );
   _str ch = get_text( -1 );
   if ( _isSpaceChar( ch ) )
     left();
   word := cur_word(auto col);
   saved_search := old_search_string;
   old_search_string = word;
   find_in_files();
   old_search_string = saved_search;
}

Posted by: lwb-ztexas
« on: May 04, 2023, 04:58:36 PM »

I have used SE for years and written lots of macros. However, I have not used SE for the last 3 years and you forget things...

I want a macro, tied to a key that grabs the word under the cursor and pulls up the Find Files dialog and pastes it in the search field.
I have code that almost works, but I can't get the field selected in the dialog to paste. I'm certain this is a 30 second answer for one of you guys...

Here is my current code:

#include "slick.sh"
#pragma option( strict, on )

_command void SearchWorkspaceForWord() name_info(','VSARG2_EDITORCTL|VSARG2_READ_ONLY)
{
   typeless old_pos, old_mark;
   save_pos( old_pos );
   save_selection( old_mark );
   _str ch = get_text( -1 );
   if ( _isSpaceChar( ch ) )
     left();
   select_whole_word();
   copy_to_clipboard();
   find_in_files();
   select_whole_word();
====> I think I'm missing something here
   paste();
}

Thanks!