Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

[cmv4] Fix case of hitting Tab at the beginning of a whitespace-only line #7167

Merged
merged 1 commit into from
Mar 12, 2014

Conversation

njx
Copy link

@njx njx commented Mar 11, 2014

Update to fix for #7022 to deal with a regression that the previous fix introduced. If you hit tab at the beginning of a whitespace-only line, we used to autoindent to the right level. Now we just insert another indent. This brings back the original behavior (and adds unit tests for it).

Note that the ideal fix here would be to do autoindent when you're anywhere in a whitespace-only line if the amount of whitespace is less than or equal to the correct indent level. However, this isn't easy for us to fix because we can't easily tell in advance what the right indent level is, so we don't know if you're before it or past it (and if you're past it, we don't want to autoindent on Tab, since that would actually outdent; we want to just add another indent in that case). So, the prior behavior (which this reinstates) is to only do the autoindent if the cursor is at the left edge of the line to begin with.

That same issue prevents us from autoindenting when you're immediately before the first non-whitespace character in the line. I'll file a bug to address these cases in the future.

@njx
Copy link
Author

njx commented Mar 11, 2014

To @redmunds

@redmunds
Copy link
Contributor

Merging.

redmunds added a commit that referenced this pull request Mar 12, 2014
[cmv4] Fix case of hitting Tab at the beginning of a whitespace-only line
@redmunds redmunds merged commit 6a18975 into cmv4 Mar 12, 2014
@redmunds redmunds deleted the nj/cmv4-tab-empty-line branch March 12, 2014 00:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants