brackets-emmet icon indicating copy to clipboard operation
brackets-emmet copied to clipboard

New line indentation off by one space or tab

Open timseverien opened this issue 9 years ago • 15 comments

Bug

To reproduce

  • Take any document
  • Create an element with one or more children
  • Set cursor at the end of parent element
  • Press [enter] to create a new line
  • See how the indentation is short exactly one space (or tab)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

timseverien avatar Sep 17 '14 08:09 timseverien

+1

nunoarruda avatar Oct 08 '14 00:10 nunoarruda

Did either of you find anything to stop/fix this?

equinox avatar Jan 26 '15 06:01 equinox

For curiosity tried to debug the problem and found it's source:

At line 49 from brackets-emmet/node_modules/emmet/lib/action/linebreaks.js file the function insertLineBreakAction() has a loop that counts the line padding for the new indented line:

for (var i = lineRange.end + 1, ch; i < len; i++) {
    ch = content.charAt(i);
    if (ch == ' ' || ch == '\t')
        nextPadding += ch;
    else
        break;
}

Adding 1 to the "i" makes it jump a character over. This makes the auto indent be missed by a space or tab.

This is bug comes from the emmet core library itself. To solve it just remove the "+ 1" from the for loop assignment.

I'm not fixing it because i'm new to github and don't know well how to use it yet... :confused:

Miguel-Rodrigues avatar Feb 02 '15 22:02 Miguel-Rodrigues

+1

jeffshaver avatar Feb 10 '15 14:02 jeffshaver

+1

lixiaoyan avatar May 07 '15 12:05 lixiaoyan

+1 I'm having this issue still. Place cursor at end of line that is an open div with a class name set. press enter, it will only indent 3 spaces. Press up, end, enter and it will indent 2. Repeat and it will indent 1. Then again and it will indent 0. Needs fixed!

alancolyer avatar Oct 14 '15 09:10 alancolyer

Still having this issue... :/

nunoarruda avatar Feb 09 '16 09:02 nunoarruda

+1 Same here.

Stan-Stani avatar Feb 20 '16 16:02 Stan-Stani

+1...

lucgauer avatar Mar 04 '16 20:03 lucgauer

same here, still having this issue.

shamsfk avatar Jun 03 '16 07:06 shamsfk

I'm still having this issue with the newest bracket

robertwt7 avatar Mar 17 '17 00:03 robertwt7

Not sure if it's still a thing but I also have this issue here

ngustavo avatar Apr 16 '17 00:04 ngustavo

screenshot It seems that ^1.3.0 is not enough. Maybe ^1.6.2 or latest would do?

ngustavo avatar Apr 16 '17 00:04 ngustavo

Same problem here. And it's years after the problem began. Is there any chance at all to get a fix for this?

retan avatar Feb 20 '18 08:02 retan

I’m working on new Emmet version that should fix this issue. Stay tuned!

sergeche avatar Feb 20 '18 08:02 sergeche