Merge branch 'master' into chrome35

Conflicts:
	apm/package.json
	package.json
This commit is contained in:
Cheng Zhao
2014-07-24 17:12:32 +08:00
39 changed files with 159 additions and 287 deletions

View File

@@ -34,7 +34,6 @@ EditorComponent = React.createClass
selectionChanged: false
selectionAdded: false
scrollingVertically: false
gutterWidth: 0
refreshingScrollbars: false
measuringScrollbars: true
mouseWheelScreenRow: null
@@ -94,8 +93,8 @@ EditorComponent = React.createClass
div {className, style, tabIndex: -1},
if not mini and showLineNumbers
GutterComponent {
ref: 'gutter', onMouseDown: @onGutterMouseDown, onWidthChanged: @onGutterWidthChanged,
lineDecorations, defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight,
ref: 'gutter', onMouseDown: @onGutterMouseDown, lineDecorations,
defaultCharWidth, editor, renderedRowRange, maxLineNumberDigits, scrollViewHeight,
scrollTop, scrollHeight, lineHeightInPixels, @pendingChanges, mouseWheelScreenRow, @useHardwareAcceleration
}
@@ -121,6 +120,18 @@ EditorComponent = React.createClass
placeholderText, @performedInitialMeasurement
}
ScrollbarComponent
ref: 'horizontalScrollbar'
className: 'horizontal-scrollbar'
orientation: 'horizontal'
onScroll: @onHorizontalScroll
scrollLeft: scrollLeft
scrollWidth: scrollWidth
visible: horizontallyScrollable and not @refreshingScrollbars and not @measuringScrollbars
scrollableInOppositeDirection: verticallyScrollable
verticalScrollbarWidth: verticalScrollbarWidth
horizontalScrollbarHeight: horizontalScrollbarHeight
ScrollbarComponent
ref: 'verticalScrollbar'
className: 'vertical-scrollbar'
@@ -133,18 +144,6 @@ EditorComponent = React.createClass
verticalScrollbarWidth: verticalScrollbarWidth
horizontalScrollbarHeight: horizontalScrollbarHeight
ScrollbarComponent
ref: 'horizontalScrollbar'
className: 'horizontal-scrollbar'
orientation: 'horizontal'
onScroll: @onHorizontalScroll
scrollLeft: scrollLeft
scrollWidth: scrollWidth + @gutterWidth
visible: horizontallyScrollable and not @refreshingScrollbars and not @measuringScrollbars
scrollableInOppositeDirection: verticallyScrollable
verticalScrollbarWidth: verticalScrollbarWidth
horizontalScrollbarHeight: horizontalScrollbarHeight
# Also used to measure the height/width of scrollbars after the initial render
ScrollbarCornerComponent
ref: 'scrollbarCorner'
@@ -834,9 +833,6 @@ EditorComponent = React.createClass
remeasureCharacterWidths: ->
@refs.lines.remeasureCharacterWidths()
onGutterWidthChanged: (@gutterWidth) ->
@requestUpdate()
measureScrollbars: ->
return unless @visible
@measuringScrollbars = false

View File

@@ -1067,9 +1067,11 @@ class Editor extends Model
# All the changes made inside the given {Function} can be reverted with a
# single call to {::undo}.
#
# fn - A {Function} that will be called with each {Selection}.
# fn - A {Function} that will be called once for each {Selection}. The first
# argument will be a {Selection} and the second argument will be the
# {Number} index of that selection.
mutateSelectedText: (fn) ->
@transact => fn(selection,index) for selection,index in @getSelections()
@transact => fn(selection, index) for selection, index in @getSelections()
replaceSelectedText: (options={}, fn) ->
{selectWordIfEmpty} = options

View File

@@ -63,9 +63,6 @@ GutterComponent = React.createClass
@updateDummyLineNumber()
@removeLineNumberNodes()
unless isEqualForProperties(oldProps, @props, 'maxLineNumberDigits', 'defaultCharWidth')
@measureWidth()
@clearScreenRowCaches() unless oldProps.lineHeightInPixels is @props.lineHeightInPixels
@updateLineNumbers()
@@ -223,9 +220,3 @@ GutterComponent = React.createClass
editor.unfoldBufferRow(bufferRow)
else
editor.foldBufferRow(bufferRow)
measureWidth: ->
width = @getDOMNode().offsetWidth
unless width is @measuredWidth
@measuredWidth = width
@props.onWidthChanged?(width)

View File

@@ -181,7 +181,7 @@ LinesComponent = React.createClass
lineHTML
else
' ' + @buildEndOfLineHTML(line, @props.invisibles)
@buildEndOfLineHTML(line, @props.invisibles) or ' '
buildLineInnerHTML: (line) ->
{invisibles, mini, showIndentGuide, invisibles} = @props
@@ -204,9 +204,11 @@ LinesComponent = React.createClass
return '' if @props.mini or line.isSoftWrapped()
html = ''
if invisibles.cr? and line.lineEnding is '\r\n'
# Note the lack of '?' in the character checks. A user can set the chars
# to an empty string which we will interpret as not-set
if invisibles.cr and line.lineEnding is '\r\n'
html += "<span class='invisible-character'>#{invisibles.cr}</span>"
if invisibles.eol?
if invisibles.eol
html += "<span class='invisible-character'>#{invisibles.eol}</span>"
html

View File

@@ -17,8 +17,9 @@ ScrollbarComponent = React.createClass
style.width = verticalScrollbarWidth
style.bottom = horizontalScrollbarHeight if scrollableInOppositeDirection
when 'horizontal'
style.height = horizontalScrollbarHeight
style.left = 0
style.right = verticalScrollbarWidth if scrollableInOppositeDirection
style.height = horizontalScrollbarHeight
div {className, style, @onScroll},
switch orientation