4

I'm wondering if the following behavior of the Eclipse formatter is a bug or not, and if so, if there is any workaround.

After I click return and create a new line, I can see Eclipse has automatically inserted some spaces on the new line, according to the indentation formatting settings. However the cursor remains at position 1. I cannot move the cursor to the end of the line using arrow keys. If I start typing it automatically jumps to the end of the line.

Before creating new line: before creating new line

After (see cursor at position 1 of line 244): shows misplaced cursor at beginning of line

I can reproduce this using the Eclipse formatter profile from here but I think can be reproduced whenever you have tab policy set to spaces only.

Using Eclipse for Mac version

Eclipse IDE for Enterprise Java Developers.

Version: 2019-03 (4.11.0)
Build id: 20190314-1200
Dave L.
  • 9,595
  • 7
  • 43
  • 69
  • I usually don't have problems like this, but then again, I don't mess with eclipse settings. Have you tried changing your tab policy? – Benjamin Urquhart May 02 '19 at 16:14
  • I don't get this problem and I have spaces only. Same Eclipse release and platform. – greg-449 May 02 '19 at 16:56
  • @BenjaminUrquhart AFAIK changing the Tab Policy to tabs or mixed does indeed "fix" the problem (not a solution for my team though since we are set on spaces) – Dave L. May 02 '19 at 17:10
  • Just ignore it then. If the cursor moves to the correct position when you start typing then ignore it. – Benjamin Urquhart May 02 '19 at 17:16
  • 1
    Sounds like you want to disable the "Smart caret positioning at line start and end" on the Text Editors preference page. – nitind May 02 '19 at 21:15
  • @nitind Thanks for the suggestion but it doesn't seem to affect his particular behavior. However that led to me to see the setting `Enter key adjusts the indentation on the new line` -- and I now think this behavior is a bug related to that particular setting. – Dave L. May 03 '19 at 22:05
  • @DaveL. where is that setting? same problem here.. – daigorocub Jul 14 '21 at 10:38

0 Answers0