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 trackerI verified the problem still occurs when using the latest nightly buildMy report contains all necessary details
Activity
ubidefeo commentedon Jul 7, 2021
@tomotvos
this is a bug we have experienced but had not made it into the backlog yet, so thank you for reporting it.
It is caused by the Language Server pre-processing which we'll get to in the future to make it less prone to interfere with the user's cursor. After all getting the cursor stolen from you as you type is not something anyone can like 👍🏼
per1234 commentedon Oct 24, 2021
There is a nice screencast demonstrating the bug in the other report we received: #476 (comment)
gdarthy commentedon Nov 7, 2021
It happens everytime you are on new line, then press TAB, cursor jumps back to home position of line, then, when you type anything, it jumps one line below. It's very annoying, I don't understand why this is not fixed yet since it makes working with IDE v2 frustrating. Considering going back to 1.8.
Bug still on IDE 2.0.0-beta.12 on Windows 10
ubidefeo commentedon Nov 7, 2021
@gdarthy this bug is due to a faulty interaction between the editor and the Language Server.
We're rewriting the LS to address a lot of these bugs.
We understand the frustration, it bothers us as much as it bothers you :)
The team is hard at work to release a stable IDE 2.0
Thank you for your comment.
Ubi
MArimont3 commentedon Feb 14, 2022
IDE 2.0 rc3 (Windows 10) : cursor jumps after hitting enter -> jumps to new line, removes spaces before previous line, breaks words, inserts spaces, ...
Very weird behavior.
I am using the IDE since end of dec. Seems to get worse and worse. Becomes nearly unusable...
ubidefeo commentedon Jul 29, 2022
@cmaglie @per1234
can we close this one?
cmaglie commentedon Jul 29, 2022
No, it's still happening with the current nightly:
Version: 2.0.0-rc9-nightly-20220729
Date: 2022-07-29T03:40:20.747Z
CLI Version: 0.25.0 [4fd95834]
25 remaining items