-
Notifications
You must be signed in to change notification settings - Fork 7
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
DistractionFreeWindow not preserved on opening new file/tab #26
Comments
After some more digging, it seems like this issue arises from how we alter the settings related to rulers, line numbers, gutters, and centered text. I examined the source code of this addon and also tried recreating this addon's functionality using key bindings/macros. It works, but has the same issue as described above. The settings that "stick" when opening a new file/tab are the ones that have "native" commands written into Sublime:
For the other commands that need to be set with By the way - thank you for writing this addon, I love it! I was looking for something like goyo.vim for Sublime and this is as close as it gets. Pending a fix for this issue, I'm just double-tapping the hotkey for DFW mode (remapped to an easier-to-reach |
@telarmago Does the minimal setup code posted in #22 work for you? If so I’ll go ahead and work on the suggested changes there and see if I can fix it for ST2 too. |
@jrappen Thank you for the response and suggestion! I tried your minimal setup code for distraction_free_window.py, but the same issue persists. I believe it arises due to the way we set values for this section of the code: for v in w.views():
v.settings().set('draw_centered', distraction_free.get('draw_centered', True))
v.settings().set('draw_indent_guides', distraction_free.get('draw_indent_guides', True))
v.settings().set('draw_white_space', distraction_free.get('draw_white_space', 'selection'))
v.settings().set('fold_buttons', distraction_free.get('fold_buttons', True))
v.settings().set('gutter', distraction_free.get('gutter', False))
v.settings().set('line_numbers', distraction_free.get('line_numbers', False))
v.settings().set('rulers', distraction_free.get('rulers', []))
v.settings().set('scroll_past_end', distraction_free.get('scroll_past_end', True))
v.settings().set('word_wrap', distraction_free.get('word_wrap', True))
v.settings().set('wrap_width', distraction_free.get('wrap_width', 80)) This loops through all the open windows and applies settings. However, if we open a new file/tab/window, these specific settings shown above in the code snippet are not applied. That is, only this section: w.set_sidebar_visible(False)
w.set_tabs_visible(False)
w.set_minimap_visible(False)
# w.set_status_bar_visible(False) is applied "universally" across all tabs and windows, present and future. Ideal behavior:
Currently, step 3 only applies the settings in the second code block. I have to hit the keyboard shortcut twice (turn off and then turn on DistractionFreeWindow mode) to get my second file to enter DistractionFreeWindow mode. This is because the function looped through the open windows at the time the keybind was pressed, at which point only the first file was open. |
I'll take a stab at this tonight after work. Thanks for the detailed input. |
Sorry for the delay, got a call to take care of a friend in hospital that day... then forgot this pending issue. Anyhow, I'll take a look at the core code now to see how Jon did it there. |
No problem! I hope all is well. I appreciate you looking into this. |
Core code for distraction free mode is not in the readable python files. Pasting some links for future reference: |
It seems whether a window is in normal mode or distraction-free mode is stored in the session file. Maybe we can work with that? |
Now the distraction free mode gets saved between sessions, between projects and even after switching windows. Should fix issue aziz#26.
DistractionFreeWindow not preserved on opening new file/tab
Summary
While in 'DistractionFreeWindow mode', if I open a new file/tab, the status bar is hidden but no other elements are hidden.
Expected behavior
I would expect a new file/tab to open in 'DistractionFreeWindow mode' as well, with all settings preserved. For example, if I have the ruler hidden then I shouldn't see the ruler in a new file/tab.
Actual behavior
The file opens with only some DistractionFreeWindow settings applied. I have not tested this exhaustively, but settings that are not properly applied include:
I have these settings set to "true" in my user preferences for DistractionFreeWindow. Only hiding the tab bar and the status bar appear to work properly when I open a new file/tab.
Steps to reproduce
See the .gif below for reference (also at https://imgur.com/a/gm2ZI)
In it, I start with a file open and I hit fn+cmd+f11 to enter 'DistractionFreeWindow mode'. Then, I open a second file. I ctrl-tab back and forth a few times to show the difference. Lastly, I hit fn+cmd+f11 to exit 'DistractionFreeWindow mode'.
Environment
The text was updated successfully, but these errors were encountered: