Merge branch 'master' into api/docs

This commit is contained in:
Garen Torikian
2013-04-17 16:08:18 -07:00
52 changed files with 919 additions and 5699 deletions

View File

@@ -28,7 +28,7 @@ class AtomPackage extends Package
else
@requireMainModule()
catch e
console.warn "Failed to load package named '#{@name}'", e.stack
console.warn "Failed to load package named '#{@name}'", e.stack ? e
this
activate: ({immediate}={}) ->

View File

@@ -107,14 +107,13 @@ class BufferMarker
handleBufferChange: (bufferChange) ->
@consolidateObserverNotifications true, =>
@setHeadPosition(@updatePosition(@headPosition, bufferChange, false), clip: false, bufferChanged: true)
@setTailPosition(@updatePosition(@tailPosition, bufferChange, true), clip: false, bufferChanged: true) if @tailPosition
@setHeadPosition(@updatePosition(@headPosition, bufferChange, true), clip: false, bufferChanged: true)
@setTailPosition(@updatePosition(@tailPosition, bufferChange, false), clip: false, bufferChanged: true) if @tailPosition
updatePosition: (position, bufferChange, isFirstPoint) ->
updatePosition: (position, bufferChange, isHead) ->
{ oldRange, newRange } = bufferChange
return position if oldRange.containsPoint(position, exclusive: true)
return position if isFirstPoint and oldRange.start.isEqual(position)
return position if not isHead and oldRange.start.isEqual(position)
return position if position.isLessThan(oldRange.end)
newRow = newRange.end.row

View File

@@ -21,6 +21,7 @@ class Config
themeDirPaths: [userThemesDirPath, bundledThemesDirPath, vendoredThemesDirPath]
packageDirPaths: [userPackagesDirPath, vendoredPackagesDirPath, bundledPackagesDirPath]
userPackagesDirPath: userPackagesDirPath
lessSearchPaths: [fsUtils.join(resourcePath, 'static'), fsUtils.join(resourcePath, 'vendor')]
defaultSettings: null
settings: null
configFileHasErrors: null

View File

@@ -7,7 +7,7 @@ module.exports =
class CursorView extends View
# Internal:
@content: ->
@pre class: 'cursor idle', => @raw ' '
@div class: 'cursor idle', => @raw ' '
blinkPeriod: 800
editor: null

View File

@@ -730,10 +730,6 @@ class Editor extends View
@verticalScrollbar.on 'scroll', =>
@scrollTop(@verticalScrollbar.scrollTop(), adjustVerticalScrollbar: false)
unless @mini
@gutter.widthChanged = (newWidth) =>
@scrollView.css('left', newWidth + 'px')
@scrollView.on 'scroll', =>
if @scrollView.scrollLeft() == 0
@gutter.removeClass('drop-shadow')
@@ -766,7 +762,6 @@ class Editor extends View
return if @attached
@attached = true
@calculateDimensions()
@hiddenInput.width(@charWidth)
@setSoftWrapColumn() if @activeEditSession.getSoftWrap()
@subscribe $(window), "resize.editor-#{@id}", => @requestDisplayUpdate()
@focus() if @isFocused
@@ -1108,7 +1103,7 @@ class Editor extends View
# Internal:
calculateDimensions: ->
fragment = $('<pre class="line" style="position: absolute; visibility: hidden;"><span>x</span></div>')
fragment = $('<div class="line" style="position: absolute; visibility: hidden;"><span>x</span></div>')
@renderedLines.append(fragment)
lineRect = fragment[0].getBoundingClientRect()
@@ -1116,7 +1111,6 @@ class Editor extends View
@lineHeight = lineRect.height
@charWidth = charRect.width
@charHeight = charRect.height
@height(@lineHeight) if @mini
fragment.remove()
updateLayerDimensions: ->
@@ -1446,7 +1440,7 @@ class Editor extends View
attributePairs = []
attributePairs.push "#{attributeName}=\"#{value}\"" for attributeName, value of lineAttributes
line.push("<pre #{attributePairs.join(' ')}>")
line.push("<div #{attributePairs.join(' ')}>")
invisibles = @invisibles if @showInvisibles
@@ -1475,7 +1469,7 @@ class Editor extends View
line.push("<span class='fold-marker'/>") if fold
line.push('</pre>')
line.push('</div>')
line.join('')
lineElementForScreenRow: (screenRow) ->

View File

@@ -16,7 +16,6 @@ class Gutter extends View
firstScreenRow: Infinity
lastScreenRow: -1
highestNumberWidth: null
# Internal:
afterAttach: (onDom) ->

View File

@@ -2,7 +2,7 @@ fs = require 'fs'
fsUtils = require 'fs-utils'
$ = require 'jquery'
_ = require 'underscore'
{less} = require 'less'
less = require 'less'
require 'jquery-extensions'
require 'underscore-extensions'
require 'space-pen-extensions'
@@ -25,12 +25,7 @@ window.setUpEnvironment = ->
$(document).on 'keydown', keymap.handleKeyEvent
keymap.bindDefaultKeys()
requireStylesheet 'reset'
requireStylesheet 'atom'
requireStylesheet 'overlay'
requireStylesheet 'popover-list'
requireStylesheet 'notification'
requireStylesheet 'markdown'
if nativeStylesheetPath = fsUtils.resolveOnLoadPath(process.platform, ['css', 'less'])
requireStylesheet(nativeStylesheetPath)
@@ -140,13 +135,28 @@ window.requireStylesheet = (path) ->
throw new Error("Could not find a file at path '#{path}'")
window.loadStylesheet = (path) ->
content = fsUtils.read(path)
if fsUtils.extension(path) == '.less'
(new less.Parser).parse content, (e, tree) ->
throw new Error(e.message, path, e.line) if e
content = tree.toCSS()
loadLessStylesheet(path)
else
fsUtils.read(path)
content
window.loadLessStylesheet = (path) ->
parser = new less.Parser
syncImport: true
paths: config.lessSearchPaths
filename: path
try
content = null
parser.parse fsUtils.read(path), (e, tree) ->
throw e if e?
content = tree.toCSS()
content
catch e
console.error """
Error compiling less stylesheet: #{path}
Line number: #{e.line}
#{e.message}
"""
window.removeStylesheet = (path) ->
unless fullPath = window.resolveStylesheet(path)