mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Reset font size if editor.fontSize is changed from anywhere
This commit is contained in:
parent
12b59cf610
commit
2bd7cc9a99
@ -428,7 +428,7 @@ describe "Workspace", ->
|
||||
|
||||
describe "::resetFontSize()", ->
|
||||
it "resets the font size to the window's starting font size", ->
|
||||
originalFontSize = 6
|
||||
originalFontSize = atom.config.get('editor.fontSize')
|
||||
|
||||
atom.config.set('editor.fontSize', originalFontSize)
|
||||
workspace.increaseFontSize()
|
||||
@ -441,12 +441,22 @@ describe "Workspace", ->
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
|
||||
it "does nothing if the font size has not been changed", ->
|
||||
originalFontSize = 6
|
||||
originalFontSize = atom.config.get('editor.fontSize')
|
||||
|
||||
atom.config.set('editor.fontSize', originalFontSize)
|
||||
workspace.resetFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
|
||||
it "resets the font size when the editor's font size changes", ->
|
||||
originalFontSize = atom.config.get('editor.fontSize')
|
||||
|
||||
atom.config.set('editor.fontSize', originalFontSize + 1)
|
||||
workspace.resetFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
atom.config.set('editor.fontSize', originalFontSize - 1)
|
||||
workspace.resetFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
|
||||
describe "::openLicense()", ->
|
||||
it "opens the license as plain-text in a buffer", ->
|
||||
waitsForPromise -> workspace.openLicense()
|
||||
|
@ -75,6 +75,8 @@ class Workspace extends Model
|
||||
atom.views.addViewProvider Panel, (model) ->
|
||||
new PanelElement().initialize(model)
|
||||
|
||||
@subscribeToFontSize()
|
||||
|
||||
# Called by the Serializable mixin during deserialization
|
||||
deserializeParams: (params) ->
|
||||
for packageName in params.packagesWithActiveGrammars ? []
|
||||
@ -612,12 +614,10 @@ class Workspace extends Model
|
||||
|
||||
# Increase the editor font size by 1px.
|
||||
increaseFontSize: ->
|
||||
@originalFontSize ?= atom.config.get("editor.fontSize")
|
||||
atom.config.set("editor.fontSize", atom.config.get("editor.fontSize") + 1)
|
||||
|
||||
# Decrease the editor font size by 1px.
|
||||
decreaseFontSize: ->
|
||||
@originalFontSize ?= atom.config.get("editor.fontSize")
|
||||
fontSize = atom.config.get("editor.fontSize")
|
||||
atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1
|
||||
|
||||
@ -626,6 +626,10 @@ class Workspace extends Model
|
||||
if @originalFontSize
|
||||
atom.config.set("editor.fontSize", @originalFontSize)
|
||||
|
||||
subscribeToFontSize: ->
|
||||
atom.config.onDidChange 'editor.fontSize', ({newValue, oldValue}) =>
|
||||
@originalFontSize ?= oldValue
|
||||
|
||||
# Removes the item's uri from the list of potential items to reopen.
|
||||
itemOpened: (item) ->
|
||||
if typeof item.getURI is 'function'
|
||||
|
Loading…
Reference in New Issue
Block a user