Sometimes clicking a variable will auto-select it

I can't tell what causes this to happen, but it's typically when there's some odd code or text in the file (like if I'm in the middle of writing a function call so the line is incomplete and invalid for compilation, or I've pasted text from another language that I'm converting to PHP), and then PHPStorm will switch into this bizarre state where clicking a variable will cause it to select the variable, and then sometimes it'll then switch to another state where it'll unselect it immediately after selecting it, leaving the cursor where you clicked.

Example of an intended double-click selection or of a single-click unintended auto-selection:

The auto-select can cause me to inadvertently move text around while trying to highlight a chunk of text with my mouse cursor, because clicking it auto-selects it, then moving the cursor (to select by character as the pointer moves) before I noticed it's auto-select will just move the text around (like when you double-click a variable to select it, then click the selection and hold the mouse button down to move the selection around).

The issue doesn't happen with every variable in the file, it just seems to happen randomly in a block of code for some reason, and not even on every click (though there does seem to be a pattern, I'm not sure what it is) and then that whole block is messed up until I restart PHPStorm (even cutting and pasting the block won't fix it). I can't tell why. I do know that it's supremely frustrating though.

Example of a block (using PDO)...

$arrayOne = array();
$iterationOne = 0;
$arrayTwo = array();
while ($sqlRowOne = $sqlResultOne->fetch()) {
$iterationOne++;
if ($sqlRowOne['market']) {
$sqlRowOneSplit = str_split($sqlRowOne['market'], 3);
if (!empty($sqlRowOneSplit[0]) && !empty($sqlRowOneSplit[1])) {
$arrayOne[] = "(origin = '{$sqlRowOneSplit[0]}' AND destination = '{$sqlRowOneSplit[1]}')";
$arrayTwo[] = array('origin' => $sqlRowOneSplit[0], 'destination' => $sqlRowOneSplit[1]);
}
}
}
sort($arrayOne);

Has anyone else run into this? It seems like the issue started a few updates ago.

0
2 comments

> The auto-select can cause me to inadvertently move text around while trying to highlight a chunk of text with my mouse cursor

 

Do you have "Move code fragments with drag-and-drop" enabled at File | Settings | Editor | General? If you do - please disable it.

You can also install "Presentation Assistant" plugin in attempt to notice what action exactly is called when the issue occurs.

1

Please sign in to leave a comment.