# Cursor jumps to left of page

**URL:** <https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841>\
**Category:** IDE 2.x\
**Created:** [September 20, 2022, 6:37pm UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841 "2022-09-20T18:37:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoofhearted](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@hoofhearted](https://forum.arduino.cc/u/hoofhearted)\
**Post date:** [September 20, 2022, 6:37pm UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/1 "2022-09-20T18:37:26Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [September 20, 2022, 7:40pm UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/2 "2022-09-20T19:40:11Z")

</div>

Not doing it here

What is your OS and version of the IDE ?

---

<div class="post-metadata">

**Author:** ![hoofhearted](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@hoofhearted](https://forum.arduino.cc/u/hoofhearted)\
**Post date:** [September 20, 2022, 8:00pm UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/3 "2022-09-20T20:00:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [September 21, 2022, 12:51am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/4 "2022-09-21T00:51:06Z")

</div>

Hi @hoofhearted. This bug is being tracked by the Arduino developers here:

> <https://github.com/arduino/arduino-ide/issues/437>
>
> \### 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
> 
> \### 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

There is no true fix at this time, but there is a simple workaround. I'll provide instructions:

1. Press the **Ctrl** + **Shift** + **P** keyboard shortcut ( **Command** + **Shift** + **P** for macOS users) to open the " **Command Palette**".
2. Select the "**Preferences: Open Settings (UI)**" command from the menu.
3. A " **Preferences**" tab will now open in the Arduino IDE. In the " **Search Settings**" field of that tab, type `editor.trimAutoWhitespace`
4. Uncheck the checkbox next to " **`☑` Remove trailing auto inserted whitespace.**"
5. 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.

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [September 21, 2022, 6:23am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/5 "2022-09-21T06:23:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [September 21, 2022, 6:35am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/6 "2022-09-21T06:35:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hoofhearted](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@hoofhearted](https://forum.arduino.cc/u/hoofhearted)\
**Post date:** [September 21, 2022, 6:50am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/7 "2022-09-21T06:50:13Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [September 21, 2022, 7:21am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/8 "2022-09-21T07:21:20Z")

</div>

`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:

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/d/1/2/d120d038f3a5ef424afba63aadef4eac22685611.png)

If you still don't find it, please provide a [screenshot](https://www.techradar.com/how-to/how-to-screenshot-on-a-pc) 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](https://lifehacker.com/how-to-copy-cut-and-paste-for-beginners-5801525) 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 ( ![image](https://europe1.discourse-cdn.com/arduino/original/4X/c/0/0/c0067471d5eb440267189d84a0c94cfed541a968.png)) in the post composer toolbar, and then select the image file.  
 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/a/6/d/a6d1af1c1d2fb0c3bc793e969eb5e04aa7dae6f7.png)

---

<div class="post-metadata">

**Author:** ![hoofhearted](https://avatars.discourse-cdn.com/v4/letter/h/58f4c7/32.png) [@hoofhearted](https://forum.arduino.cc/u/hoofhearted)\
**Post date:** [September 21, 2022, 7:52am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/9 "2022-09-21T07:52:43Z")

</div>

Thanks for the reply again. I found that setting, and your workaround does the job. My cursor is stable now. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [September 21, 2022, 7:59am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/10 "2022-09-21T07:59:27Z")

</div>

You are welcome. I'm glad it is working for you now.

Regards,  
Per

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [March 20, 2023, 7:59am UTC](https://forum.arduino.cc/t/cursor-jumps-to-left-of-page/1033841/11 "2023-03-20T07:59:53Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
