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

Working set selection is wrong if sidebar hidden at launch #3637

Closed
peterflynn opened this issue Apr 26, 2013 · 6 comments
Closed

Working set selection is wrong if sidebar hidden at launch #3637

peterflynn opened this issue Apr 26, 2013 · 6 comments
Assignees
Milestone

Comments

@peterflynn
Copy link
Member

  1. Put a few files in the working set -- let's say A, B, C
  2. Select some file that's not the topmost one (e.g. file C)
  3. Hide the sidebar
  4. Relaunch Brackets
  5. Show the sidebar

Note: there are several ways to hide/show the sidebar:
a. View > Hide Sidebar (View > Show Sidebar)
b. Cmd/Ctrl-Shift-H
c. Drag close/open
d. Double-click on drag bar to toggle

Result: file C is open in the editor but file A is selected in the working set

Expected: file C selected

@peterflynn
Copy link
Member Author

This repros in Sprint 23 too, so not a result of the recent sidebar redesign

@jeffslofish
Copy link
Contributor

I made a fix for this, but the fix I made has the side-effect of causing the sidebar to always open at launch, with the correct file selected in the working set, of course. Basically what I did was to save the current document to preferences when it changes and then when DocumentManager is loaded, it reads the prefs to initialize the _currentDocument with the document stored in prefs.

Is it okay, or even desired, that the sidebar is always open at launch, or should I rework my code to keep the sidebar hidden if it was hidden at close?

@peterflynn
Copy link
Member Author

@jeffslofish I'm a little confused -- DocumentManager already does what you describe. See _savePreferences(), and _projectOpen()'s call to FILE_OPEN. I suspect what you're calling a side effect is the actual fix -- if the sidebar DOM nodes are visible, then the working set selection is initialized properly. If the sidebar DOM nodes are hidden, then it isn't. The best fix is probably to either:
(a) make the sidebar correctly update its state when hidden (it shouldn't need anything like offsetHeight that's unavailable while display:none, so I'm not sure why it doesn't work currently); or
(b) make the sidebar refresh its selection state whenever it goes from hidden to visible

@ghost ghost assigned peterflynn May 3, 2013
@pthiess
Copy link
Contributor

pthiess commented May 3, 2013

Reviewed @peterflynn - Peter since @jeffslofish started working on this please consider to be a reviewer to support this along.

@redmunds
Copy link
Contributor

redmunds commented May 9, 2013

Added list of ways to show/hide sidebar.

@peterflynn
Copy link
Member Author

Confirmed fixed. Sorry for the delay, I missed that the fix landed and this wasn't set to FBNC yet.

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

4 participants