Closed
Description
Describe the problem
While editing, the cursor sometimes randomly jumps to the beginning of a new line
To reproduce
- Edit sketch
- Usually when typing a new line, cursor will jump to beginning of next line
- 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
- Cursor jumps to first column of new line after a delay #1669
- Linux Mint. IDE auto-inserts spurious carriage returns, backspaces, and tabs #1534
- Annoying auto text formatting issues. Magical text cursor #1364
- Cursor jumping after press return #476
- Serial Monitor with Teensy T4.x (probably others) does not receive input #810 (comment)
- 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
Workaround
- 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.
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details