Hi,
I found that, sometimes, when I double click on a variable in PHP it doesn't only select the variable name, but also the '$' in front, and '-' at the end.
For example, when I have this line of code:
$pleaseClickHere->someMethod();
and I double click on the word 'Click', I expect to select this:
$pleaseClickHere->someMethod();
but on some occasions I get this:
$pleaseClickHere->someMethod();
I checked whether this could be caused by the character encoding of the file, but there does not seem to be a relation.
I looked for a setting for double clicks, but there doesn't seem to be one. Could this be a bug?
This happens in TP 8.1.1 under Windows 10, using the php-js-css-html.syn highlighter file.
Inconsistent selection on double click
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
In case you're talking about "PHP/JavaScript/CSS and HTML" at Syntax Definitions N-T then I could verify said behaviour. Change two lines in that file - find: and replace with: That stopped said behaviour for me in PHP code. I don't understand why the $ was selected and now isn't anymore, tho.
Code: Select all
InitKeyWordChars = A-Za-z_
KeyWordChars = A-Za-z0-9_
Code: Select all
InitKeyWordChars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_
KeyWordChars = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_
And you edited the file and restarted Textpad? Maybe the order of the instructions also matters - my file looks like this currently (too big for the post): http://pastebin.com/yA0HNAue
Yes, I edited and restarted, of course.
There's only one difference with your file, the empty KeyWordLength parameter is in a slightly different location.
I replaced my file with yours. This, however, made no difference. I tried several other things with the syntax file, without success.
I also could not find any good documentation for the syntax files. Am I missing something here? Clearly the syntax file is the cause. My test was: After renaming a .php file to .txt the double click selection works as expected. So we are on the right track here.
I forgot to mention that I am using the 64 bit version of TP.
Ok, here's something. When you change the syntax file in TP it says:
Enough, I'll use the other PHP syntax file, it is good enough for my purposes. Still, I don't like something I cannot explain.
There's only one difference with your file, the empty KeyWordLength parameter is in a slightly different location.
I replaced my file with yours. This, however, made no difference. I tried several other things with the syntax file, without success.
I also could not find any good documentation for the syntax files. Am I missing something here? Clearly the syntax file is the cause. My test was: After renaming a .php file to .txt the double click selection works as expected. So we are on the right track here.
I forgot to mention that I am using the 64 bit version of TP.
Ok, here's something. When you change the syntax file in TP it says:
And yes, '$' and '-' are used in keywords definitions of the syntax file. When I switch to another PHP syntax file (Contributed by Amit Verma, 12 September 2009) the double click works normally. It has not got '$' in any keyword, but it does have the '-' in some.When selecting and stepping over "words", the default set of characters in a word are letters, numbers and those used in keywords in the syntax file.
Enough, I'll use the other PHP syntax file, it is good enough for my purposes. Still, I don't like something I cannot explain.
-
- Posts: 27
- Joined: Mon Mar 06, 2006 5:31 pm
kikosoft2:
I had a revelation similar to yours. Please see my forum posting, and helios's response, here.
I had a revelation similar to yours. Please see my forum posting, and helios's response, here.
Art Metzer:
So the syntax specifications seem to have changed, or now work as they always should have?
In the end I did find the specifications of the syntax files in the 'TextPad Help' under the heading 'Syntax Definition Files'.
Would it be a good idea if TP used the 'KeyWordChars' parameter, when it is present, and only look at the characters in all the keywords, when it is absent? Then compatibility with existing syntax files would not be broken.
So the syntax specifications seem to have changed, or now work as they always should have?
In the end I did find the specifications of the syntax files in the 'TextPad Help' under the heading 'Syntax Definition Files'.
Would it be a good idea if TP used the 'KeyWordChars' parameter, when it is present, and only look at the characters in all the keywords, when it is absent? Then compatibility with existing syntax files would not be broken.