ChatGPT解决这个技术问题 Extra ChatGPT

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

How do I remove the ability to move the cursor after the end of line in IntelliJ?

It's funny - I want exactly the opposite for Eclipse, to enable virtual space. But I see it's currently an unresolved bug (21000).
Go here to vote for "unlimited whitespace" to be turned off as the default: youtrack.jetbrains.com/issue/IDEABKL-6478
Guys, could you provide more information on why that virtual space is inconvenient for you?
@denis.zhdanov I want to be able to press right-arrow and get to the beginning of the next line from the end of the current, or click arbitrarily to the right of a line and have the cursor end up exactly on the end of the line. I seldom want to put the cursor an arbitrary distance beyond the end of existing text and have the editor insert a bunch of whitespace for me when I start typing. I understand some people might prefer being able to do that, but for me I'd rather have it work as I'm used to every other text editor working. It's great that it's configurable, everyone's happy.
Intellj 13 has changed the default for this to be off.

M
Matt_Bro

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.


As a side effect, this lets me use the right arrow key to move the cursor from the end of a line to the beginning of the next line. Exactly what I wanted.
it's strange they have a default that everybody would want to turn off.
In IntelliJ 11.1 (OS X), its Preferences > Editor > "Allow placement of caret at end of line"
I like that "intellij disable click anywhere" is the first search suggestion when you type "intellij disable" in google.
Did this break with the last (15.0.1) update? I've never noticed this before, the mentioned setting is off, but the cursor still places after the end of line.
n
naXa stands with Ukraine

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.


For me this option was the issue. I used the shortcut Shift+Cmd+A, typed in Column Selection Mode and turned it off.
Sweet, I think I accidentally turned this on while creating a scratch file. My hotkeys were Shift+Alt+Insert. For anyone one else looking for it, just open the settings and search for Column Selection Mode and it'll bring up its hotkey. As another note, I am on Intellij 15 using Centos 7.
This helped! Must have hit it by accident. Any other suggested solution didn't change anything.
This worked for me too, but I had to manually uncheck it from the menu with the mouse -- the shortcut is correct but didn't seem to work :/
E
Emil Davtyan

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.


This is a weird setting. I use spaces instead of tabs, but it works as expected. The setting should probably read Allow placement of caret inside indents.
C
Carl Manaster

Note that for Intellij IDEA 11 for mac, settings are placed under the IntelliJ IDEA menu and called preferences. (Maybe some sort of mac default ?)


You can always searching "caret" to find the setting you want.
c
cognalog

What Matt_Bro said (first answer), but if you've already got the box unchecked in preferences, try re-checking it (I checked all the virtual space boxes) and restarting. Then uncheck and hit apply--at this point unlimited space was disabled for me.


i also had to close and re-open the file i was editing.
R
ROMANIA_engineer

IntelliJ IDEA 2016

By default, it's turned off (unchecked).

If it is turned on, you can use one of the following 2 approaches:

File > Settings... (or Ctrl+Alt+S) > Editor > General > Virtual Space section > uncheck Allow placement of caret after end of line Help > Find Action... (or Ctrl+Shift+A) > type "Virtual Space: Allow end" > Enter or left click (to switch between On and Off) > Esc