zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.4k stars 1.16k forks source link

Feature request: option to not insert empty line when wrapping line that exactly hits limit #3235

Open Tachytaenius opened 2 months ago

Tachytaenius commented 2 months ago

With word wrap on, if a line has the exact minimum length to be wrapped, an empty line is displayed between it and the next line in the file (which isn't what modern GUI editors tend to do). My suggestion is for an option to disable this behaviour so that the line that has the exact minimum length is not wrapped.

Empty lines being displayed where they shouldn't be breaks structure and grouping made with empty lines. Worse when writing prose in the style of a book (intended paragraphs with only one line break between them, not two).

I tried to edit a clone of micro to do this, but nothing I tried actually removed said blank lines. If it's not a change that fits in micro then some direction on how to do it, plugin or source edit, would be appreciated!

dmaluka commented 2 months ago

But where will we display the cursor at the end of this line?

which isn't what modern GUI editors tend to do

That's because they are GUI editors, so they usually display the cursor as a thin vertical line "between" characters. Micro is a terminal editor, and terminals usually display the cursor as a thick bar occupying the entire character, and micro has no control over that. So if we want both the line itself and the cursor at the end of it to be visible, and the line itself occupies the entire window width, there is no room for the cursor in that line, so we need an empty line below it, to display the cursor there.

Tachytaenius commented 2 months ago

Setting the word wrap limit to be one to the left so that there is a vertical strip for the cursor to sit in would be an acceptable compromise IMHO.

RealAprilF00lz commented 1 week ago

Agreed

RealAprilF00lz commented 6 days ago

Seems to have happened to me without wordwrap just now, 2.0.13

Tachytaenius commented 2 days ago

I... actually can't figure out how to implement any solution. I just don't know this codebase. Definitely needing help here. Is there some kind of Lua solution?