mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Merge branch 'master' into ns-property-selectors
This commit is contained in:
@@ -19,7 +19,7 @@ module.exports =
|
||||
activate: (state) ->
|
||||
@myObject =
|
||||
if state
|
||||
deserialize(state)
|
||||
atom.deserializers.deserialize(state)
|
||||
else
|
||||
new MyObject("Hello")
|
||||
|
||||
@@ -31,7 +31,8 @@ module.exports =
|
||||
|
||||
```coffee-script
|
||||
class MyObject
|
||||
registerDeserializer(this)
|
||||
atom.deserializers.add(this)
|
||||
|
||||
@deserialize: ({data}) -> new MyObject(data)
|
||||
constructor: (@data) ->
|
||||
serialize: -> { deserializer: 'MyObject', data: @data }
|
||||
@@ -50,8 +51,8 @@ class-level method on the same class that implements `serialize`. This method's
|
||||
job is to convert a state object returned from a previous call `serialize` back
|
||||
into a genuine object.
|
||||
|
||||
#### registerDeserializer(klass)
|
||||
You need to call the global `registerDeserializer` method with your class in
|
||||
#### atom.deserializers.add(klass)
|
||||
You need to call the `atom.deserializers.add` method with your class in
|
||||
order to make it available to the deserialization system. Now you can call the
|
||||
global `deserialize` method with state returned from `serialize`, and your
|
||||
class's `deserialize` method will be selected automatically.
|
||||
@@ -60,14 +61,15 @@ class's `deserialize` method will be selected automatically.
|
||||
|
||||
```coffee-script
|
||||
class MyObject
|
||||
atom.deserializers.add(this)
|
||||
|
||||
@version: 2
|
||||
@deserialize: (state) -> ...
|
||||
serialize: -> { version: MyObject.version, ... }
|
||||
serialize: -> { version: @constructor.version, ... }
|
||||
```
|
||||
|
||||
Your serializable class can optionally have a class-level `@version` property
|
||||
and include a `version` key in its serialized state. When deserializing, Atom
|
||||
will only attempt to call deserialize if the two versions match, and otherwise
|
||||
return undefined. We plan on implementing a migration system in the future, but
|
||||
this at least protects you from improperly deserializing old state. If you find
|
||||
yourself in dire need of the migration system, let us know.
|
||||
this at least protects you from improperly deserializing old state.
|
||||
|
||||
@@ -51,7 +51,7 @@ editor such as comments, strings and the line numbers in the gutter.
|
||||
|
||||
As an example, let's make the `.gutter` `background-color` into `@red`.
|
||||
|
||||
Reload Atom by pressing `cmd-alt-option-L` to see the changes you made reflected
|
||||
Reload Atom by pressing `cmd-alt-ctrl-l` to see the changes you made reflected
|
||||
in your Atom window. Pretty neat!
|
||||
|
||||
__Tip:__ You can avoid reloading to see changes you make by opening an atom
|
||||
|
||||
14
package.json
14
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.76.0",
|
||||
"version": "0.77.0",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -11,10 +11,10 @@
|
||||
"url": "https://github.com/atom/atom/issues"
|
||||
},
|
||||
"license": "All Rights Reserved",
|
||||
"atomShellVersion": "0.11.1",
|
||||
"atomShellVersion": "0.11.2",
|
||||
"dependencies": {
|
||||
"async": "0.2.6",
|
||||
"atom-keymap": "^0.10.0",
|
||||
"atom-keymap": "^0.11.0",
|
||||
"bootstrap": "git://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372",
|
||||
"clear-cut": "0.4.0",
|
||||
"coffee-script": "1.7.0",
|
||||
@@ -86,9 +86,9 @@
|
||||
"package-generator": "0.30.0",
|
||||
"release-notes": "0.26.0",
|
||||
"settings-view": "0.97.0",
|
||||
"snippets": "0.37.0",
|
||||
"snippets": "0.38.0",
|
||||
"spell-check": "0.28.0",
|
||||
"status-bar": "0.36.0",
|
||||
"status-bar": "0.37.0",
|
||||
"styleguide": "0.26.0",
|
||||
"symbols-view": "0.44.0",
|
||||
"tabs": "0.31.0",
|
||||
@@ -101,7 +101,7 @@
|
||||
"language-c": "0.13.0",
|
||||
"language-coffee-script": "0.16.0",
|
||||
"language-css": "0.13.0",
|
||||
"language-gfm": "0.24.0",
|
||||
"language-gfm": "0.25.0",
|
||||
"language-git": "0.9.0",
|
||||
"language-go": "0.7.0",
|
||||
"language-html": "0.15.0",
|
||||
@@ -125,7 +125,7 @@
|
||||
"language-text": "0.6.0",
|
||||
"language-todo": "0.9.0",
|
||||
"language-toml": "0.12.0",
|
||||
"language-xml": "0.8.0",
|
||||
"language-xml": "0.9.0",
|
||||
"language-yaml": "0.6.0"
|
||||
},
|
||||
"private": true,
|
||||
|
||||
@@ -2937,14 +2937,14 @@ describe "EditorView", ->
|
||||
.editor { line-height: 2; }
|
||||
"""
|
||||
|
||||
expect(editorView.pixelPositionForScreenPosition([1, 3])).toEqual {top: 32, left: 30}
|
||||
expect(editorView.getCursorView().position()).toEqual {top: 32, left: 30}
|
||||
expect(editorView.pixelPositionForScreenPosition([1, 3])).toEqual {top: 20, left: 30}
|
||||
expect(editorView.getCursorView().position()).toEqual {top: 20, left: 30}
|
||||
|
||||
atom.themes.applyStylesheet 'char-width', """
|
||||
.editor { letter-spacing: 2px; }
|
||||
"""
|
||||
expect(editorView.pixelPositionForScreenPosition([1, 3])).toEqual {top: 32, left: 36}
|
||||
expect(editorView.getCursorView().position()).toEqual {top: 32, left: 36}
|
||||
expect(editorView.pixelPositionForScreenPosition([1, 3])).toEqual {top: 20, left: 36}
|
||||
expect(editorView.getCursorView().position()).toEqual {top: 20, left: 36}
|
||||
|
||||
describe "when the editor contains hard tabs", ->
|
||||
it "correctly calculates the the position left for a column", ->
|
||||
|
||||
@@ -44,6 +44,7 @@ class EditorView extends View
|
||||
@configDefaults:
|
||||
fontFamily: ''
|
||||
fontSize: 16
|
||||
lineHeight: 1.3
|
||||
showInvisibles: false
|
||||
showIndentGuide: false
|
||||
showLineNumbers: true
|
||||
@@ -340,6 +341,8 @@ class EditorView extends View
|
||||
@subscribe atom.config.observe 'editor.invisibles', (invisibles) => @setInvisibles(invisibles)
|
||||
@subscribe atom.config.observe 'editor.fontSize', (fontSize) => @setFontSize(fontSize)
|
||||
@subscribe atom.config.observe 'editor.fontFamily', (fontFamily) => @setFontFamily(fontFamily)
|
||||
@subscribe atom.config.observe 'editor.lineHeight', (lineHeight) => @setLineHeight(lineHeight)
|
||||
|
||||
|
||||
handleEvents: ->
|
||||
@on 'focus', =>
|
||||
@@ -747,6 +750,14 @@ class EditorView extends View
|
||||
# Returns a {String} identifying the CSS `font-family`.
|
||||
getFontFamily: -> @css("font-family")
|
||||
|
||||
# Public: Sets the line height of the editor
|
||||
#
|
||||
# lineHeight - A {Number} without a unit suffix identifying the CSS
|
||||
# `line-height`.
|
||||
setLineHeight: (lineHeight) ->
|
||||
@css('line-height', lineHeight)
|
||||
@redraw()
|
||||
|
||||
# Public: Redraw the editor
|
||||
redraw: ->
|
||||
return unless @hasParent()
|
||||
@@ -885,7 +896,7 @@ class EditorView extends View
|
||||
@setHeightInLines()
|
||||
|
||||
recalculateDimensions: ->
|
||||
return unless @attached
|
||||
return unless @attached and @isVisible()
|
||||
|
||||
oldCharWidth = @charWidth
|
||||
oldLineHeight = @lineHeight
|
||||
|
||||
Reference in New Issue
Block a user