jEdit Community - Resources for users of the jEdit Text Editor
change double-click text highlighting behaviour
Submitted by Markus.Daum on Thursday, 12 July, 2007 - 13:57
Hi,

I wonder if / how it is possible to change the behaviour of jedit when a word in the text edit pane is (LMB) double clicked. Currently it does select / highlight only coherent letters and numbers, but ignores any special characters (so that these characters will not be part of the selected text).

This is a problem for me, because I'm currently coding in MEL (Maya's Embedded Language), where all variable names have to be defined with a leading dollar sign, like "$myVariableName" for example. When I double click on such a variable name, everything but the special character(s) are selected / highlighted, so in my case only "myVariableName", but not "$myVariableName". How / where can I change this behaviour, i.e. how could I add the dollar sign to the characters that are considered by this double click selection?

Cheers!
Markus
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
This behavior is defined in the mode files
by shlomy on Thu, 12/07/2007 - 18:21
Read the jEdit help about mode files. Each buffer is opened in some jEdit mode, usually determined according to the filename extension (e.g. .cpp files are opened in C++ mode, .java files in Java mode). You can usually see the mode in which a buffer is opened on the right section of the status bar, inside parentheses. Each mode is defined in a "mode file" which specifies some properties of that mode, such as keywords for highlighting, word-break characters (which is what you're asking to change) etc. You can create your own mode file for MEL, or perhaps you can find one for download in the community site (look for files/mode files).
 
Sorry, the term is "edit modes"
by shlomy on Thu, 12/07/2007 - 18:23
In the jEdit help, look for "Editing source code" -> "Edit modes".
 
noWordSep
by Markus.Daum on Thu, 12/07/2007 - 19:22
Thanks a bunch mate! Smiling

I found 2 ways to achieve what I wanted:

1. Put the following line into the first or last 10 lines of your file to overwrite the buffer-local properties for this single file / this single buffer only:
:noWordSep=_$:
This defines the underscore and the dollar sign as non-alphanumeric characters that are NOT be treated as word separators, i.e. double-clicking on a word then selects everything including these two.

2. Create a mode file (as you've suggested) for MEL (which exists already on www.highend3d.com by the way, just search for jedit). Inside the < PROPS > tag, insert the following line:
< PROPERTY NAME="noWordSep" VALUE="_$" / >

with the all the characters that you want to exclude from being word-separators listed in the value of the VALUE variable. That's it! Smiling

Thanks again buddy!

Cheers,
Markus
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293