Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.4k stars 167 forks source link

Auto trim space-only lines that were created with indentation #5426

Closed Alexey-T closed 3 months ago

Alexey-T commented 3 months ago

from @pintassilgo in #5425

Sublime is smart to auto trim empty lines that were created with indentation. Example:

function b() {
  let a = 1;|
}

I press Enter twice to create an empty line, then start typing more code:

function b() {
  let a = 1;

  if|
}

At this point, the empty line above if already had its spaces/tabs trimmed by Sublime and it's really empty. In Cuda, the same line is still indented with useless spaces, made visible in the example below by me by replacing them with .

function b() {
  let a = 1;
██
  if|
}

The case in this comment is probably applicable to almost all languages, like HTML.

Alexey-T commented 3 months ago

@pintassilgo beta at http://uvviewsoft.com/c/ let's test the fix. it is for all lexers. I dont see disadvantage. so did not add an option.

pintassilgo commented 3 months ago

It's working, thanks!