How do I turn off the unlimited whitespace in IntelliJ editor?

File menu -> Settings -> Editor -> General -> Virtual Space and uncheck 'Allow placement of caret after end of line' . You may also uncheck the other options in the Virtual Space panel.


If the other answers don't seem to be working, you might have Column Selection Mode enabled. On my Mac it's mapped to Cmd+Shift+8. It's located under the Edit menu. That menu item will show a little checkmark when the mode is enabled.


To get the expected behavior where indentations are respected when you click on a line :

In Preferences > Editor > Virtual Space

Check :

Allow placement of caret inside tabs.

Uncheck :

Allow placement of caret after end of line.

This was really annoying to me and makes very little sense as a default behavior to me.