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

[CLOSED] When autoindenting, only insert a tab if the cursor doesn't move due to CodeMirror's indentation #5326

Open
core-ai-bot opened this issue Aug 30, 2021 · 5 comments

Comments

@core-ai-bot
Copy link
Member

Issue by njx
Friday Nov 01, 2013 at 20:43 GMT
Originally opened as adobe/brackets#5815


For #5068. This should get rid of the most common case where you can accidentally get extra whitespace at the end of a line.

Note that there's one minor issue remaining with this behavior: if a line is already at the right indent level, you click in the whitespace at the beginning, and you hit TAB, the indentation doesn't change and the cursor moves to the beginning of the text (which is correct), but the file gets marked dirty. I have a comment out to Marijn on this. I don't think it's a showstopper.


njx included the following code: https://github.com/adobe/brackets/pull/5815/commits

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Nov 01, 2013 at 20:44 GMT


@redmunds would you mind reviewing this since you filed the original bug? Thanks.

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Nov 01, 2013 at 20:48 GMT


Also, note that there's one bit of behavior that isn't changed here: if the cursor is right at the beginning of the text in a line, and it's not already at the right indentation, it just inserts a tab instead of pushing to the correct indentation. This is because it's not easy for us to distinguish between that case and the case where it's already at the right indentation (in which case you do just want to tab over)--we would need to know how much CM expects the line to be indented. I think that's fine for now since we've still improved the behavior overall.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Sunday Nov 03, 2013 at 01:11 GMT


Looks good. Merging.

Is this also for adobe/brackets#5633 ?

@core-ai-bot
Copy link
Member Author

Comment by njx
Sunday Nov 03, 2013 at 02:37 GMT


No, that issue is the one I mentioned in my last comment above that isn't addressed by this pull.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Sunday Nov 03, 2013 at 16:35 GMT


@njx The reason I asked is because this change (and possibly CodeMirror update) improves it, so be sure to re-test before you start trying to fix it.

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