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

Line numbers invisible after Zen Mode toggled off #90240

Closed
10bo opened this issue Feb 7, 2020 · 12 comments · Fixed by #90822
Closed

Line numbers invisible after Zen Mode toggled off #90240

10bo opened this issue Feb 7, 2020 · 12 comments · Fixed by #90822
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug on-release-notes Issue/pull request mentioned in release notes verified Verification succeeded workbench-zen Full screen 'Zen' view issues
Milestone

Comments

@10bo
Copy link

10bo commented Feb 7, 2020

  • VSCode Version: 1.41.1 (user setup)
  • OS Version: Windows_NT x64 10.0.18362

Steps to Reproduce:

  1. Ensure you have at least one file open in editor
  2. Enable Zen Mode
  3. Click on a file in the Source Control tab under the CHANGES sub-heading to open the side-by-side diff
  4. Disable Zen Mode
  5. Click on the tab for the file opened in step 1 & observe the area where line numbers should appear

image

Does this issue occur when all extensions are disabled?: Yes

@vscodebot
Copy link

vscodebot bot commented Feb 7, 2020

@isidorn isidorn added the workbench-zen Full screen 'Zen' view issues label Feb 10, 2020
@isidorn
Copy link
Contributor

isidorn commented Feb 10, 2020

I acknowledge this issue.
The problem is how we reset the line numbers after exiting zen mode
Code pointer

setLineNumbers();

An elegant PR that fixes this is welcome.
We might also look into this in the future.

@isidorn isidorn added the bug Issue identified by VS Code Team member as probable bug label Feb 10, 2020
@isidorn isidorn added this to the Backlog milestone Feb 10, 2020
@jeanp413
Copy link
Contributor

@isidorn I took a look at this and to fix this we need not just the visibleTextEditorWidgets but the non-visible ones too. I looked around and it seems there is no method for this in IEditorService or IEditorGroupsService
There is an array in EditorControl that holds the visible and non-visible editors, would it be fine to expose this variable ?

private controls: BaseEditor[] = [];

@isidorn
Copy link
Contributor

isidorn commented Feb 11, 2020

@jeanp413 thanks for looking into this. That sounds reasonable. However let's check with @bpasero if he wants to expose non visible editors in the editorService or if he has a better suggestion for this.

Alternative would be to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors.

@bpasero
Copy link
Member

bpasero commented Feb 11, 2020

@isidorn IEditorService#editors gives access to all opened editors.

@isidorn
Copy link
Contributor

isidorn commented Feb 11, 2020

Ok thanks. @jeanp413 so that + .getControl() should probably give you all the editorWidgets.

@jeanp413
Copy link
Contributor

IEditorService#editors gives an array of IEditorInput which doesn't have a .getControl() method.
Is there a way to get a BaseEditor from an IEditorInput?

@isidorn
Copy link
Contributor

isidorn commented Feb 12, 2020

I believe the Editor control only exists for the visible editors (thus we create just one editor per Group). To save on resources.
So I believe the correct way to fix this is to remember all the editors that we have hidden line numbers for, and then when bringing them back to go through those editors.

@bpasero can correct me if I am wrong. Thansk

@bpasero
Copy link
Member

bpasero commented Feb 12, 2020

Yes, for performance reasons we only allocate 1 editor control per visible tab, not for each tab that is hidden.

@jeanp413
Copy link
Contributor

I pushed 2 branches with different fixes for this issue

  1. /~https://github.com/jeanp413/vscode/tree/zen-mode-linenumbers-1
    This branch fixes it by using a Set to remember all the editor we have hidden line numbers as isidorn suggested. Not sure if it's safe to call updateOptions on disposed editor widgets (this could happen if we have multiple editor groups and we close any of them)
  2. /~https://github.com/jeanp413/vscode/tree/zen-mode-linenumbers-2
    This branch fixes it by exposing the controls array in EditorControl and updating the IEditorGroup and IEditorService interfaces

@isidorn let me know which approach is preferred to create the corresponding PR

@isidorn
Copy link
Contributor

isidorn commented Feb 17, 2020

@jeanp413 let's go with approach 1. Once you create the PR i can further comment on it. Thanks a lot!

@isidorn
Copy link
Contributor

isidorn commented Feb 18, 2020

Thanks @jeanp413 for fixing this 👏

@mjbvz mjbvz added the verified Verification succeeded label Feb 27, 2020
@isidorn isidorn added the on-release-notes Issue/pull request mentioned in release notes label Feb 28, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug on-release-notes Issue/pull request mentioned in release notes verified Verification succeeded workbench-zen Full screen 'Zen' view issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants