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

Auto-indent doesn't scroll editor #8723

Closed
JeffryBooher opened this issue Aug 11, 2014 · 9 comments
Closed

Auto-indent doesn't scroll editor #8723

JeffryBooher opened this issue Aug 11, 2014 · 9 comments

Comments

@JeffryBooher
Copy link
Contributor

When auto-indentation out-dents, the editor doesn't scroll to the cursor position after the out-dent.

  1. open DocumentCommandHandlers-test.js
  2. Turn off word-wrap
  3. Go to line 940
  4. Click on line 942
  5. Scroll the editor so that "expect" on line 942 is at the edge of the left gutter
  6. Make brackets narrow so that the end of line 942 is on the edge of the vertical scrollbar
  7. Click on line 940
  8. Go to the end of the line and hit enter
  9. indentation puts cursor above "expect"
  10. Type }
  11. Curly brace moves out of view as does the cursor
@JeffryBooher JeffryBooher added this to the Brackets 1.0 milestone Aug 11, 2014
@JeffryBooher
Copy link
Contributor Author

Probably a 1.0. Seems related to #1324

@JeffryBooher
Copy link
Contributor Author

BTW: Following these steps and undo twice after step 11 hangs in 0.42 but not in master. So the code mirror fix at a183fa6bb190d6bacb287c3efe5da078b7b5bc74 fixes that too which we'll want to keep an eye on since that is an interim solution

@peterflynn
Copy link
Member

@JeffryBooher Can you repro the same issue in vanilla CodeMirror? (e.g. codemirror.net/mode/javascript/). If so, could you file a bug on CM & add the Tracking label here?

I don't think #1324 is related: it doesn't have to do with scrolling; it's related to the actual indent level in the text being incorrect, and is very specific to switch statements...

@JeffryBooher
Copy link
Contributor Author

@peterflynn UTR in vanilla code mirror. When enter is pressed the indentation doesn't go above above "expect" but that's because the vanilla codemirror tab stops are set at 2 characters instead of 4. Still, it scrolls to reveal the next un-indented code tab stop as well not just where the cursor is.

Smart Indentation Maybe?

@peterflynn
Copy link
Member

The thing that causes the back-indent when you type } is our Editor._checkElectricChars() code... which did change recently. But it's just calling simple CM APIs (setCursor() & indentLine(), which seem like they should ensure the cursor is in view automatically).

@JeffryBooher
Copy link
Contributor Author

It may be a change recently. It reproduces with 0.42 and with current Master

@marcelgerber
Copy link
Contributor

@peterflynn It's not caused by a recent change. I can repro it back in Sprint 39.

@redmunds redmunds removed this from the Brackets 1.0 milestone Aug 13, 2014
@redmunds
Copy link
Contributor

Reviewed. Removing Brackets 1.0 Milestone.

@prafulVaishnav
Copy link
Contributor

Fixed by PR #9387

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

No branches or pull requests

5 participants