mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Meta+ and meta- change the editor font size
This commit is contained in:
@@ -409,3 +409,14 @@ describe "RootView", ->
|
||||
rootView.editors()[0].remove()
|
||||
expect(document.title).toBe rootView.project.getPath()
|
||||
|
||||
describe "font size adjustment", ->
|
||||
it "increases/decreases font size when increase/decrease-font-size events are triggered", ->
|
||||
fontSizeBefore = rootView.getFontSize()
|
||||
rootView.trigger 'increase-font-size'
|
||||
expect(rootView.getFontSize()).toBe fontSizeBefore + 1
|
||||
rootView.trigger 'increase-font-size'
|
||||
expect(rootView.getFontSize()).toBe fontSizeBefore + 2
|
||||
rootView.trigger 'decrease-font-size'
|
||||
expect(rootView.getFontSize()).toBe fontSizeBefore + 1
|
||||
rootView.trigger 'decrease-font-size'
|
||||
expect(rootView.getFontSize()).toBe fontSizeBefore
|
||||
|
||||
@@ -2,6 +2,8 @@ window.keymap.bindKeys '*'
|
||||
'meta-s': 'save'
|
||||
'meta-w': 'close'
|
||||
'alt-meta-i': 'show-console'
|
||||
'meta-+': 'increase-font-size'
|
||||
'meta--': 'decrease-font-size'
|
||||
|
||||
right: 'move-right'
|
||||
left: 'move-left'
|
||||
|
||||
@@ -28,7 +28,7 @@ class RootView extends View
|
||||
|
||||
extensions: null
|
||||
extensionStates: null
|
||||
fontSize: null
|
||||
fontSize: 18
|
||||
|
||||
initialize: ({ pathToOpen }) ->
|
||||
@extensions = {}
|
||||
@@ -57,6 +57,9 @@ class RootView extends View
|
||||
@project.setPath(path) unless @project.getRootDirectory()
|
||||
@setTitle(path)
|
||||
|
||||
@on 'increase-font-size', => @setFontSize(@getFontSize() + 1)
|
||||
@on 'decrease-font-size', => @setFontSize(@getFontSize() - 1)
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
@focus() if onDom
|
||||
|
||||
|
||||
Reference in New Issue
Block a user