MATLAB: When I type in ~ on the laptop (FN + ALT + 126) the cursor jumps and misplaces the tilde

2011alaptopshortcut

So far I checked 3 different laptops and I observe a rather annoyng behaviour on the last MATLAB release (also on R2010b?).
R2011a WIN32 Vista
A = rand(10,1);
idx = A > .5;
A(~idx)
When I position the cursor on the last idx to type the ~, after I press the FN + ALT + 126 the cursor automatically jumps to the first idx, then when I release the combination of keywords it places the tilde!
I tried to play with the shortcuts to find the conflict but didn't come up with a solution.
Is this a bug? [No]
EDIT
On QWERTY keyboards with no ~ (see italian keyboards), otherwise I would just use that.
EDIT Addressing Walter questions:
  • No matching idx to jump to: then it jumps before the |(|
  • idx further away: irrelevant
  • idxification: here comes the fun. Apparently it's the same as if the first bullet point BUT it interacts with A. If there's a preceding line starting with A but the first one, it jumps right before it. If the A appears only in the creation of the index, then again we are in the first bullet case BUT if no A appears in that line, then it DOESN'T jump.
  • idx.blentish: same behavior as previous bullet
  • Emacs was already turned off.
Other fun:
  • if I add operators as *+/- it jumps right before the last inline operator (no preference which one is the last)
  • Adding parenthesis make it jumps before the left outmost

Best Answer

If you have:
  • Windows OS
  • MATLAB 2010b or earlier
  • Laptops that do not have a ~ (tilde) on the keyboard (see Italian QWERTY).
The technical support suggested two solutions to insert the tilde:
  1. In File > Preferences > Keyboard > Shortcuts assign different combinations to "Go To Next Underline or Higlight" and "Go To Previous Underline or Higlight". I used respectively ALT+PAGE DOWN and ALT+PAGE UP.
  2. Enable the numerical pad before using ALT+126. In my case: FN+BLOC NUM > ALT+126 > FN+BLOC NUM.