Customize Select Word to include a dash, a dollar sign, or any other character as word char

General and specific configuration/INI settings

Customize Select Word to include a dash, a dollar sign, or any other character as word char

Postby pwdiener » Wed Jul 11, 2007 1:41 am

I have what is probably a new user question, but I can't seem to find the answer. While editing a COBOL program, I'd like a "word" to include a dash (e.g. FLD-LEN should be one word, not 2). This is particularly for select word (Ctrl-J) or as the default for Find.

I've looked at all the configuration options, but can't seem to find a relevant option. Is there one and which is it?

TIA
User avatar
pwdiener
Newbie
 
Posts: 1
Joined: Mon Jul 09, 2007 11:00 pm

Re: Customize Select Word to include a dash, a dollar sign, or any other character as word char

Postby Mofi » Wed Jul 11, 2007 7:38 am

No, the "Select Word" and the "Find dialog defaults to word under cursor" cannot be customized to include a dash as word character.

There is the Ctrl+Dbl Click feature which can be used to select a string depending on delimiters - see Configuration - Editor - Delimiters and it's help page.

If you want something similar which you can execute with a hotkey, you need a macro saved into a macro file which is automatically loaded on startup of UltraEdit and has a hotkey. Hope following macro code does the job:

UnixReOff
Loop
IfColNumGt 1
IfCharIs "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"
Key LEFT ARROW
Else
Key Ctrl+RIGHT ARROW
IfCharIs "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"
ExitLoop
Else
Key Ctrl+RIGHT ARROW
EndIf
EndIf
Else
ExitLoop
EndIf
EndLoop
Find RegExp "[0-9a-z^-_]+"

Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.

The character - respectively ^- in the regular expression search string can be replaced by $ or any other character. Other characters can be also just added. The escape character ^ in the regular expression search string is only needed for the characters - [ ] ^ while all other characters can be put within the square brackets of the expression without the escape character ^.

See also Assign Ctrl+Double Click to keyboard.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Customize Select Word to include a dash, a dollar sign, or any other character as word char

Postby BikeRider » Fri Sep 11, 2009 2:23 pm

Thanks Mofi. The macro works great. :D even better than ctrl+double-click. Example: AR03-I-OLD-ACTIVE-LST). ctrl+double-click selects the variable and the close-parenthesis, even though () are in the delimiters list in wordfile.txt for Cobol. The hotkey selects only the variable name, not the ")". I just need to assign it to a toolbar button, or to a click, something I can do with just the mouse. Thanks so much !!
BikeRider
Newbie
 
Posts: 1
Joined: Thu Sep 10, 2009 11:34 pm

Re: Customize Select Word to include a dash, a dollar sign, or any other character as word char

Postby Mofi » Sat Sep 12, 2009 1:25 am

The delimiters for Ctrl+Dbl Click can be configured at Advanced - Configuration - Editor - Delimiters. This feature uses by design (and that is good) not the word delimiters of the syntax highlighting.

You can't call a macro with mouse from a toolbar or menu. Fast executing a macro with the mouse is only possible with using an opened View - Views/Lists - Macro List view. Since UE v15.00 this view can be set as auto-hidding dockable view which would be the best for you using the mouse. But you can only add the command to toggle the macro list view to a toolbar to open/close the macro list view with the mouse and execute the macro with the mouse.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Configuration/INI Settings