mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Merge pull request #6539 from atom/mq-reset-font
Reset font size to window's starting font size
This commit is contained in:
@@ -426,6 +426,35 @@ describe "Workspace", ->
|
||||
workspace.decreaseFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe 1
|
||||
|
||||
describe "::resetFontSize()", ->
|
||||
it "resets the font size to the window's starting font size", ->
|
||||
originalFontSize = atom.config.get('editor.fontSize')
|
||||
|
||||
workspace.increaseFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize + 1
|
||||
workspace.resetFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
workspace.decreaseFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize - 1
|
||||
workspace.resetFontSize()
|
||||
expect(atom.config.get('editor.fontSize')).toBe originalFontSize
|
||||
|
||||
it "does nothing if the font size has not been changed", ->
|
||||
originalFontSize = atom.config.get('editor.fontSize')
|
||||
|
||||
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 ? []
|
||||
@@ -619,9 +621,14 @@ class Workspace extends Model
|
||||
fontSize = atom.config.get("editor.fontSize")
|
||||
atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1
|
||||
|
||||
# Restore to a default editor font size.
|
||||
# Restore to the window's original editor font size.
|
||||
resetFontSize: ->
|
||||
atom.config.unset("editor.fontSize")
|
||||
if @originalFontSize
|
||||
atom.config.set("editor.fontSize", @originalFontSize)
|
||||
|
||||
subscribeToFontSize: ->
|
||||
atom.config.onDidChange 'editor.fontSize', ({oldValue}) =>
|
||||
@originalFontSize ?= oldValue
|
||||
|
||||
# Removes the item's uri from the list of potential items to reopen.
|
||||
itemOpened: (item) ->
|
||||
|
||||
Reference in New Issue
Block a user