Double clicking code sometimes select the whole line (2021b?)

15 views (last 30 days)
Fernando Zigunov
Fernando Zigunov on 15 Nov 2021
Answered: Pranjal Kaura on 29 Dec 2021 at 10:06
Hi, I've recently upated to Matlab 2021b and this has been bothering me for a while. Typically in text editors, double-clicking some word will select the whole word, and that is also true of Matlab. However, it appears that the recent Matlab update implemented some sort of full-line selection with conditions that are rather obscure and it feels to me like bad UX.
Not gonna lie, this is rather annoying and it makes me want to roll back the update as it does disrupt my train of thoughts as I code. From what I observed, if you have already selected a whole word with a double-click, and then you double-click another different word, then the next word you double-click will select the full line instead of only the word that was clicked.
A use case that annoys me a lot is when I'm copying a piece of code and replacing a variable with a different variable name in multiple locations by Ctrl-V'ing the variable name to the new locations. Then it'll select the whole line and I'll erase the entire line of code as I press Ctrl-V, ending up frustrated.
Is there a fix for this? Maybe a setting I can deactivate? And no, I don't want automatic replacing of variable names in my codes; thanks.

Answers (2)

Pranjal Kaura
Pranjal Kaura on 29 Dec 2021 at 10:06
Hey Fernando,
Thank you for bringing this up. I have heard that this issue is known and the corresponding parties are investigating it further and will try to fix it in future releases.

Akash Singh
Akash Singh on 8 Dec 2021
Double click selects the word.
Triple click selects the line, this change has been implemented in MATLAB 7.9 (R2009b) in order to allow a line of code to be selected, dragged, and inserted in a new position in a MATLAB file.
  1 Comment
Fernando Zigunov
Fernando Zigunov on 8 Dec 2021
You did not understand my question at all. This is not about triple click. It's about a double click being incorrectly interpreted as a triple click.
Try this:
Say we have the dumb code below:
SomeOtherVariable = 5;
Variable1 = Variable2 + Variable3;
Variable2 = Variable2 - Variable3;
Variable3 = Variable2 * Variable3;
Variable4 = Variable2 / Variable3;
Variable5 = Variable2 ^ Variable3;
Now say you want to change the Variable2 entries to SomeOtherVariable, but only in lines 2, 5 and 6 (i.e., replace all doesn't apply). Follow the exact sequence below, as fast as you can, to reproduce the issue:
  1. Double-click SomeOtherVariable in line 1.
  2. Press Ctrl+C to copy it to the clipboard;
  3. Double-click Variable2 in line 2.
  4. If your delay between Step 2 and Step 3 is <~200-300ms (maybe it depends on the local processor), it will select the entire line, as if a triple click was sent.
  5. You can keep reproducing the issue: Press Ctrl+V to replace the Variable2 with the clipboard contents;
  6. Now double-click Variable2 in line 5. It again selects the entire line if the sequence happens fast enough.
If you are too slow, simply go through the exercise of replacing all Variable2 entries to the clipboard contents by double-clicking and then Ctrl-V. You will eventually find out what I mean.
Key is: It is an annoying bug because it only happens if you're clicking fast. But that's exactly how fast I (and likely others) operate when you're in the flow, coding. It is frustrating because it breaks the flow!! This is something to do with Matlab R2021. I've already downgraded to R2018 in my machine, because this bug single-handedly drives me nuts.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by