mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge remote-tracking branch 'origin/master' into win-specs
This commit is contained in:
18
package.json
18
package.json
@@ -9,7 +9,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/atom/atom/issues"
|
||||
},
|
||||
"atomShellVersion": "0.6.7",
|
||||
"atomShellVersion": "0.6.8",
|
||||
"dependencies": {
|
||||
"async": "0.2.6",
|
||||
"bootstrap": "git://github.com/twbs/bootstrap.git#v3.0.0",
|
||||
@@ -35,7 +35,7 @@
|
||||
"season": "0.14.0",
|
||||
"semver": "1.1.4",
|
||||
"space-pen": "2.0.0",
|
||||
"telepath": "0.20.0",
|
||||
"telepath": "0.21.0",
|
||||
"temp": "0.5.0",
|
||||
"underscore-plus": "0.2.0"
|
||||
},
|
||||
@@ -64,11 +64,11 @@
|
||||
},
|
||||
"packageDependencies" : {
|
||||
"atom-light-ui": "0.6.0",
|
||||
"atom-light-syntax": "0.5.0",
|
||||
"atom-light-syntax": "0.6.0",
|
||||
"atom-dark-ui": "0.5.0",
|
||||
"atom-dark-syntax": "0.5.0",
|
||||
"base16-tomorrow-dark-theme": "0.2.0",
|
||||
"solarized-dark-syntax": "0.3.0",
|
||||
"atom-dark-syntax": "0.6.0",
|
||||
"base16-tomorrow-dark-theme": "0.4.0",
|
||||
"solarized-dark-syntax": "0.4.0",
|
||||
|
||||
"archive-view": "0.11.0",
|
||||
"autocomplete": "0.11.0",
|
||||
@@ -78,10 +78,10 @@
|
||||
"bracket-matcher": "0.9.0",
|
||||
"command-logger": "0.6.0",
|
||||
"command-palette": "0.7.0",
|
||||
"dev-live-reload": "0.13.0",
|
||||
"dev-live-reload": "0.14.0",
|
||||
"editor-stats": "0.5.0",
|
||||
"exception-reporting": "0.5.0",
|
||||
"find-and-replace": "0.36.0",
|
||||
"find-and-replace": "0.38.0",
|
||||
"fuzzy-finder": "0.19.0",
|
||||
"gists": "0.6.0",
|
||||
"git-diff": "0.13.0",
|
||||
@@ -104,7 +104,7 @@
|
||||
"terminal": "0.15.0",
|
||||
"timecop": "0.9.0",
|
||||
"to-the-hubs": "0.8.0",
|
||||
"tree-view": "0.26.0",
|
||||
"tree-view": "0.28.0",
|
||||
"visual-bell": "0.3.0",
|
||||
"whitespace": "0.8.0",
|
||||
"wrap-guide": "0.4.0",
|
||||
|
||||
@@ -1326,7 +1326,7 @@ describe "EditSession", ->
|
||||
expect(cursor2.getBufferPosition()).toEqual [8,0]
|
||||
|
||||
describe ".insertNewlineBelow()", ->
|
||||
xdescribe "when the operation is undone", ->
|
||||
describe "when the operation is undone", ->
|
||||
it "places the cursor back at the previous location", ->
|
||||
editSession.setCursorBufferPosition([0,2])
|
||||
editSession.insertNewlineBelow()
|
||||
@@ -1334,8 +1334,8 @@ describe "EditSession", ->
|
||||
editSession.undo()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual [0,2]
|
||||
|
||||
xit "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", ->
|
||||
editSession.setAutoIndent(true)
|
||||
it "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", ->
|
||||
config.set("editor.autoIndent", true)
|
||||
editSession.insertNewlineBelow()
|
||||
expect(buffer.lineForRow(0)).toBe "var quicksort = function () {"
|
||||
expect(buffer.lineForRow(1)).toBe " "
|
||||
@@ -1353,13 +1353,16 @@ describe "EditSession", ->
|
||||
|
||||
describe "when the cursor is not on the first line", ->
|
||||
it "inserts a newline above the current line and moves the cursor to the inserted line", ->
|
||||
editSession.setCursorBufferPosition([3])
|
||||
editSession.setCursorBufferPosition([3,4])
|
||||
editSession.insertNewlineAbove()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual [3,0]
|
||||
expect(editSession.lineForBufferRow(3)).toBe ''
|
||||
expect(editSession.lineForBufferRow(4)).toBe ' var pivot = items.shift(), current, left = [], right = [];'
|
||||
expect(editSession.buffer.getLineCount()).toBe 14
|
||||
|
||||
editSession.undo()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual [3,4]
|
||||
|
||||
describe ".backspace()", ->
|
||||
describe "when there is a single cursor", ->
|
||||
changeScreenRangeHandler = null
|
||||
@@ -2062,7 +2065,7 @@ describe "EditSession", ->
|
||||
editSession.toggleLineCommentsInSelection()
|
||||
expect(buffer.lineForRow(10)).toBe " "
|
||||
|
||||
xdescribe ".undo() and .redo()", ->
|
||||
describe ".undo() and .redo()", ->
|
||||
it "undoes/redoes the last change", ->
|
||||
editSession.insertText("foo")
|
||||
editSession.undo()
|
||||
@@ -2110,7 +2113,7 @@ describe "EditSession", ->
|
||||
editSession.redo()
|
||||
expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 6]], [[1, 18], [1, 18]]]
|
||||
|
||||
it "restores folds after undo and redo", ->
|
||||
xit "restores folds after undo and redo", ->
|
||||
editSession.foldBufferRow(1)
|
||||
editSession.setSelectedBufferRange([[1, 0], [10, Infinity]], preserveFolds: true)
|
||||
expect(editSession.isFoldedAtBufferRow(1)).toBeTruthy()
|
||||
@@ -2133,27 +2136,26 @@ describe "EditSession", ->
|
||||
expect(editSession.isFoldedAtBufferRow(1)).toBeFalsy()
|
||||
expect(editSession.isFoldedAtBufferRow(2)).toBeTruthy()
|
||||
|
||||
xdescribe ".transact([fn])", ->
|
||||
describe "when called without a function", ->
|
||||
it "restores the selection when the transaction is undone/redone", ->
|
||||
buffer.setText('1234')
|
||||
editSession.setSelectedBufferRange([[0, 1], [0, 3]])
|
||||
editSession.transact()
|
||||
describe "begin/commitTransaction()", ->
|
||||
it "restores the selection when the transaction is undone/redone", ->
|
||||
buffer.setText('1234')
|
||||
editSession.setSelectedBufferRange([[0, 1], [0, 3]])
|
||||
editSession.beginTransaction()
|
||||
|
||||
editSession.delete()
|
||||
editSession.moveCursorToEndOfLine()
|
||||
editSession.insertText('5')
|
||||
expect(buffer.getText()).toBe '145'
|
||||
editSession.delete()
|
||||
editSession.moveCursorToEndOfLine()
|
||||
editSession.insertText('5')
|
||||
expect(buffer.getText()).toBe '145'
|
||||
|
||||
editSession.commit()
|
||||
editSession.commitTransaction()
|
||||
|
||||
editSession.undo()
|
||||
expect(buffer.getText()).toBe '1234'
|
||||
expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [0, 3]]
|
||||
editSession.undo()
|
||||
expect(buffer.getText()).toBe '1234'
|
||||
expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [0, 3]]
|
||||
|
||||
editSession.redo()
|
||||
expect(buffer.getText()).toBe '145'
|
||||
expect(editSession.getSelectedBufferRange()).toEqual [[0, 3], [0, 3]]
|
||||
editSession.redo()
|
||||
expect(buffer.getText()).toBe '145'
|
||||
expect(editSession.getSelectedBufferRange()).toEqual [[0, 3], [0, 3]]
|
||||
|
||||
describe "when the buffer is changed (via its direct api, rather than via than edit session)", ->
|
||||
it "moves the cursor so it is in the same relative position of the buffer", ->
|
||||
@@ -2274,7 +2276,7 @@ describe "EditSession", ->
|
||||
expect(buffer.lineForRow(6)).toBe(line7)
|
||||
expect(buffer.getLineCount()).toBe(count - 1)
|
||||
|
||||
xdescribe "when the line being deleted preceeds a fold, and the command is undone", ->
|
||||
describe "when the line being deleted preceeds a fold, and the command is undone", ->
|
||||
it "restores the line and preserves the fold", ->
|
||||
editSession.setCursorBufferPosition([4])
|
||||
editSession.foldCurrentRow()
|
||||
|
||||
@@ -1656,6 +1656,7 @@ describe "Editor", ->
|
||||
|
||||
describe "when soft-wrap is enabled", ->
|
||||
beforeEach ->
|
||||
jasmine.unspy(window, 'setTimeout')
|
||||
editSession.setSoftWrap(true)
|
||||
editor.attachToDom()
|
||||
setEditorHeightInLines(editor, 20)
|
||||
@@ -1735,6 +1736,19 @@ describe "Editor", ->
|
||||
expect(otherEditor.setWidthInChars).toHaveBeenCalled()
|
||||
otherEditor.remove()
|
||||
|
||||
describe "when the editor's width changes", ->
|
||||
it "updates the width in characters on the edit session", ->
|
||||
previousSoftWrapColumn = editSession.getSoftWrapColumn()
|
||||
|
||||
spyOn(editor, 'setWidthInChars').andCallThrough()
|
||||
editor.width(editor.width() / 2)
|
||||
|
||||
waitsFor ->
|
||||
editor.setWidthInChars.callCount > 0
|
||||
|
||||
runs ->
|
||||
expect(editSession.getSoftWrapColumn()).toBeLessThan previousSoftWrapColumn
|
||||
|
||||
describe "gutter rendering", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom(heightInLines: 5.5)
|
||||
@@ -2096,42 +2110,42 @@ describe "Editor", ->
|
||||
expect(editor.getCursorBufferPosition()).toEqual [3, 0]
|
||||
|
||||
describe "when a selection starts/stops intersecting a fold", ->
|
||||
it "adds/removes the 'selected' class to the fold's line element and hides the cursor if it is on the fold line", ->
|
||||
it "adds/removes the 'fold-selected' class to the fold's line element and hides the cursor if it is on the fold line", ->
|
||||
editor.createFold(2, 4)
|
||||
|
||||
editor.setSelectedBufferRange([[1, 0], [2, 0]], preserveFolds: true, isReversed: true)
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.fold-selected')
|
||||
|
||||
editor.setSelectedBufferRange([[1, 0], [1, 1]], preserveFolds: true)
|
||||
expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.fold-selected')
|
||||
|
||||
editor.setSelectedBufferRange([[1, 0], [5, 0]], preserveFolds: true)
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.fold-selected')
|
||||
|
||||
editor.setCursorScreenPosition([3,0])
|
||||
expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.fold-selected')
|
||||
|
||||
editor.setCursorScreenPosition([2,0])
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.fold-selected')
|
||||
expect(editor.find('.cursor')).toBeHidden()
|
||||
|
||||
editor.setCursorScreenPosition([3,0])
|
||||
expect(editor.find('.cursor')).toBeVisible()
|
||||
|
||||
describe "when a selected fold is scrolled into view (and the fold line was not previously rendered)", ->
|
||||
it "renders the fold's line element with the 'selected' class", ->
|
||||
it "renders the fold's line element with the 'fold-selected' class", ->
|
||||
setEditorHeightInLines(editor, 5)
|
||||
editor.resetDisplay()
|
||||
|
||||
editor.createFold(2, 4)
|
||||
editor.setSelectedBufferRange([[1, 0], [5, 0]], preserveFolds: true)
|
||||
expect(editor.renderedLines.find('.fold.selected')).toExist()
|
||||
expect(editor.renderedLines.find('.fold.fold-selected')).toExist()
|
||||
|
||||
editor.scrollToBottom()
|
||||
expect(editor.renderedLines.find('.fold.selected')).not.toExist()
|
||||
expect(editor.renderedLines.find('.fold.fold-selected')).not.toExist()
|
||||
|
||||
editor.scrollTop(0)
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
|
||||
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.fold-selected')
|
||||
|
||||
describe "paging up and down", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -333,6 +333,28 @@ describe "RootView", ->
|
||||
expect(pane2.itemForUri('b')).not.toBeFalsy()
|
||||
expect(rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
|
||||
|
||||
it "handles split: left by opening to the left pane when necessary", ->
|
||||
rootView.openSingletonSync('b', split: 'right')
|
||||
pane2 = rootView.getActivePane()
|
||||
expect(pane2[0]).not.toBe pane1[0]
|
||||
|
||||
rootView.openSingletonSync('file1', split: 'left')
|
||||
|
||||
activePane = rootView.getActivePane()
|
||||
expect(activePane[0]).toBe pane1[0]
|
||||
|
||||
expect(pane1.itemForUri('file1')).toBeTruthy()
|
||||
expect(pane2.itemForUri('file1')).toBeFalsy()
|
||||
expect(rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
|
||||
|
||||
pane2.focus()
|
||||
expect(rootView.getActivePane()[0]).toBe pane2[0]
|
||||
|
||||
rootView.openSingletonSync('file1', split: 'left')
|
||||
activePane = rootView.getActivePane()
|
||||
expect(activePane[0]).toBe pane1[0]
|
||||
expect(rootView.panes.find('.row .pane').toArray()).toEqual [pane1[0], pane2[0]]
|
||||
|
||||
it "reuses the file when already open", ->
|
||||
rootView.openSync('b')
|
||||
rootView.openSingletonSync('b', split: 'right')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@import "lists";
|
||||
@import "popover-list";
|
||||
@import "notification";
|
||||
@import "messages";
|
||||
@import "markdown";
|
||||
@import "editor";
|
||||
@import "select-list";
|
||||
|
||||
12
static/messages.less
Normal file
12
static/messages.less
Normal file
@@ -0,0 +1,12 @@
|
||||
@import "ui-variables";
|
||||
|
||||
.info-messages,
|
||||
.error-messages {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.error-messages {
|
||||
color: @text-color-error;
|
||||
}
|
||||
Reference in New Issue
Block a user