Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitting tab at beginning of content on line doesn't move it to correct indent level #12408

Open
core-ai-bot opened this issue Aug 31, 2021 · 6 comments

Comments

@core-ai-bot
Copy link
Member

Issue by njx
Tuesday Oct 22, 2013 at 22:58 GMT
Originally opened as adobe/brackets#5633


Found this while working on #5068.

  1. Find a line in a JS file that's (correctly) indented 4 levels
  2. Delete two indent levels
  3. Click in the whitespace before the content of the line (e.g. after the first indent level) and hit Tab - this re-indents the line all the way to 4 levels and puts the cursor at the beginning of the content, which is what you would expect
  4. Repeat steps 1 and 2
  5. Click immediately before the content of the line and hit Tab

Result: The content only indents one level. I would expect it to indent to the correct level in this case as well.

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Oct 22, 2013 at 22:59 GMT


The issue is that if we're immediately before the content, we don't try to do CodeMirror's smart autoindent. This is because, if the user wants to indent further past CodeMirror's indent level, we don't want to back-indent to the "correct" level. However, it seems like the right heuristic would be: if the user is already at or after CodeMirror's desired indent level, we should just insert a tab. The problem is we can't determine what the "correct" indent level is without just running CodeMirror's indentation algorithm, so there isn't an easy hack for this.

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Oct 22, 2013 at 23:00 GMT


Note that we should take the fix for #5068 (codemirror/codemirror5#1905 plus nj/issue-5608) before working on this, so we should move this to sprint 34 once that milestone is available.

@core-ai-bot
Copy link
Member Author

Comment by njx
Tuesday Oct 22, 2013 at 23:00 GMT


To me, medium priority.

@core-ai-bot
Copy link
Member Author

Comment by njx
Saturday Mar 15, 2014 at 00:03 GMT


Nominating for 1.0.

@core-ai-bot
Copy link
Member Author

Comment by njx
Monday Apr 14, 2014 at 20:17 GMT


Removing from 1.0 - it works correctly in a fair number of cases and this is an edge case.

@core-ai-bot
Copy link
Member Author

Comment by njx
Saturday Jul 12, 2014 at 03:12 GMT


Assigning to@redmunds since he's looked at this area before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant