I'm using IDE 2.0.4 on Win 11 with the Teensy 4.1 microprocessor. I have a default statement at the end of a switch block:
default:
break;
I place the cursor at the end of the default expression and press Enter to open an empty line between the two keywords. The line opens up and the cursor positions itself so it aligns with the default keyword. Within a few seconds, it automatically repositions itself to the extreme left edge of the Source Window. I must then manually insert tabs to get it to the proper indent with the break keyword.
Is this the intended behavior? If so, I would prefer it follow the auto-formatting pattern and position the cursor directly below default , inset one tab space so it's aligned with break , ready for me to enter a new expression.
It's a known issue. Workaround : IDE 2 unwanted cursor movement - #2 by ptillisch
I don't know if it was solved in 2.0.4 (and if you are on 2.0.4), you can check the release notes.
it is also an issue in version 2.0.3 and i don't think they ficed it in this latest version which is version 2.0.4. You may try to create a post in their support page so they can notice this issue. I am currently experiencing this issue up until now check.
Also you may check this solution. IDE 2 unwanted cursor movement - #2 by ptillisch
That is correct. If you have a GitHub account, you can subscribe to the formal bug report here:
opened 09:50AM - 06 Jul 21 UTC
closed 04:55PM - 28 Mar 23 UTC
conclusion: resolved
topic: code
type: imperfection
### Describe the problem
While editing, the cursor sometimes randomly jumps t… o the beginning of a new line
### To reproduce
1. Edit sketch
2. Usually when typing a new line, cursor will jump to beginning of next line
3. Seems to be related to auto-indent with tabs
### Expected behavior
The cursor should not jump around and stay where I am typing
### Arduino IDE version
2.0.0-beta.7
### Operating system
macOS
### Operating system version
Big Sur
### Additional context
#### Additional reports
- https://github.com/arduino/arduino-ide/issues/1669
- https://github.com/arduino/arduino-ide/issues/1534
- https://github.com/arduino/arduino-ide/issues/1364
- https://github.com/arduino/arduino-ide/issues/476
- https://github.com/arduino/arduino-ide/issues/810#issuecomment-1030400240
- https://forum.arduino.cc/t/cursor-jumping-problem/1023535
- https://forum.arduino.cc/t/ide-2-unwanted-cursor-movement/1060945
- https://forum.arduino.cc/t/arduino-ide-2-0-0-beta-12-weird-auto-newlines/920733
- https://forum.arduino.cc/t/misunderstood-ide-behaviour/1053246
- https://forum.arduino.cc/t/cursor-sometimes-moves-to-the-next-line-on-its-own/1035617
- https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841
- https://forum.arduino.cc/t/just-tried-ide2-for-first-time-tab-key-is-a-nightmare/990842
- https://forum.arduino.cc/t/editor-an-unsolvable-problem/989876
- https://forum.arduino.cc/t/autosave-messes-with-cursor-position/1046625
- https://forum.arduino.cc/t/random-line-returns/1081720
- https://forum.arduino.cc/t/arduino-ide-version-2-0-3-has-issues/1088682
- https://forum.arduino.cc/t/ide-2-editor-erratic/1088425
- https://forum.arduino.cc/t/odd-behavior-when-insert-line/1096241
- https://forum.arduino.cc/t/how-to-turn-off-the-auto-indent-feature/1096640
<a name="workaround"></a>
#### Workaround
1. Open the "**Command Palette**" via the <kbd>**Ctrl**</kbd>+<kbd>**Shift**</kbd>+<kbd>**P**</kbd> (<kbd>**Command**</kbd>+<kbd>**Shift**</kbd>+<kbd>**P**</kbd> for macOS users) keyboard shortcut.
1. Select the "**Preferences: Open Settings (UI)**" command.
1. A "**Preferences**" tab will now open in the Arduino IDE main panel. In the "**Search Settings**" field, type `editor.trimAutoWhitespace`
1. Uncheck the checkbox next to the "**`☑` Remove trailing auto inserted whitespace.**" setting.
1. Click the **X** icon on the "**Preferences**" tab.
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [X] My report contains all necessary details
That issue will be closed when the bug is fixed.
Thanks, but there is no need. We are already using the formal bug report I linked above to track the issue.
1 Like
All:
I did what the ptillisch link suggested and my problem is solved. Thanks! Your efforts are sincerely appreciated.
1 Like
system
Closed
August 28, 2023, 1:37pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.