When I click enter on indented lines, the cursor goes to the left most position (no tabs). And then when I start typing, the required amount of tabs is added to the end of whatever I was typing and the down key is automatically pressed.
I did not have this problem with 2.0.0 and I'm fairly sure I didn't have it with 2.0.2
My computer runs Windows 8.1 Pro
I also don't have this problem using VS Code
Hi @lasso_water . It sounds like you are experiencing this bug:
opened 09:50AM - 06 Jul 21 UTC
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
<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 `files.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
I'll provide instructions for the simple workaround that was discovered by an Arduino forum member :
Open the "Command Palette " via the Ctrl +Shift +P (Command +Shift +P for macOS users) keyboard shortcut.
Select the "Preferences: Open Settings (UI) " command.
A "Preferences " tab will now open in the Arduino IDE main panel. In the "Search Settings " field, type editor.trimAutoWhitespace
Uncheck the checkbox next to the "☑
Remove trailing auto inserted whitespace. " setting.
Click the X icon on the "Preferences " tab.
Please let me know if you have any questions or problems while following those instructions.
1 Like
You are welcome. I'm glad it is working now.
About this:
The bug does not affect all users universally. For example, I experience it on one of my computers but not on another one. The bug was reported before the Arduino IDE 2.0.0 release, so I don't think it is a matter of a regression introduced in Arduino IDE 2.0.3, but rather that the bug only occurs under some unknown system conditions (e.g., it might be very timing sensitive), It might be that something changed in the environment the IDE runs on in your computer, or perhaps an unrelated change in 2.0.3 resulted in the required conditions for the bug now being present. It is very mysterious. Hopefully the developers will find a fix soon, but at least we have a workaround to allow us to carry on until then.
1 Like
system
Closed
June 20, 2023, 2:49pm
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.