zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.04k stars 2.7k forks source link

Option for cursor beyond EOL (non wrapping cursor) #14297

Open 0x7CFE opened 2 months ago

0x7CFE commented 2 months ago

Check for existing issues

Describe the feature

I'd like to have an editor option that allows moving the cursor caret beyond the line end in a non-wrapping manner.

This behavior was the standard for early editors like DOS TurboC/Pascal, Delphi/CBuilder and even KDevelop/Katepart, but then KDE ditched that option for no good reason.

Being a programmer for ~30 years I am so used to this behavior that the modern wrapping cursor makes me sick. Please consider an option to bring this behavior back :pray:

If applicable, add mockups / screenshots to help present your vision of the feature

Something like this with the exception that when a newline is inserted, cursor should inherit previous line's indentation:

https://github.com/user-attachments/assets/ccadf338-6d2d-4709-808b-57d5ea5a4d0c

notpeter commented 2 months ago

Are there other editors that support this and if so what is this mode/setting called?

Brainstorming:

0x7CFE commented 2 months ago

Are there other editors that support this and if so what is this mode/setting called?

Absolutely. This was the default for old-ish editors in DOS. For a long time it was one of the most noticeable difference between a code editor and a text editor. Delphi still does that to this day. It's called "non-wrapping cursor" (at least that how it was called in KDE) or "cursor beyond EOL", "virtual spaces", etc.

Some relevant discussions regarding the issue:

Long time ago (circa KDE 3.3) it was supported in Katepart, so Kate and KDevelop used that too.

Is it just for navigation? If you start typing with a cursor beyond EOL does it jump back to the EOL or does it insert spaces (tabs?) between EOL and your cursor?

IIRC it act as if there are (virtual) spaces in between. You can navigate between actual EOL and virtual one using End key much like this happens with Home and first non-whitespace character.

Can you click your cursor anywhere with the mouse too?

Yes, you can. Check this video where the guy used his mouse to move the cursor beyond EOL.

How do selections work? What happens if you press shift-left while out beyond the EOL. Can you select the empty area?

I believe virtual spaces remain virtual unless user types something, so they would not be selected.