draft-js-code icon indicating copy to clipboard operation
draft-js-code copied to clipboard

Shift-Tab for removing indentation

Open newsiberian opened this issue 6 years ago • 4 comments

Hi, added shift-tab binding for removing indentation

newsiberian avatar Dec 07 '17 02:12 newsiberian

Coverage Status

Coverage decreased (-1.4%) to 97.826% when pulling 80e3af7466fc894d3ced32a9a9548742b36d8e63 on newsiberian:remove-intentation-shift-tab into c219dc50d42f7db9c69b4b8c9be4b437116e8e6a on SamyPesse:master.

coveralls avatar Dec 07 '17 02:12 coveralls

Yesss! I'll review all of your PRs later today, thank you for contributing!

mxstbr avatar Dec 07 '17 07:12 mxstbr

Hi, here we should some extra work. I've checked again WebStorm behaviour on shift+Tab and backspace and their are differ. If you press backspace with cursor:

  • before first word with any number of indentation and no code on previous line, its return to the line beginning
  • before first word with +1(+0) number of indentation to indentation of previous line, its move to the end of previous line (it depends on context of code. It looks at object { }, or at
something
  .method()

or could be

  var a;
  var b;
  • before first word with >1 number of indentation to indentation of previous line, it return to place of indentation of previous line + 1 indentation
  • in any place within line - it acts like a normal backspace

If you press shift+Tab with cursor:

  • its never returns to previous line
  • before first word with with any number of indentation, it remove one indentation
  • in any place within line - it's again remove one indentation if presents
  • with selection it move all line from any position of cursor to one indentation

I want to try to repeat this. What do you think?

newsiberian avatar Dec 08 '17 06:12 newsiberian

You could try, but I don't know if it's worth going through all of that complexity/if it's possible. If it's not a lot of code though and/or you think you can make it happen, please go for it!

mxstbr avatar Dec 08 '17 08:12 mxstbr