When i'm typing indented code and press Return, I want the cursor to jump to the same indent on the next line. IDE 2.0 does this but if I don't start typing immediately, one second later the cursor jumps to the left of the page. It never happened, V1 of the IDE, but it started happening a few months ago when I began trialling the V2 betas. I installed 2.0.0 today and it's still happening. Is there a fix?
Not doing it here
What is your OS and version of the IDE ?
Thanks for the reply. I'm on Windows 10 21H2 and IDE 2.0.0 This issue has existed on all the version 2 betas that I have tried. IDE 1 was fine.
Hi @hoofhearted. This bug is being tracked by the Arduino developers here:
There is no true fix at this time, but there is a simple workaround. I'll provide instructions:
- Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
- Select the "Preferences: Open Settings (UI)" command from the menu.
- A "Preferences" tab will now open in the Arduino IDE. In the "Search Settings" field of that tab, type
editor.trimAutoWhitespace
- Uncheck the checkbox next to "
☑
Remove trailing auto inserted whitespace." - Click the X icon on the "Preferences" tab.
The reason this is considered a workaround rather than a true fix is that the "Remove trailing auto inserted whitespace" is generally a convenient feature. However, I think it is an effective workaround because you are trading the loss of a minor convenience feature in exchange for avoiding a bug that seriously harms the usability of the IDE. The Tools > Auto Format will take care of removing the trailing whitespace anyway.
Why is it that the problem only affects some installations ? I have never had the problem, can't reproduce it and have never to my knowledge done anything to prevent it happening
It is a good question. The answer would likely be very useful for finding the cause and the solution.
I am affected on my Linux machine, but not on my Windows machine. But we have reports from Windows and macOS users also so it is not OS-specific. It is quite annoying if you have the default of Auto Save enabled, so if a large portion of the users were affected then we would definitely be hearing about it.
@ptillisch Thanks for the reply. I tried to implement your workaround. Unfortunately In my version 2.0.0 I don't have the editor.trimAutoWhitespace in my list of settings.
editor.trimAutoWhitespace
is the ID of the setting. I instructed you to search for that ID in order to avoid having multiple search results which would make it more difficult to find the setting. You won't see editor.trimAutoWhitespace
in the UI. Instead you will see the human friendly name of the setting:
Editor: Trim Auto Whitespace
☑
Remove trailing auto inserted whitespace.
Please try following the instructions again to make sure you didn't miss the setting. It should look like this:
If you still don't find it, please provide a screenshot of how the IDE looks for you. I might be able to identify the problem by looking at that screenshot.
You can make a screenshot by pressing Alt+Print Screen on your keyboard, which will copy the screenshot to your clipboard. You are also welcome to screenshot by any other procedure you prefer.
You can then add the screenshot to a reply here by doing any one of the following:
- Press Ctrl+V to paste the screenshot from the clipboard.
- Save the screenshot as an image and then drag and drop it into a forum reply.
- Save the screenshot as an image, click the upload button (
) in the post composer toolbar, and then select the image file.
Thanks for the reply again. I found that setting, and your workaround does the job. My cursor is stable now. Thanks for your help.
You are welcome. I'm glad it is working for you now.
Regards,
Per
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.