Merge remote-tracking branch 'origin/master' into win-specs

This commit is contained in:
Matt Colyer
2013-11-06 12:12:41 -08:00
9 changed files with 112 additions and 50 deletions

View File

@@ -106,8 +106,10 @@ class DisplayBuffer
#
# editorWidthInChars - A {Number} of characters.
setEditorWidthInChars: (editorWidthInChars) ->
previousWidthInChars = @state.get('editorWidthInChars')
@state.set('editorWidthInChars', editorWidthInChars)
@updateWrappedScreenLines() if @getSoftWrap()
if editorWidthInChars isnt previousWidthInChars and @getSoftWrap()
@updateWrappedScreenLines()
getSoftWrapColumn: ->
editorWidthInChars = @state.get('editorWidthInChars')

View File

@@ -704,6 +704,12 @@ class Editor extends View
else
@gutter.addClass('drop-shadow')
# Listen for overflow events to detect when the editor's width changes
# to update the soft wrap column.
updateWidthInChars = _.debounce((=> @setWidthInChars()), 100)
@scrollView.on 'overflowchanged', =>
updateWidthInChars() if @[0].classList.contains('soft-wrap')
handleInputEvents: ->
@on 'cursor:moved', =>
return unless @isFocused
@@ -923,11 +929,12 @@ class Editor extends View
@scrollVertically(pixelPosition, options)
@scrollHorizontally(pixelPosition)
# Given a buffer range, this highlights all the folds within that range
# Highlight all the folds within the given buffer range.
#
# "Highlighting" essentially just adds the `selected` class to the line
# "Highlighting" essentially just adds the `fold-selected` class to the line's
# DOM element.
#
# bufferRange - The {Range} to check
# bufferRange - The {Range} to check.
highlightFoldsContainingBufferRange: (bufferRange) ->
screenLines = @linesForScreenRows(@firstRenderedScreenRow, @lastRenderedScreenRow)
for screenLine, i in screenLines
@@ -936,9 +943,9 @@ class Editor extends View
element = @lineElementForScreenRow(screenRow)
if bufferRange.intersectsWith(fold.getBufferRange())
element.addClass('selected')
element.addClass('fold-selected')
else
element.removeClass('selected')
element.removeClass('fold-selected')
saveScrollPositionForActiveEditSession: ->
if @attached

View File

@@ -201,12 +201,14 @@ class RootView extends View
else
paneItem = project.openSync()
if split
if split == 'right'
panes = @getPanes()
if panes.length == 1
pane = panes[0].splitRight()
else
pane = _.last(panes)
else if split == 'left'
pane = @getPanes()[0]
pane.showItem(paneItem)
else