From 136a30f1808a8808fadce42fb9e3d9bdacde66fc Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Fri, 4 Sep 2015 10:23:40 -0400 Subject: [PATCH 01/53] Add a clarification about the usage of addOpener Documentation augmented with a note about the need of using fake protocol in order to invoke opener on a file already opened. See discussion at https://discuss.atom.io/t/difficulties-using-atom-workspace-addopener/20444 --- src/workspace.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/workspace.coffee b/src/workspace.coffee index 86e860fe2..55d6604ba 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -506,6 +506,12 @@ class Workspace extends Model # # Returns a {Disposable} on which `.dispose()` can be called to remove the # opener. + # + # Note that the opener will be called if and only if the URI is not already open + # in the current pane. The searchAllPanes flag expands the search from the + # current pane to all panes. If the file path is converted from a standard path, + # e.g. /foo/bar/baz.html, to a URI with a fake protocol, e.g. custom://foo/bar/baz.html, + # it wouldn't conflict and the opener will be invoked. addOpener: (opener) -> if includeDeprecatedAPIs packageName = @getCallingPackageName() From 2c7be877c6475733fbeaa7ffc255ca388b4cf92a Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Fri, 4 Sep 2015 13:28:19 -0400 Subject: [PATCH 02/53] Update note explaining the usage of the protocol --- src/workspace.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 55d6604ba..82d070c1c 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -509,9 +509,12 @@ class Workspace extends Model # # Note that the opener will be called if and only if the URI is not already open # in the current pane. The searchAllPanes flag expands the search from the - # current pane to all panes. If the file path is converted from a standard path, - # e.g. /foo/bar/baz.html, to a URI with a fake protocol, e.g. custom://foo/bar/baz.html, - # it wouldn't conflict and the opener will be invoked. + # current pane to all panes. If you wish to open a view of a different type for + # a file that is already open, consider changing the protocol of the URI. For + # example, perhaps you wish to preview a rendered version of the file /foo/bar/baz.quux + # that is already open in a text editor view. You could signal this by calling + # {Workspace::open} on the URI quux-preview://foo/bar/baz.quux. Then your opener + # can check the protocol for quux-preview and only handle those URIs that match. addOpener: (opener) -> if includeDeprecatedAPIs packageName = @getCallingPackageName() From f2a1b69a347d4bff95fb5fade547c6d31b28c912 Mon Sep 17 00:00:00 2001 From: Andrey Fedorov Date: Sat, 5 Sep 2015 14:24:07 -0400 Subject: [PATCH 03/53] Add backticks around URLs for style consistency --- src/workspace.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index 82d070c1c..ee7ccdf49 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -511,9 +511,9 @@ class Workspace extends Model # in the current pane. The searchAllPanes flag expands the search from the # current pane to all panes. If you wish to open a view of a different type for # a file that is already open, consider changing the protocol of the URI. For - # example, perhaps you wish to preview a rendered version of the file /foo/bar/baz.quux + # example, perhaps you wish to preview a rendered version of the file `/foo/bar/baz.quux` # that is already open in a text editor view. You could signal this by calling - # {Workspace::open} on the URI quux-preview://foo/bar/baz.quux. Then your opener + # {Workspace::open} on the URI `quux-preview://foo/bar/baz.quux`. Then your opener # can check the protocol for quux-preview and only handle those URIs that match. addOpener: (opener) -> if includeDeprecatedAPIs From 848b4ed564159963ee09182d2f9d87ccc3bde7a6 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 7 Sep 2015 19:47:45 +0200 Subject: [PATCH 04/53] Order line nodes by screen row --- src/lines-tile-component.coffee | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index f823ea8ac..4d0df97cb 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -107,13 +107,24 @@ class LinesTileComponent WrapperDiv.innerHTML = newLinesHTML newLineNodes = _.toArray(WrapperDiv.children) - for id, i in newLineIds - lineNode = newLineNodes[i] - @lineNodesByLineId[id] = lineNode - @domNode.appendChild(lineNode) + newLineNodes = _.sortBy(newLineNodes, @screenRowForNode) + + while newLineNode = newLineNodes.shift() + oldLineNodes = _.rest(@domNode.children) # skips highlights node + while oldLineNode = oldLineNodes.shift() + break if @screenRowForNode(newLineNode) < @screenRowForNode(oldLineNode) + + lineId = @lineIdsByScreenRow[newLineNode.dataset.screenRow] + @lineNodesByLineId[lineId] = newLineNode + if oldLineNode? + @domNode.insertBefore(newLineNode, oldLineNode) + else + @domNode.appendChild(newLineNode) return + screenRowForNode: (node) -> parseInt(node.dataset.screenRow) + buildLineHTML: (id) -> {width} = @newState {screenRow, tokens, text, top, lineEnding, fold, isSoftWrapped, indentLevel, decorationClasses} = @newTileState.lines[id] @@ -124,7 +135,7 @@ class LinesTileComponent classes += decorationClass + ' ' classes += 'line' - lineHTML = "
" + lineHTML = "
" if text is "" lineHTML += @buildEmptyLineInnerHTML(id) @@ -284,9 +295,6 @@ class LinesTileComponent lineNode = @lineNodesByLineId[id] - if @newState.width isnt @oldState.width - lineNode.style.width = @newState.width + 'px' - newDecorationClasses = newLineState.decorationClasses oldDecorationClasses = oldLineState.decorationClasses From 786cd82e26bde15fcf3c45fe228c036549406ab0 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 16:28:19 +0200 Subject: [PATCH 05/53] :green_heart: --- spec/text-editor-component-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 2e914048e..58e3b1db4 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -294,7 +294,7 @@ describe "TextEditorComponent", -> editorFullWidth = editor.getScrollWidth() + editor.getVerticalScrollbarWidth() for lineNode in lineNodes - expect(lineNode.style.width).toBe editorFullWidth + 'px' + expect(lineNode.getBoundingClientRect().width).toBe(editorFullWidth) componentNode.style.width = gutterWidth + editor.getScrollWidth() + 100 + 'px' component.measureDimensions() @@ -302,7 +302,7 @@ describe "TextEditorComponent", -> scrollViewWidth = scrollViewNode.offsetWidth for lineNode in lineNodes - expect(lineNode.style.width).toBe scrollViewWidth + 'px' + expect(lineNode.getBoundingClientRect().width).toBe(scrollViewWidth) it "renders an nbsp on empty lines when no line-ending character is defined", -> atom.config.set("editor.showInvisibles", false) From 23cb2740cdee1dd3d4a15c063e609c12a87506fd Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 16:44:44 +0200 Subject: [PATCH 06/53] :racehorse: Remove class from tiles --- spec/text-editor-component-spec.coffee | 36 +++++++++++++------------- src/line-numbers-tile-component.coffee | 1 - src/lines-tile-component.coffee | 1 - src/text-editor-component.coffee | 7 +++++ src/tiled-component.coffee | 5 ++++ 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 58e3b1db4..8a8c1b0d4 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -108,7 +108,7 @@ describe "TextEditorComponent", -> component.measureDimensions() nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(tilesNodes[0].style.zIndex).toBe("2") expect(tilesNodes[1].style.zIndex).toBe("1") @@ -118,7 +118,7 @@ describe "TextEditorComponent", -> verticalScrollbarNode.dispatchEvent(new UIEvent('scroll')) nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(tilesNodes[0].style.zIndex).toBe("3") expect(tilesNodes[1].style.zIndex).toBe("2") @@ -130,7 +130,7 @@ describe "TextEditorComponent", -> component.measureDimensions() nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(tilesNodes.length).toBe(3) @@ -158,7 +158,7 @@ describe "TextEditorComponent", -> verticalScrollbarNode.dispatchEvent(new UIEvent('scroll')) nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(component.lineNodeForScreenRow(2)).toBeUndefined() expect(tilesNodes.length).toBe(3) @@ -187,7 +187,7 @@ describe "TextEditorComponent", -> editor.getBuffer().deleteRows(0, 1) nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(tilesNodes[0].style['-webkit-transform']).toBe "translate3d(0px, 0px, 0px)" expectTileContainsRow(tilesNodes[0], 0, top: 0 * lineHeightInPixels) @@ -202,7 +202,7 @@ describe "TextEditorComponent", -> editor.getBuffer().insert([0, 0], '\n\n') nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() expect(tilesNodes[0].style['-webkit-transform']).toBe "translate3d(0px, 0px, 0px)" expectTileContainsRow(tilesNodes[0], 0, top: 0 * lineHeightInPixels) @@ -313,7 +313,7 @@ describe "TextEditorComponent", -> backgroundColor = getComputedStyle(wrapperNode).backgroundColor expect(linesNode.style.backgroundColor).toBe backgroundColor - for tileNode in linesNode.querySelectorAll(".tile") + for tileNode in component.tileNodesForLines() expect(tileNode.style.backgroundColor).toBe(backgroundColor) wrapperNode.style.backgroundColor = 'rgb(255, 0, 0)' @@ -322,7 +322,7 @@ describe "TextEditorComponent", -> advanceClock(atom.views.documentPollingInterval) nextAnimationFrame() expect(linesNode.style.backgroundColor).toBe 'rgb(255, 0, 0)' - for tileNode in linesNode.querySelectorAll(".tile") + for tileNode in component.tileNodesForLines() expect(tileNode.style.backgroundColor).toBe("rgb(255, 0, 0)") @@ -606,7 +606,7 @@ describe "TextEditorComponent", -> component.measureDimensions() nextAnimationFrame() - tilesNodes = componentNode.querySelector(".line-numbers").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLineNumbers() expect(tilesNodes[0].style.zIndex).toBe("2") expect(tilesNodes[1].style.zIndex).toBe("1") @@ -616,7 +616,7 @@ describe "TextEditorComponent", -> verticalScrollbarNode.dispatchEvent(new UIEvent('scroll')) nextAnimationFrame() - tilesNodes = componentNode.querySelector(".line-numbers").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLineNumbers() expect(tilesNodes[0].style.zIndex).toBe("3") expect(tilesNodes[1].style.zIndex).toBe("2") @@ -663,7 +663,7 @@ describe "TextEditorComponent", -> component.measureDimensions() nextAnimationFrame() - tilesNodes = componentNode.querySelector(".line-numbers").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLineNumbers() expect(tilesNodes.length).toBe(3) expect(tilesNodes[0].style['-webkit-transform']).toBe "translate3d(0px, 0px, 0px)" @@ -689,7 +689,7 @@ describe "TextEditorComponent", -> verticalScrollbarNode.dispatchEvent(new UIEvent('scroll')) nextAnimationFrame() - tilesNodes = componentNode.querySelector(".line-numbers").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLineNumbers() expect(component.lineNumberNodeForScreenRow(2)).toBeUndefined() expect(tilesNodes.length).toBe(3) @@ -791,7 +791,7 @@ describe "TextEditorComponent", -> lineNumbersNode = gutterNode.querySelector('.line-numbers') {backgroundColor} = getComputedStyle(wrapperNode) expect(lineNumbersNode.style.backgroundColor).toBe backgroundColor - for tileNode in lineNumbersNode.querySelectorAll(".tile") + for tileNode in component.tileNodesForLineNumbers() expect(tileNode.style.backgroundColor).toBe(backgroundColor) # favor gutter color if it's assigned @@ -800,7 +800,7 @@ describe "TextEditorComponent", -> nextAnimationFrame() expect(lineNumbersNode.style.backgroundColor).toBe 'rgb(255, 0, 0)' - for tileNode in lineNumbersNode.querySelectorAll(".tile") + for tileNode in component.tileNodesForLineNumbers() expect(tileNode.style.backgroundColor).toBe("rgb(255, 0, 0)") it "hides or shows the gutter based on the '::isLineNumberGutterVisible' property on the model and the global 'editor.showLineNumbers' config setting", -> @@ -1133,7 +1133,7 @@ describe "TextEditorComponent", -> it "renders 2 regions for 2-line selections", -> editor.setSelectedScreenRange([[1, 6], [2, 10]]) nextAnimationFrame() - tileNode = componentNode.querySelector(".lines").querySelectorAll(".tile")[0] + tileNode = component.tileNodesForLines()[0] regions = tileNode.querySelectorAll('.selection .region') expect(regions.length).toBe 2 @@ -1154,7 +1154,7 @@ describe "TextEditorComponent", -> nextAnimationFrame() # Tile 0 - tileNode = componentNode.querySelector(".lines").querySelectorAll(".tile")[0] + tileNode = component.tileNodesForLines()[0] regions = tileNode.querySelectorAll('.selection .region') expect(regions.length).toBe(3) @@ -1177,7 +1177,7 @@ describe "TextEditorComponent", -> expect(region3Rect.right).toBe tileNode.getBoundingClientRect().right # Tile 3 - tileNode = componentNode.querySelector(".lines").querySelectorAll(".tile")[1] + tileNode = component.tileNodesForLines()[1] regions = tileNode.querySelectorAll('.selection .region') expect(regions.length).toBe(3) @@ -2408,7 +2408,7 @@ describe "TextEditorComponent", -> component.measureDimensions() nextAnimationFrame() - tilesNodes = componentNode.querySelector(".lines").querySelectorAll(".tile") + tilesNodes = component.tileNodesForLines() top = 0 for tileNode in tilesNodes diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index 2ebccbc65..e82b4f6f4 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -9,7 +9,6 @@ class LineNumbersTileComponent constructor: ({@id}) -> @lineNumberNodesById = {} @domNode = document.createElement("div") - @domNode.classList.add("tile") @domNode.style.position = "absolute" @domNode.style.display = "block" @domNode.style.top = 0 # Cover the space occupied by a dummy lineNumber diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index 4d0df97cb..be15b9b67 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -21,7 +21,6 @@ class LinesTileComponent @screenRowsByLineId = {} @lineIdsByScreenRow = {} @domNode = document.createElement("div") - @domNode.classList.add("tile") @domNode.style.position = "absolute" @domNode.style.display = "block" diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 51bc2c463..73b03ce88 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -749,6 +749,13 @@ class TextEditorComponent tileComponent?.lineNumberNodeForScreenRow(screenRow) + tileNodesForLines: -> + @linesComponent.getTiles() + + tileNodesForLineNumbers: -> + gutterComponent = @gutterContainerComponent.getLineNumberGutterComponent() + gutterComponent.getTiles() + screenRowForNode: (node) -> while node? if screenRow = node.dataset.screenRow diff --git a/src/tiled-component.coffee b/src/tiled-component.coffee index 33719dda5..06433f8be 100644 --- a/src/tiled-component.coffee +++ b/src/tiled-component.coffee @@ -1,3 +1,5 @@ +{values} = require 'underscore-plus' + cloneObject = (object) -> clone = {} clone[key] = value for key, value of object @@ -49,3 +51,6 @@ class TiledComponent getComponentForTile: (tileRow) -> @componentsByTileId[tileRow] + + getTiles: -> + values(@componentsByTileId).map (component) -> component.getDomNode() From 1d1fb4caefbe6f88181db6f82c19d979fb7aa69a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 17:23:41 +0200 Subject: [PATCH 07/53] :art: --- src/lines-tile-component.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index be15b9b67..e0ad2f10f 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -113,8 +113,8 @@ class LinesTileComponent while oldLineNode = oldLineNodes.shift() break if @screenRowForNode(newLineNode) < @screenRowForNode(oldLineNode) - lineId = @lineIdsByScreenRow[newLineNode.dataset.screenRow] - @lineNodesByLineId[lineId] = newLineNode + id = @lineIdsByScreenRow[newLineNode.dataset.screenRow] + @lineNodesByLineId[id] = newLineNode if oldLineNode? @domNode.insertBefore(newLineNode, oldLineNode) else From 8713f215c16ef75cf819b189a28f68e044c4f41d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 18:40:27 +0200 Subject: [PATCH 08/53] :racehorse: Remove unused class --- src/line-numbers-tile-component.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index e82b4f6f4..c92367dc8 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -129,7 +129,7 @@ class LineNumbersTileComponent oldLineNumberState.zIndex = newLineNumberState.zIndex buildLineNumberClassName: ({bufferRow, foldable, decorationClasses, softWrapped}) -> - className = "line-number line-number-#{bufferRow}" + className = "line-number" className += " " + decorationClasses.join(' ') if decorationClasses? className += " foldable" if foldable and not softWrapped className From b997b8c1892c754cef7c5576371a9c556ed33665 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 18:52:25 +0200 Subject: [PATCH 09/53] :fire: Remove line node `style.top` --- src/lines-tile-component.coffee | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index e0ad2f10f..d94ead656 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -309,10 +309,6 @@ class LinesTileComponent oldLineState.decorationClasses = newLineState.decorationClasses - if newLineState.top isnt oldLineState.top - lineNode.style.top = newLineState.top + 'px' - oldLineState.top = newLineState.top - if newLineState.screenRow isnt oldLineState.screenRow lineNode.dataset.screenRow = newLineState.screenRow oldLineState.screenRow = newLineState.screenRow From 86815f5be4e27c9ce27ca7699193afa8461df463 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 19:30:44 +0200 Subject: [PATCH 10/53] :racehorse: Remove inline styles for line numbers --- src/line-numbers-tile-component.coffee | 34 ++++++++++++++++---------- src/text-editor-presenter.coffee | 1 + 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index c92367dc8..05a997216 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -8,6 +8,7 @@ class LineNumbersTileComponent constructor: ({@id}) -> @lineNumberNodesById = {} + @lineNumberIdsByScreenRow = {} @domNode = document.createElement("div") @domNode.style.position = "absolute" @domNode.style.display = "block" @@ -62,6 +63,7 @@ class LineNumbersTileComponent unless @newTileState.lineNumbers.hasOwnProperty(id) @lineNumberNodesById[id].remove() delete @lineNumberNodesById[id] + delete @lineNumberIdsByScreenRow[lineNumberState.screenRow] delete @oldTileState.lineNumbers[id] for id, lineNumberState of @newTileState.lineNumbers @@ -72,20 +74,29 @@ class LineNumbersTileComponent newLineNumbersHTML ?= "" newLineNumberIds.push(id) newLineNumbersHTML += @buildLineNumberHTML(lineNumberState) + @lineNumberIdsByScreenRow[lineNumberState.screenRow] = id @oldTileState.lineNumbers[id] = _.clone(lineNumberState) if newLineNumberIds? WrapperDiv.innerHTML = newLineNumbersHTML newLineNumberNodes = _.toArray(WrapperDiv.children) + newLineNumberNodes = _.sortBy(newLineNumberNodes, @screenRowForNode) + while newNode = newLineNumberNodes.shift() + oldLineNumberNodes = _.toArray(@domNode.children) + while oldNode = oldLineNumberNodes.shift() + break if @screenRowForNode(newNode) < @screenRowForNode(oldNode) - node = @domNode - for id, i in newLineNumberIds - lineNumberNode = newLineNumberNodes[i] - @lineNumberNodesById[id] = lineNumberNode - node.appendChild(lineNumberNode) + id = @lineNumberIdsByScreenRow[newNode.dataset.screenRow] + @lineNumberNodesById[id] = newNode + if oldNode? + @domNode.insertBefore(newNode, oldNode) + else + @domNode.appendChild(newNode) return + screenRowForNode: (node) -> parseInt(node.dataset.screenRow) + buildLineNumberHTML: (lineNumberState) -> {screenRow, bufferRow, softWrapped, top, decorationClasses, zIndex} = lineNumberState if screenRow? @@ -95,7 +106,7 @@ class LineNumbersTileComponent className = @buildLineNumberClassName(lineNumberState) innerHTML = @buildLineNumberInnerHTML(bufferRow, softWrapped) - "
#{innerHTML}
" + "
#{innerHTML}
" buildLineNumberInnerHTML: (bufferRow, softWrapped) -> {maxLineNumberDigits} = @newState @@ -118,15 +129,12 @@ class LineNumbersTileComponent oldLineNumberState.foldable = newLineNumberState.foldable oldLineNumberState.decorationClasses = _.clone(newLineNumberState.decorationClasses) - unless oldLineNumberState.top is newLineNumberState.top - node.style.top = newLineNumberState.top + 'px' + unless oldLineNumberState.screenRow is newLineNumberState.screenRow or oldLineNumberState.bufferRow is newLineNumberState.bufferRow + node.innerHTML = @buildLineNumberInnerHTML(newLineNumberState.bufferRow, newLineNumberState.softWrapped) node.dataset.screenRow = newLineNumberState.screenRow - oldLineNumberState.top = newLineNumberState.top + node.dataset.bufferRow = newLineNumberState.bufferRow oldLineNumberState.screenRow = newLineNumberState.screenRow - - unless oldLineNumberState.zIndex is newLineNumberState.zIndex - node.style.zIndex = newLineNumberState.zIndex - oldLineNumberState.zIndex = newLineNumberState.zIndex + oldLineNumberState.bufferRow = newLineNumberState.bufferRow buildLineNumberClassName: ({bufferRow, foldable, decorationClasses, softWrapped}) -> className = "line-number" diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 2c0900092..52a6a9a02 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -607,6 +607,7 @@ class TextEditorPresenter top = (screenRow - startRow) * @lineHeight decorationClasses = @lineNumberDecorationClassesForRow(screenRow) foldable = @model.isFoldableAtScreenRow(screenRow) + id = @model.tokenizedLineForScreenRow(screenRow).id tileState.lineNumbers[id] = {screenRow, bufferRow, softWrapped, top, decorationClasses, foldable, zIndex} visibleLineNumberIds[id] = true From 51050bde196ba587dba96792717125fea3f2d753 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 8 Sep 2015 19:37:41 +0200 Subject: [PATCH 11/53] Remove `z-index` specs --- spec/text-editor-component-spec.coffee | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 8a8c1b0d4..2baa90ac7 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -623,26 +623,6 @@ describe "TextEditorComponent", -> expect(tilesNodes[2].style.zIndex).toBe("1") expect(tilesNodes[3].style.zIndex).toBe("0") - it "renders higher line numbers in front of lower ones", -> - wrapperNode.style.height = 6.5 * lineHeightInPixels + 'px' - component.measureDimensions() - nextAnimationFrame() - - # Tile 0 - expect(component.lineNumberNodeForScreenRow(0).style.zIndex).toBe("2") - expect(component.lineNumberNodeForScreenRow(1).style.zIndex).toBe("1") - expect(component.lineNumberNodeForScreenRow(2).style.zIndex).toBe("0") - - # Tile 1 - expect(component.lineNumberNodeForScreenRow(3).style.zIndex).toBe("2") - expect(component.lineNumberNodeForScreenRow(4).style.zIndex).toBe("1") - expect(component.lineNumberNodeForScreenRow(5).style.zIndex).toBe("0") - - # Tile 2 - expect(component.lineNumberNodeForScreenRow(6).style.zIndex).toBe("2") - expect(component.lineNumberNodeForScreenRow(7).style.zIndex).toBe("1") - expect(component.lineNumberNodeForScreenRow(8).style.zIndex).toBe("0") - it "gives the line numbers container the same height as the wrapper node", -> linesNode = componentNode.querySelector(".line-numbers") From fe039a0f3c157f9fe8d9f0920df071c921851c0e Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 9 Sep 2015 13:31:34 +0200 Subject: [PATCH 12/53] :green_heart: --- spec/text-editor-presenter-spec.coffee | 9 ++------- src/text-editor-presenter.coffee | 10 +--------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index a02e3b4e3..76589416e 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -2035,15 +2035,10 @@ describe "TextEditorPresenter", -> lineNumberStateForScreenRow = (presenter, screenRow) -> editor = presenter.model tileRow = presenter.tileForRow(screenRow) - bufferRow = editor.bufferRowForScreenRow(screenRow) - wrapCount = screenRow - editor.screenRowForBufferRow(bufferRow) - if wrapCount > 0 - key = bufferRow + '-' + wrapCount - else - key = bufferRow + line = editor.tokenizedLineForScreenRow(screenRow) gutterState = getLineNumberGutterState(presenter) - gutterState.content.tiles[tileRow]?.lineNumbers[key] + gutterState.content.tiles[tileRow]?.lineNumbers[line?.id] tiledContentContract (presenter) -> getLineNumberGutterState(presenter).content diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 52a6a9a02..7bc4757c0 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -584,22 +584,15 @@ class TextEditorPresenter if startRow > 0 rowBeforeStartRow = startRow - 1 lastBufferRow = @model.bufferRowForScreenRow(rowBeforeStartRow) - wrapCount = rowBeforeStartRow - @model.screenRowForBufferRow(lastBufferRow) else lastBufferRow = null - wrapCount = 0 if endRow > startRow bufferRows = @model.bufferRowsForScreenRows(startRow, endRow - 1) - zIndex = bufferRows.length - 1 for bufferRow, i in bufferRows if bufferRow is lastBufferRow - wrapCount++ - id = bufferRow + '-' + wrapCount softWrapped = true else - id = bufferRow - wrapCount = 0 lastBufferRow = bufferRow softWrapped = false @@ -609,9 +602,8 @@ class TextEditorPresenter foldable = @model.isFoldableAtScreenRow(screenRow) id = @model.tokenizedLineForScreenRow(screenRow).id - tileState.lineNumbers[id] = {screenRow, bufferRow, softWrapped, top, decorationClasses, foldable, zIndex} + tileState.lineNumbers[id] = {screenRow, bufferRow, softWrapped, top, decorationClasses, foldable} visibleLineNumberIds[id] = true - zIndex-- for id of tileState.lineNumbers delete tileState.lineNumbers[id] unless visibleLineNumberIds[id] From 246476f7597ed4d52f152d03797eaf73525379cf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 9 Sep 2015 14:26:47 +0200 Subject: [PATCH 13/53] :art: --- src/line-numbers-tile-component.coffee | 37 +++++++++++++------------- src/lines-tile-component.coffee | 23 +++++++++------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index 05a997216..fcebf3dcf 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -77,32 +77,33 @@ class LineNumbersTileComponent @lineNumberIdsByScreenRow[lineNumberState.screenRow] = id @oldTileState.lineNumbers[id] = _.clone(lineNumberState) - if newLineNumberIds? - WrapperDiv.innerHTML = newLineNumbersHTML - newLineNumberNodes = _.toArray(WrapperDiv.children) - newLineNumberNodes = _.sortBy(newLineNumberNodes, @screenRowForNode) - while newNode = newLineNumberNodes.shift() - oldLineNumberNodes = _.toArray(@domNode.children) - while oldNode = oldLineNumberNodes.shift() - break if @screenRowForNode(newNode) < @screenRowForNode(oldNode) + return unless newLineNumberIds? - id = @lineNumberIdsByScreenRow[newNode.dataset.screenRow] - @lineNumberNodesById[id] = newNode - if oldNode? - @domNode.insertBefore(newNode, oldNode) - else - @domNode.appendChild(newNode) + WrapperDiv.innerHTML = newLineNumbersHTML + newLineNumberNodes = _.toArray(WrapperDiv.children) + @insertNodes(newLineNumberNodes) + insertNodes: (lineNumberNodes) -> + lineNumberNodes = _.sortBy(lineNumberNodes, @screenRowForNode) + while newNode = lineNumberNodes.shift() + id = @lineNumberIdsByScreenRow[newNode.dataset.screenRow] + + domNodes = _.toArray(@domNode.children) + while nextNode = domNodes.shift() + break if @screenRowForNode(newNode) < @screenRowForNode(nextNode) + + if nextNode? + @domNode.insertBefore(newNode, nextNode) + else + @domNode.appendChild(newNode) + + @lineNumberNodesById[id] = newNode return screenRowForNode: (node) -> parseInt(node.dataset.screenRow) buildLineNumberHTML: (lineNumberState) -> {screenRow, bufferRow, softWrapped, top, decorationClasses, zIndex} = lineNumberState - if screenRow? - style = "position: absolute; top: #{top}px; z-index: #{zIndex};" - else - style = "visibility: hidden;" className = @buildLineNumberClassName(lineNumberState) innerHTML = @buildLineNumberInnerHTML(bufferRow, softWrapped) diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index d94ead656..66aacf569 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -106,20 +106,23 @@ class LinesTileComponent WrapperDiv.innerHTML = newLinesHTML newLineNodes = _.toArray(WrapperDiv.children) - newLineNodes = _.sortBy(newLineNodes, @screenRowForNode) + @insertLineNodes(newLineNodes) - while newLineNode = newLineNodes.shift() - oldLineNodes = _.rest(@domNode.children) # skips highlights node - while oldLineNode = oldLineNodes.shift() - break if @screenRowForNode(newLineNode) < @screenRowForNode(oldLineNode) + insertLineNodes: (lineNodes) -> + lineNodes = _.sortBy(lineNodes, @screenRowForNode) + while newNode = lineNodes.shift() + id = @lineIdsByScreenRow[newNode.dataset.screenRow] - id = @lineIdsByScreenRow[newLineNode.dataset.screenRow] - @lineNodesByLineId[id] = newLineNode - if oldLineNode? - @domNode.insertBefore(newLineNode, oldLineNode) + domNodes = _.rest(@domNode.children) # skips highlights node + while nextNode = domNodes.shift() + break if @screenRowForNode(newNode) < @screenRowForNode(nextNode) + + if nextNode? + @domNode.insertBefore(newNode, nextNode) else - @domNode.appendChild(newLineNode) + @domNode.appendChild(newNode) + @lineNodesByLineId[id] = newNode return screenRowForNode: (node) -> parseInt(node.dataset.screenRow) From 47fb48b514c1f05c616f4d5c92a0e16d0da71ba1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 9 Sep 2015 14:29:57 +0200 Subject: [PATCH 14/53] :bug: Correct boolean logic --- src/line-numbers-tile-component.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index fcebf3dcf..15746144c 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -130,7 +130,7 @@ class LineNumbersTileComponent oldLineNumberState.foldable = newLineNumberState.foldable oldLineNumberState.decorationClasses = _.clone(newLineNumberState.decorationClasses) - unless oldLineNumberState.screenRow is newLineNumberState.screenRow or oldLineNumberState.bufferRow is newLineNumberState.bufferRow + unless oldLineNumberState.screenRow is newLineNumberState.screenRow and oldLineNumberState.bufferRow is newLineNumberState.bufferRow node.innerHTML = @buildLineNumberInnerHTML(newLineNumberState.bufferRow, newLineNumberState.softWrapped) node.dataset.screenRow = newLineNumberState.screenRow node.dataset.bufferRow = newLineNumberState.bufferRow From d7a0c76bd4925cec97212331c94eb99ce73e0976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Machist=C3=A9=20N=2E=20Quintana?= Date: Wed, 9 Sep 2015 09:56:09 -0400 Subject: [PATCH 15/53] :memo: Document `electron` label in Contributing guide --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e8e3a897..fd193026d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -234,6 +234,7 @@ Please open an issue on `atom/atom` if you have suggestions for new labels, and | `installer` | [search][search-atom-repo-label-installer] | [search][search-atom-org-label-installer] | Related to the Atom installers for different OSes. | | `auto-updater` | [search][search-atom-repo-label-auto-updater] | [search][search-atom-org-label-auto-updater] | Related to the auto-updater for different OSes. | | `deprecation-help` | [search][search-atom-repo-label-deprecation-help] | [search][search-atom-org-label-deprecation-help] | Issues for helping package authors remove usage of deprecated APIs in packages. | +| `electron` | [search][search-atom-repo-label-electron] | [search][search-atom-org-label-electron] | Issues that require changes to [Electron](https://electron.aton.io) to fix or implement. | #### Core Team Project Management @@ -329,6 +330,8 @@ Please open an issue on `atom/atom` if you have suggestions for new labels, and [search-atom-org-label-auto-updater]: https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Aatom+label%3Aauto-updater [search-atom-repo-label-deprecation-help]: https://github.com/issues?q=is%3Aopen+is%3Aissue+repo%3Aatom%2Fatom+label%3Adeprecation-help [search-atom-org-label-deprecation-help]: https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Aatom+label%3Adeprecation-help +[search-atom-repo-label-electron]: https://github.com/issues?q=is%3Aissue+repo%3Aatom%2Fatom+is%3Aopen+label%3Aelectron +[search-atom-org-label-electron]: https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Aatom+label%3Aelectron [search-atom-repo-label-on-deck]: https://github.com/issues?q=is%3Aopen+is%3Aissue+repo%3Aatom%2Fatom+label%3Aon-deck [search-atom-org-label-on-deck]: https://github.com/issues?q=is%3Aopen+is%3Aissue+user%3Aatom+label%3Aon-deck [search-atom-repo-label-in-progress]: https://github.com/issues?q=is%3Aopen+is%3Aissue+repo%3Aatom%2Fatom+label%3Ain-progress From 6c69f430f3423531ec251c95f25464fea5c09b75 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 9 Sep 2015 16:12:09 +0200 Subject: [PATCH 16/53] :fire: Remove `z-index` --- src/line-numbers-tile-component.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index 15746144c..330779999 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -103,7 +103,7 @@ class LineNumbersTileComponent screenRowForNode: (node) -> parseInt(node.dataset.screenRow) buildLineNumberHTML: (lineNumberState) -> - {screenRow, bufferRow, softWrapped, top, decorationClasses, zIndex} = lineNumberState + {screenRow, bufferRow, softWrapped, top, decorationClasses} = lineNumberState className = @buildLineNumberClassName(lineNumberState) innerHTML = @buildLineNumberInnerHTML(bufferRow, softWrapped) From 6b4e769a903211a6eb5918a08ac37ddb5822095b Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 9 Sep 2015 17:56:48 +0200 Subject: [PATCH 17/53] Position line numbers relatively --- static/text-editor-light.less | 1 + static/text-editor-shadow.less | 1 + 2 files changed, 2 insertions(+) diff --git a/static/text-editor-light.less b/static/text-editor-light.less index 819fc565f..7fafade1e 100644 --- a/static/text-editor-light.less +++ b/static/text-editor-light.less @@ -46,6 +46,7 @@ atom-text-editor { } .line-number { + position: relative; white-space: nowrap; padding-left: .5em; opacity: 0.6; diff --git a/static/text-editor-shadow.less b/static/text-editor-shadow.less index 80dc4967b..e481d11b8 100644 --- a/static/text-editor-shadow.less +++ b/static/text-editor-shadow.less @@ -29,6 +29,7 @@ } .line-number { + position: relative; white-space: nowrap; padding-left: .5em; opacity: 0.6; From 6d8a453036dbe7bd4c5a9f76368084cd699d4240 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Sep 2015 14:39:32 -0700 Subject: [PATCH 18/53] Upload assets to pre & production releases from beta & stable branches --- build/tasks/publish-build-task.coffee | 21 +++++++++++++++------ build/tasks/set-version-task.coffee | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index 1b9eb07ce..1f8925aed 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -22,7 +22,7 @@ module.exports = (gruntObject) -> grunt.registerTask 'publish-build', 'Publish the built app', -> tasks = [] tasks.push('build-docs', 'prepare-docs') if process.platform is 'darwin' - tasks.push('upload-assets') if process.env.JANKY_SHA1 and process.env.JANKY_BRANCH is 'master' + tasks.push('upload-assets') grunt.task.run(tasks) grunt.registerTask 'prepare-docs', 'Move api.json to atom-api.json', -> @@ -31,6 +31,14 @@ module.exports = (gruntObject) -> cp path.join(docsOutputDir, 'api.json'), path.join(buildDir, 'atom-api.json') grunt.registerTask 'upload-assets', 'Upload the assets to a GitHub release', -> + switch process.env.JANKY_BRANCH + when 'stable' + isPrerelease = false + when 'beta' + isPrerelease = true + else + return + doneCallback = @async() startTime = Date.now() done = (args...) -> @@ -46,7 +54,7 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - getAtomDraftRelease (error, release) -> + getAtomDraftRelease isPrerelease, (error, release) -> return done(error) if error? assetNames = (asset.assetName for asset in assets) deleteExistingAssets release, assetNames, (error) -> @@ -120,9 +128,9 @@ zipAssets = (buildDir, assets, callback) -> tasks.push(zip.bind(this, buildDir, sourcePath, assetName)) async.parallel(tasks, callback) -getAtomDraftRelease = (callback) -> +getAtomDraftRelease = (isPrerelease, callback) -> atomRepo = new GitHub({repo: 'atom/atom', token}) - atomRepo.getReleases (error, releases=[]) -> + atomRepo.getReleases {prerelease: isPrerelease}, (error, releases=[]) -> if error? logError('Fetching atom/atom releases failed', error, releases) callback(error) @@ -142,9 +150,9 @@ getAtomDraftRelease = (callback) -> firstDraft.assets = assets callback(null, firstDraft) else - createAtomDraftRelease(callback) + createAtomDraftRelease(isPrerelease, callback) -createAtomDraftRelease = (callback) -> +createAtomDraftRelease = (isPrerelease, callback) -> {version} = require('../../package.json') options = uri: 'https://api.github.com/repos/atom/atom/releases' @@ -152,6 +160,7 @@ createAtomDraftRelease = (callback) -> headers: defaultHeaders json: tag_name: "v#{version}" + prerelease: isPrerelease name: version draft: true body: """ diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 48b6091c4..2cc148011 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,7 +5,7 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - onBuildMachine = process.env.JANKY_SHA1 and process.env.JANKY_BRANCH is 'master' + onBuildMachine = process.env.JANKY_SHA1 and process.env.JANKY_BRANCH in ['stable', 'beta'] inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if onBuildMachine or not inRepository From e20ad99b04f633f0b624f00e357179d148eb7d35 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Sep 2015 16:38:03 -0700 Subject: [PATCH 19/53] :arrow_up: github-releases --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index a909f8cd4..99dcf1a45 100644 --- a/build/package.json +++ b/build/package.json @@ -11,7 +11,7 @@ "donna": "1.0.10", "formidable": "~1.0.14", "fs-plus": "2.x", - "github-releases": "~0.2.0", + "github-releases": "~0.3.0", "glob": "^5.0.14", "grunt": "~0.4.1", "grunt-babel": "^5.0.1", From 03a8ce69a047b21ae8e67205e37929c78750db8d Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 9 Sep 2015 19:53:45 -0400 Subject: [PATCH 20/53] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5aecf66ce..3426f4f13 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "language-html": "0.41.2", "language-hyperlink": "0.14.0", "language-java": "0.16.0", - "language-javascript": "0.93.0", + "language-javascript": "0.94.0", "language-json": "0.16.0", "language-less": "0.28.2", "language-make": "0.17.0", From 859c3ff965f3933698e06a1c5d431aac6cfec202 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 9 Sep 2015 19:54:02 -0400 Subject: [PATCH 21/53] :arrow_up: language-shellscript@0.17.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3426f4f13..8ef578b1f 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "language-ruby": "0.57.0", "language-ruby-on-rails": "0.22.0", "language-sass": "0.41.0", - "language-shellscript": "0.16.0", + "language-shellscript": "0.17.0", "language-source": "0.9.0", "language-sql": "0.17.0", "language-text": "0.7.0", From 326a03583514b030bcee871ac5bb02fe54b621bc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 10 Sep 2015 16:19:33 +0200 Subject: [PATCH 22/53] :racehorse: Decrease tile size to make finer grained updates --- src/text-editor-presenter.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 7bc4757c0..cf31186a9 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -20,7 +20,7 @@ class TextEditorPresenter @measuredHorizontalScrollbarHeight = horizontalScrollbarHeight @measuredVerticalScrollbarWidth = verticalScrollbarWidth @gutterWidth ?= 0 - @tileSize ?= 12 + @tileSize ?= 6 @disposables = new CompositeDisposable @emitter = new Emitter From 9a431a5c979f9b0b2dbe95119eb66292bb00fbaf Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 10 Sep 2015 18:06:18 +0200 Subject: [PATCH 23/53] :green_heart: --- src/workspace.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/workspace.coffee b/src/workspace.coffee index ee7ccdf49..62fda5aed 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -509,11 +509,11 @@ class Workspace extends Model # # Note that the opener will be called if and only if the URI is not already open # in the current pane. The searchAllPanes flag expands the search from the - # current pane to all panes. If you wish to open a view of a different type for - # a file that is already open, consider changing the protocol of the URI. For - # example, perhaps you wish to preview a rendered version of the file `/foo/bar/baz.quux` - # that is already open in a text editor view. You could signal this by calling - # {Workspace::open} on the URI `quux-preview://foo/bar/baz.quux`. Then your opener + # current pane to all panes. If you wish to open a view of a different type for + # a file that is already open, consider changing the protocol of the URI. For + # example, perhaps you wish to preview a rendered version of the file `/foo/bar/baz.quux` + # that is already open in a text editor view. You could signal this by calling + # {Workspace::open} on the URI `quux-preview://foo/bar/baz.quux`. Then your opener # can check the protocol for quux-preview and only handle those URIs that match. addOpener: (opener) -> if includeDeprecatedAPIs From e1b984820d48e7bd0e76e0be4425c04d221ae4cc Mon Sep 17 00:00:00 2001 From: Indrek Ardel Date: Mon, 7 Sep 2015 21:34:54 +0300 Subject: [PATCH 24/53] Pop scope from the top of scopeStarts directly --- src/token-iterator.coffee | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index 202b044ba..58c598818 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -32,7 +32,14 @@ class TokenIterator tag = tags[@index] if tag < 0 if tag % 2 is 0 - @scopeEnds.push(atom.grammars.scopeForId(tag + 1)) + scopeName = atom.grammars.scopeForId(tag + 1) + if @scopeEnds.length is 0 + @scopeEnds.push(scopeName) + else + startsTop = this.scopeStarts.pop() + if startsTop isnt scopeName + @scopeStarts.push(startsTop) + @scopeEnds.push(scopeName) @scopes.pop() else scope = atom.grammars.scopeForId(tag) From bb11d13fe3337415e323dc9d21ed02c3089ffbd5 Mon Sep 17 00:00:00 2001 From: Indrek Ardel Date: Mon, 7 Sep 2015 23:11:19 +0300 Subject: [PATCH 25/53] Fix typo --- src/token-iterator.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index 58c598818..1d940945d 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -33,7 +33,7 @@ class TokenIterator if tag < 0 if tag % 2 is 0 scopeName = atom.grammars.scopeForId(tag + 1) - if @scopeEnds.length is 0 + if @scopeStarts.length is 0 @scopeEnds.push(scopeName) else startsTop = this.scopeStarts.pop() From 6edd3fde76c7bae866afdd3e168bea1a80ae465f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 8 Sep 2015 10:32:00 -0600 Subject: [PATCH 26/53] Add spec for token iterator regression --- spec/token-iterator-spec.coffee | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 spec/token-iterator-spec.coffee diff --git a/spec/token-iterator-spec.coffee b/spec/token-iterator-spec.coffee new file mode 100644 index 000000000..ee8ac25e5 --- /dev/null +++ b/spec/token-iterator-spec.coffee @@ -0,0 +1,35 @@ +TextBuffer = require 'text-buffer' +TokenizedBuffer = require '../src/tokenized-buffer' + +describe "TokenIterator", -> + it "correctly terminates scopes at the beginning of the line (regression)", -> + grammar = atom.grammars.createGrammar('test', { + 'scopeName': 'text.broken' + 'name': 'Broken grammar' + 'patterns': [ + { + 'begin': 'start' + 'end': '(?=end)' + 'name': 'blue.broken' + } + { + 'match': '.' + 'name': 'yellow.broken' + } + ] + }) + + buffer = new TextBuffer(text: """ + start x + end x + x + """) + tokenizedBuffer = new TokenizedBuffer({buffer}) + tokenizedBuffer.setGrammar(grammar) + + tokenIterator = tokenizedBuffer.tokenizedLineForRow(1).getTokenIterator() + tokenIterator.next() + + expect(tokenIterator.getBufferStart()).toBe 0 + expect(tokenIterator.getScopeEnds()).toEqual [] + expect(tokenIterator.getScopeStarts()).toEqual ['text.broken', 'yellow.broken'] From c1d4f3f1a002f975d882adca60ce9397b2dae9c9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 8 Sep 2015 10:33:22 -0600 Subject: [PATCH 27/53] :art: Only pop from scopeStarts if top of stack matches ending scope --- src/token-iterator.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index 1d940945d..c0aed798a 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -33,13 +33,10 @@ class TokenIterator if tag < 0 if tag % 2 is 0 scopeName = atom.grammars.scopeForId(tag + 1) - if @scopeStarts.length is 0 - @scopeEnds.push(scopeName) + if @scopeStarts[@scopeStarts.length - 1] is scopeName + @scopeStarts.pop() else - startsTop = this.scopeStarts.pop() - if startsTop isnt scopeName - @scopeStarts.push(startsTop) - @scopeEnds.push(scopeName) + @scopeEnds.push() @scopes.pop() else scope = atom.grammars.scopeForId(tag) From eaeed3c892612c2305e61ce6787bd0b5bac3390b Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 8 Sep 2015 10:57:51 -0600 Subject: [PATCH 28/53] :see_no_evil: Actually push scopeName --- src/token-iterator.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index c0aed798a..dc6aceb30 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -36,7 +36,7 @@ class TokenIterator if @scopeStarts[@scopeStarts.length - 1] is scopeName @scopeStarts.pop() else - @scopeEnds.push() + @scopeEnds.push(scopeName) @scopes.pop() else scope = atom.grammars.scopeForId(tag) From c0a4987e660a7a10f7f774af91eca97bcfb530d4 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 10 Sep 2015 10:14:32 -0700 Subject: [PATCH 29/53] :art: --- src/token-iterator.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/token-iterator.coffee b/src/token-iterator.coffee index dc6aceb30..de874d499 100644 --- a/src/token-iterator.coffee +++ b/src/token-iterator.coffee @@ -31,15 +31,14 @@ class TokenIterator while @index < tags.length tag = tags[@index] if tag < 0 + scope = atom.grammars.scopeForId(tag) if tag % 2 is 0 - scopeName = atom.grammars.scopeForId(tag + 1) - if @scopeStarts[@scopeStarts.length - 1] is scopeName + if @scopeStarts[@scopeStarts.length - 1] is scope @scopeStarts.pop() else - @scopeEnds.push(scopeName) + @scopeEnds.push(scope) @scopes.pop() else - scope = atom.grammars.scopeForId(tag) @scopeStarts.push(scope) @scopes.push(scope) @index++ From 66a608dc7c3515a351f4f2430a4ce45a602a33f5 Mon Sep 17 00:00:00 2001 From: simurai Date: Thu, 10 Sep 2015 11:55:50 -0700 Subject: [PATCH 30/53] :arrow_up: language-csharp@v0.10.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ef578b1f..cba5209b9 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "language-c": "0.47.1", "language-clojure": "0.16.0", "language-coffee-script": "0.41.0", - "language-csharp": "0.9.0", + "language-csharp": "0.10.0", "language-css": "0.34.0", "language-gfm": "0.81.0", "language-git": "0.10.0", From 467328b0bad6b8912fce2c297977e351d8f34388 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 10 Sep 2015 17:03:32 -0700 Subject: [PATCH 31/53] :arrow_up: find-and-replace --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cba5209b9..4b002911b 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "dev-live-reload": "0.46.0", "encoding-selector": "0.21.0", "exception-reporting": "0.36.0", - "find-and-replace": "0.180.0", + "find-and-replace": "0.181.0", "fuzzy-finder": "0.88.0", "git-diff": "0.56.0", "go-to-line": "0.30.0", From 16faef2b79802441b9c101b169a04a57928ae93d Mon Sep 17 00:00:00 2001 From: Indrek Ardel Date: Fri, 11 Sep 2015 09:42:09 +0300 Subject: [PATCH 32/53] Fix a typo in Electron URL --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd193026d..19d4367f3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -234,7 +234,7 @@ Please open an issue on `atom/atom` if you have suggestions for new labels, and | `installer` | [search][search-atom-repo-label-installer] | [search][search-atom-org-label-installer] | Related to the Atom installers for different OSes. | | `auto-updater` | [search][search-atom-repo-label-auto-updater] | [search][search-atom-org-label-auto-updater] | Related to the auto-updater for different OSes. | | `deprecation-help` | [search][search-atom-repo-label-deprecation-help] | [search][search-atom-org-label-deprecation-help] | Issues for helping package authors remove usage of deprecated APIs in packages. | -| `electron` | [search][search-atom-repo-label-electron] | [search][search-atom-org-label-electron] | Issues that require changes to [Electron](https://electron.aton.io) to fix or implement. | +| `electron` | [search][search-atom-repo-label-electron] | [search][search-atom-org-label-electron] | Issues that require changes to [Electron](https://electron.atom.io) to fix or implement. | #### Core Team Project Management From ad0ea13942fe2f9a17d89e0a066d169576a677a2 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 3 Sep 2015 13:04:55 -0700 Subject: [PATCH 33/53] Add white-cursor Less mixin for use in dark syntax themes Applies to #1654 --- static/atom.less | 1 + static/white-cursor.less | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 static/white-cursor.less diff --git a/static/atom.less b/static/atom.less index 1acb0f54b..3e8dd181a 100644 --- a/static/atom.less +++ b/static/atom.less @@ -28,3 +28,4 @@ @import "text"; @import "utilities"; @import "octicons"; +@import "white-cursor"; diff --git a/static/white-cursor.less b/static/white-cursor.less new file mode 100644 index 000000000..1c1b95b6d --- /dev/null +++ b/static/white-cursor.less @@ -0,0 +1,6 @@ +@ibeam-1x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII='); +@ibeam-2x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC'); + +.white-cursor-image { + cursor: -webkit-image-set(@ibeam-1x 1x, @ibeam-2x 2x) 5 8, text; +} From 2585e691e0f72ec728a143945796b356dc947ec9 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 4 Sep 2015 16:07:38 +0900 Subject: [PATCH 34/53] Don't output the white-cursor mixin --- static/white-cursor.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/white-cursor.less b/static/white-cursor.less index 1c1b95b6d..91110571f 100644 --- a/static/white-cursor.less +++ b/static/white-cursor.less @@ -1,6 +1,6 @@ @ibeam-1x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII='); @ibeam-2x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC'); -.white-cursor-image { +.white-cursor-image() { cursor: -webkit-image-set(@ibeam-1x 1x, @ibeam-2x 2x) 5 8, text; } From 0ab52b654ebda1c3d01c5dc56fb799be58146070 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 4 Sep 2015 16:08:54 +0900 Subject: [PATCH 35/53] Use white-cursor on dark editors --- static/white-cursor.less | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/static/white-cursor.less b/static/white-cursor.less index 91110571f..1b3a2415d 100644 --- a/static/white-cursor.less +++ b/static/white-cursor.less @@ -4,3 +4,17 @@ .white-cursor-image() { cursor: -webkit-image-set(@ibeam-1x 1x, @ibeam-2x 2x) 5 8, text; } + +// Editors +& when ( lightness(@syntax-background-color) < 50% ) { + .platform-darwin atom-text-editor:not([mini])::shadow .editor-contents--private { + .white-cursor-image(); + } +} + +// Mini Editors +& when ( lightness(@input-background-color) < 50% ) { + .platform-darwin atom-text-editor[mini]::shadow .editor-contents--private { + .white-cursor-image(); + } +} From fd4e0e6e694977c8a351e5b1c5173c002ad3e62c Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 4 Sep 2015 07:59:45 -0700 Subject: [PATCH 36/53] Change name of white cursor mixin --- static/{white-cursor.less => cursors.less} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename static/{white-cursor.less => cursors.less} (92%) diff --git a/static/white-cursor.less b/static/cursors.less similarity index 92% rename from static/white-cursor.less rename to static/cursors.less index 1b3a2415d..7249befee 100644 --- a/static/white-cursor.less +++ b/static/cursors.less @@ -1,20 +1,20 @@ @ibeam-1x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII='); @ibeam-2x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC'); -.white-cursor-image() { +.cursor-white() { cursor: -webkit-image-set(@ibeam-1x 1x, @ibeam-2x 2x) 5 8, text; } // Editors & when ( lightness(@syntax-background-color) < 50% ) { .platform-darwin atom-text-editor:not([mini])::shadow .editor-contents--private { - .white-cursor-image(); + .cursor-white(); } } // Mini Editors & when ( lightness(@input-background-color) < 50% ) { .platform-darwin atom-text-editor[mini]::shadow .editor-contents--private { - .white-cursor-image(); + .cursor-white(); } } From 0e1cca6a4d613fbc5d8c94acbee70780e5dc3f28 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 4 Sep 2015 08:03:30 -0700 Subject: [PATCH 37/53] Update import file for new cursor file name --- static/atom.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/atom.less b/static/atom.less index 3e8dd181a..c2c91dac7 100644 --- a/static/atom.less +++ b/static/atom.less @@ -28,4 +28,4 @@ @import "text"; @import "utilities"; @import "octicons"; -@import "white-cursor"; +@import "cursorsr"; From ad952814ac948be48bacd2014870a44ed3b7df5f Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Tue, 8 Sep 2015 12:21:26 -0700 Subject: [PATCH 38/53] Fix bad import name --- static/atom.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/atom.less b/static/atom.less index c2c91dac7..7a2384514 100644 --- a/static/atom.less +++ b/static/atom.less @@ -28,4 +28,4 @@ @import "text"; @import "utilities"; @import "octicons"; -@import "cursorsr"; +@import "cursors"; From 0c623401d63bc179ab4898ae59cdb1b553991817 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Sat, 12 Sep 2015 03:48:04 -0700 Subject: [PATCH 39/53] Add imports to prevent build failure --- static/cursors.less | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/cursors.less b/static/cursors.less index 7249befee..b2807217e 100644 --- a/static/cursors.less +++ b/static/cursors.less @@ -1,3 +1,9 @@ +@import "./variables/syntax-variables"; +@import "syntax-variables"; + +@import "./variables/ui-variables"; +@import "ui-variables"; + @ibeam-1x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAL0lEQVQoz2NgCD3x//9/BhBYBWdhgFVAiVW4JBFKGIa4AqD0//9D3pt4I4tAdAMAHTQ/j5Zom30AAAAASUVORK5CYII='); @ibeam-2x: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAQAAADZc7J/AAAAz0lEQVRIx2NgYGBY/R8I/vx5eelX3n82IJ9FxGf6tksvf/8FiTMQAcAGQMDvSwu09abffY8QYSAScNk45G198eX//yev73/4///701eh//kZSARckrNBRvz//+8+6ZohwCzjGNjdgQxkAg7B9WADeBjIBqtJCbhRA0YNoIkBSNmaPEMoNmA0FkYNoFKhapJ6FGyAH3nauaSmPfwI0v/3OukVi0CIZ+F25KrtYcx/CTIy0e+rC7R1Z4KMICVTQQ14feVXIbR695u14+Ir4gwAAD49E54wc1kWAAAAAElFTkSuQmCC'); From de0b61393c884aa1729b71e9d3a720dc35323c85 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 14 Sep 2015 10:41:59 +0200 Subject: [PATCH 40/53] Minimize allocations --- src/line-numbers-tile-component.coffee | 26 +++++++++----------------- src/lines-tile-component.coffee | 25 ++++++++++--------------- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/src/line-numbers-tile-component.coffee b/src/line-numbers-tile-component.coffee index 330779999..f00c968fc 100644 --- a/src/line-numbers-tile-component.coffee +++ b/src/line-numbers-tile-component.coffee @@ -8,7 +8,6 @@ class LineNumbersTileComponent constructor: ({@id}) -> @lineNumberNodesById = {} - @lineNumberIdsByScreenRow = {} @domNode = document.createElement("div") @domNode.style.position = "absolute" @domNode.style.display = "block" @@ -63,7 +62,6 @@ class LineNumbersTileComponent unless @newTileState.lineNumbers.hasOwnProperty(id) @lineNumberNodesById[id].remove() delete @lineNumberNodesById[id] - delete @lineNumberIdsByScreenRow[lineNumberState.screenRow] delete @oldTileState.lineNumbers[id] for id, lineNumberState of @newTileState.lineNumbers @@ -74,30 +72,24 @@ class LineNumbersTileComponent newLineNumbersHTML ?= "" newLineNumberIds.push(id) newLineNumbersHTML += @buildLineNumberHTML(lineNumberState) - @lineNumberIdsByScreenRow[lineNumberState.screenRow] = id @oldTileState.lineNumbers[id] = _.clone(lineNumberState) return unless newLineNumberIds? WrapperDiv.innerHTML = newLineNumbersHTML newLineNumberNodes = _.toArray(WrapperDiv.children) - @insertNodes(newLineNumberNodes) - insertNodes: (lineNumberNodes) -> - lineNumberNodes = _.sortBy(lineNumberNodes, @screenRowForNode) - while newNode = lineNumberNodes.shift() - id = @lineNumberIdsByScreenRow[newNode.dataset.screenRow] - - domNodes = _.toArray(@domNode.children) - while nextNode = domNodes.shift() - break if @screenRowForNode(newNode) < @screenRowForNode(nextNode) - - if nextNode? - @domNode.insertBefore(newNode, nextNode) + for id, i in newLineNumberIds + lineNumberNode = newLineNumberNodes[i] + @lineNumberNodesById[id] = lineNumberNode + if nextNode = @findNodeNextTo(lineNumberNode) + @domNode.insertBefore(lineNumberNode, nextNode) else - @domNode.appendChild(newNode) + @domNode.appendChild(lineNumberNode) - @lineNumberNodesById[id] = newNode + findNodeNextTo: (node) -> + for nextNode in @domNode.children + return nextNode if @screenRowForNode(node) < @screenRowForNode(nextNode) return screenRowForNode: (node) -> parseInt(node.dataset.screenRow) diff --git a/src/lines-tile-component.coffee b/src/lines-tile-component.coffee index 66aacf569..7f6de6397 100644 --- a/src/lines-tile-component.coffee +++ b/src/lines-tile-component.coffee @@ -106,23 +106,18 @@ class LinesTileComponent WrapperDiv.innerHTML = newLinesHTML newLineNodes = _.toArray(WrapperDiv.children) - @insertLineNodes(newLineNodes) - - insertLineNodes: (lineNodes) -> - lineNodes = _.sortBy(lineNodes, @screenRowForNode) - while newNode = lineNodes.shift() - id = @lineIdsByScreenRow[newNode.dataset.screenRow] - - domNodes = _.rest(@domNode.children) # skips highlights node - while nextNode = domNodes.shift() - break if @screenRowForNode(newNode) < @screenRowForNode(nextNode) - - if nextNode? - @domNode.insertBefore(newNode, nextNode) + for id, i in newLineIds + lineNode = newLineNodes[i] + @lineNodesByLineId[id] = lineNode + if nextNode = @findNodeNextTo(lineNode) + @domNode.insertBefore(lineNode, nextNode) else - @domNode.appendChild(newNode) + @domNode.appendChild(lineNode) - @lineNodesByLineId[id] = newNode + findNodeNextTo: (node) -> + for nextNode, index in @domNode.children + continue if index is 0 # skips highlights node + return nextNode if @screenRowForNode(node) < @screenRowForNode(nextNode) return screenRowForNode: (node) -> parseInt(node.dataset.screenRow) From 57a386d8d3ec5ed4ea35ce182b26f740a81d60e7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 14 Sep 2015 09:33:49 -0700 Subject: [PATCH 41/53] :arrow_up: language-perl@0.29 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b002911b..a78806eeb 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "language-make": "0.17.0", "language-mustache": "0.12.0", "language-objective-c": "0.15.0", - "language-perl": "0.28.0", + "language-perl": "0.29.0", "language-php": "0.29.0", "language-property-list": "0.8.0", "language-python": "0.40.0", From 24cd2ccd19149a35a59aa3d61a316e7d5b9d810a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20=C5=BDu=C5=BEak?= Date: Mon, 14 Sep 2015 18:41:29 +0200 Subject: [PATCH 42/53] :arrow_up: language-ruby@0.58.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a78806eeb..1e6f6b8d5 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "language-php": "0.29.0", "language-property-list": "0.8.0", "language-python": "0.40.0", - "language-ruby": "0.57.0", + "language-ruby": "0.58.0", "language-ruby-on-rails": "0.22.0", "language-sass": "0.41.0", "language-shellscript": "0.17.0", From f2890d6a2d8e23190d411b9d47fef978a95577a5 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 14 Sep 2015 13:28:59 -0400 Subject: [PATCH 43/53] :arrow_up: language-php@0.30.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1e6f6b8d5..990fc3592 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-mustache": "0.12.0", "language-objective-c": "0.15.0", "language-perl": "0.29.0", - "language-php": "0.29.0", + "language-php": "0.30.0", "language-property-list": "0.8.0", "language-python": "0.40.0", "language-ruby": "0.58.0", From 7675e6fb2d2bd9c659331a69c8028011e91e90be Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Sep 2015 17:44:40 -0700 Subject: [PATCH 44/53] Avoid using dash in RPM version number --- build/tasks/mkrpm-task.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/tasks/mkrpm-task.coffee b/build/tasks/mkrpm-task.coffee index 5744343a5..6061a1db2 100644 --- a/build/tasks/mkrpm-task.coffee +++ b/build/tasks/mkrpm-task.coffee @@ -24,6 +24,12 @@ module.exports = (grunt) -> return done("Unsupported arch #{process.arch}") {name, version, description} = grunt.file.readJSON('package.json') + + # RPM versions can't have dashes in them. + # * http://www.rpm.org/max-rpm/ch-rpm-file-format.html + # * https://github.com/mojombo/semver/issues/145 + version = version.replace(/-beta$/, "~beta") + buildDir = grunt.config.get('atom.buildDir') rpmDir = path.join(buildDir, 'rpm') From 76866716c5bb0771d44df2425b952a62a880ed1c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Sep 2015 17:09:33 -0700 Subject: [PATCH 45/53] Add -beta to version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5aecf66ce..3931b1704 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.0.12", + "version": "1.0.12-beta", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 36f705322813979bbe066075c5829a0957de7698 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 10 Sep 2015 17:32:16 -0700 Subject: [PATCH 46/53] :arrow_up: grunt-electron-installer (prerelease) --- build/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index 99dcf1a45..1ed151e1f 100644 --- a/build/package.json +++ b/build/package.json @@ -22,7 +22,7 @@ "grunt-contrib-less": "~0.8.0", "grunt-cson": "0.15.0", "grunt-download-electron": "^2.1.1", - "grunt-electron-installer": "1.0.0", + "grunt-electron-installer": "1.0.3-0", "grunt-lesslint": "0.17.0", "grunt-peg": "~1.1.0", "grunt-shell": "~0.3.1", From 71058890cf97514b4e91f372b5c78d617b0dc565 Mon Sep 17 00:00:00 2001 From: Wliu Date: Mon, 14 Sep 2015 18:40:21 -0400 Subject: [PATCH 47/53] :memo: Github for Windows --> Github Desktop --- docs/build-instructions/windows.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index 76ea7a025..d89033c82 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -14,19 +14,19 @@ If it is installed elsewhere, you can create a symbolic link to the directory containing the python.exe using: `mklink /d %SystemDrive%\Python27 D:\elsewhere\Python27` - * [GitHub for Windows](http://windows.github.com/) + * [GitHub Desktop](http://desktop.github.com/) ### On Windows 8 or 10 * [Visual Studio Express 2013 or 2015 for Windows Desktop](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_2) * [node.js](http://nodejs.org/download/) (0.10.x or 0.12.x) or [io.js](https://iojs.org) (1.x or 2.x) * [Python](https://www.python.org/downloads/) v2.7.x (required by [node-gyp](https://github.com/TooTallNate/node-gyp)) - * [GitHub for Windows](http://windows.github.com/) + * [GitHub Desktop](http://desktop.github.com/) ## Instructions ```bash -# Use the `Git Shell` program which was installed by GitHub for Windows. -# Also make sure that you are logged into GitHub for Windows. +# Use the `Git Shell` program which was installed by GitHub Desktop. +# Also make sure that you are logged into GitHub Desktop. cd C:\ git clone https://github.com/atom/atom/ cd atom @@ -40,15 +40,14 @@ We will assume the git shell for these instructions. * `--build-dir` - Build the application in this directory. * `--verbose` - Verbose mode. A lot more information output. -## Why do I have to use GitHub for Windows? +## Why do I have to use GitHub Desktop? -You don't. You can use your existing Git! GitHub for Windows's Git Shell is just -easier to set up. +You don't. You can use your existing Git! GitHub Desktop's Git Shell is just easier to set up. If you _prefer_ using your existing Git installation, make sure git's cmd directory is in your PATH env variable (e.g. `C:\Program Files (x86)\Git\cmd`) before you open your powershell or command window. Note that you may have to open your command window as administrator. For powershell that doesn't seem to always be the case, though. -If none of this works, do install Github for Windows and use its Git shell. Makes life easier. +If none of this works, do install Github Desktop and use its Git shell. Makes life easier. ## Troubleshooting @@ -59,7 +58,6 @@ If none of this works, do install Github for Windows and use its Git shell. Make * If you just installed node, you'll need to restart your computer before node is available on your Path. - * `script/build` outputs only the Node and Python versions before returning * Try moving the repository to `C:\atom`. Most likely, the path is too long. @@ -73,7 +71,7 @@ If none of this works, do install Github for Windows and use its Git shell. Make * https://github.com/TooTallNate/node-gyp/issues/297 * https://code.google.com/p/gyp/issues/detail?id=393 -* `script/build` stops at installing runas with 'Failed at the runas@0.5.4 install script.' +* `script/build` stops at installing runas with 'Failed at the runas@x.y.z install script.' See the next item. From 27cc9cdff3521d5fd5b1725f8e354a2df91117b1 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Sep 2015 16:29:20 -0700 Subject: [PATCH 48/53] 1.0.12-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9e82a4530..9c3341694 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.0.12-beta", + "version": "1.0.12-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 321bf690d214d229b132a4bc03c2f249aa670340 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Sep 2015 16:47:09 -0700 Subject: [PATCH 49/53] Handle '-dev' suffix when building RPM package --- build/tasks/mkrpm-task.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/build/tasks/mkrpm-task.coffee b/build/tasks/mkrpm-task.coffee index 6061a1db2..c11e62f69 100644 --- a/build/tasks/mkrpm-task.coffee +++ b/build/tasks/mkrpm-task.coffee @@ -29,6 +29,7 @@ module.exports = (grunt) -> # * http://www.rpm.org/max-rpm/ch-rpm-file-format.html # * https://github.com/mojombo/semver/issues/145 version = version.replace(/-beta$/, "~beta") + version = version.replace(/-dev$/, "~dev") buildDir = grunt.config.get('atom.buildDir') From 0143b133fedda386101ac070f7c4986b07f281c8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Sep 2015 16:54:27 -0700 Subject: [PATCH 50/53] Add railcar script --- script/railcar | 102 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 script/railcar diff --git a/script/railcar b/script/railcar new file mode 100755 index 000000000..e97360fe4 --- /dev/null +++ b/script/railcar @@ -0,0 +1,102 @@ +#!/usr/bin/env node + +var fs = require('fs') +var exec = require('child_process').exec +var async = require('../build/node_modules/async') + +var branchName, leadingBranchName + +async.series([ + parseArguments, + checkCleanWorkingTree, + checkoutBranch, + pullUpstreamChanges, + mergeLeadingBranch, + fetchUpstreamTags, + updateVersionNumber, + pushLocalChanges, + pushLocalTags, +], finish) + +function parseArguments(next) { + branchName = process.argv[2] + switch (branchName) { + case 'beta': + leadingBranchName = 'master' + break + case 'stable': + leadingBranchName = 'beta' + break + default: + return next(new Error('Usage: script/railcar ')) + } + next() +} + +function checkCleanWorkingTree(next) { + console.log('Checking for a clean working tree'); + exec('git status --porcelain', function(error, output) { + var modifiedEntries = output.split('\n').filter(function(line) { + return !/^\?\?/.test(line) && line.length > 0 + }); + + next( + modifiedEntries.length === 0 ? + null : + new Error('Cannot run the railcars with a dirty working tree') + ) + }) +} + +function checkoutBranch(next) { + console.log('Checking out ' + branchName); + exec('git checkout ' + branchName, next) +} + +function pullUpstreamChanges(next) { + console.log('Pulling upstream changes on ' + branchName); + exec('git pull --ff-only origin ' + branchName, next) +} + +function mergeLeadingBranch(next) { + console.log('Merging new changes from ' + leadingBranchName); + exec('git pull --ff-only origin ' + leadingBranchName, next) +} + +function fetchUpstreamTags(next) { + console.log('Fetching upstream tags'); + exec('git fetch --tags', next) +} + +function updateVersionNumber(next) { + var newVersion + if (branchName === 'beta') { + newVersion = require('../package.json') + .version + .replace(/-\w+$/, '-beta-0') + } else { + newVersion = 'patch' + } + + console.log('Updating version to ' + newVersion); + exec('npm version ' + newVersion, next) +} + +function pushLocalChanges(next) { + console.log('Pushing local changes'); + exec('git push origin ' + branchName, next) +} + +function pushLocalTags(next) { + console.log('Pushing local tags'); + exec('git push --tags origin', next) +} + +function finish(error) { + if (error) { + console.log('Error: ' + error.message) + process.exit(1) + } + + console.log('Success! Now just wait for all CI builds to pass on ' + branchName) +} From 01a73e3ad3a2bd71cd1baf8091829c1fbabb9950 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Sep 2015 17:34:41 -0700 Subject: [PATCH 51/53] Handle errors from 'git status' --- script/railcar | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/railcar b/script/railcar index e97360fe4..151c84154 100755 --- a/script/railcar +++ b/script/railcar @@ -36,6 +36,8 @@ function parseArguments(next) { function checkCleanWorkingTree(next) { console.log('Checking for a clean working tree'); exec('git status --porcelain', function(error, output) { + if (error) return next(error) + var modifiedEntries = output.split('\n').filter(function(line) { return !/^\?\?/.test(line) && line.length > 0 }); From 6bfa467a154f3c1e33b3bd11932da74e1e31aa70 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 14 Sep 2015 17:34:47 -0700 Subject: [PATCH 52/53] Remove unused require --- script/railcar | 1 - 1 file changed, 1 deletion(-) diff --git a/script/railcar b/script/railcar index 151c84154..2d98d2c68 100755 --- a/script/railcar +++ b/script/railcar @@ -1,6 +1,5 @@ #!/usr/bin/env node -var fs = require('fs') var exec = require('child_process').exec var async = require('../build/node_modules/async') From a9845e3d7f2646a734864470b565bca686bc4c8a Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 15 Sep 2015 10:45:02 -0700 Subject: [PATCH 53/53] Script stable and beta releases together --- script/railcar | 146 ++++++++++++++++++++++--------------------------- 1 file changed, 66 insertions(+), 80 deletions(-) diff --git a/script/railcar b/script/railcar index 2d98d2c68..fa3fca2cb 100755 --- a/script/railcar +++ b/script/railcar @@ -1,103 +1,89 @@ #!/usr/bin/env node +var fs = require('fs') var exec = require('child_process').exec -var async = require('../build/node_modules/async') +var series = require('async').series +var semver = require('semver') -var branchName, leadingBranchName - -async.series([ - parseArguments, +series([ + section('Preparing to roll the railcars'), checkCleanWorkingTree, - checkoutBranch, - pullUpstreamChanges, - mergeLeadingBranch, - fetchUpstreamTags, - updateVersionNumber, - pushLocalChanges, - pushLocalTags, + run('git fetch origin master:master beta:beta stable:stable'), + run('git fetch origin --tags'), + + section('Updating stable branch'), + run('git checkout stable'), + run('git merge --ff-only origin/stable'), + run('git merge --ff-only origin/beta'), + bumpStableVersion, + + section('Updating beta branch'), + run('git checkout beta'), + run('git merge --ff-only origin/beta'), + run('git merge --ff-only origin/master'), + run('git merge --strategy ours origin/stable'), + bumpBetaVersion, + + section('Updating master branch'), + run('git checkout master'), + run('git merge --ff-only origin/master'), + run('git merge --strategy ours origin/beta'), + bumpDevVersion, + + section('Pushing changes upstream'), + run('git push origin master:master beta:beta stable:stable'), + run('git push origin --tags') ], finish) -function parseArguments(next) { - branchName = process.argv[2] - switch (branchName) { - case 'beta': - leadingBranchName = 'master' - break - case 'stable': - leadingBranchName = 'beta' - break - default: - return next(new Error('Usage: script/railcar ')) - } - next() -} - -function checkCleanWorkingTree(next) { - console.log('Checking for a clean working tree'); - exec('git status --porcelain', function(error, output) { +function checkCleanWorkingTree (next) { + run('git status --porcelain')(function (error, output) { if (error) return next(error) - - var modifiedEntries = output.split('\n').filter(function(line) { - return !/^\?\?/.test(line) && line.length > 0 - }); - - next( - modifiedEntries.length === 0 ? - null : - new Error('Cannot run the railcars with a dirty working tree') - ) + if (output.trim().length > 0) return next(new Error('Cannot run the railcars with a dirty working tree')) + next() }) } -function checkoutBranch(next) { - console.log('Checking out ' + branchName); - exec('git checkout ' + branchName, next) +function bumpStableVersion (next) { + run('npm version patch')(next) } -function pullUpstreamChanges(next) { - console.log('Pulling upstream changes on ' + branchName); - exec('git pull --ff-only origin ' + branchName, next) +function bumpBetaVersion (next) { + var newVersion = semver.inc(getCurrentVersion(), 'prerelease', 'beta') + run('npm version ' + newVersion)(next) } -function mergeLeadingBranch(next) { - console.log('Merging new changes from ' + leadingBranchName); - exec('git pull --ff-only origin ' + leadingBranchName, next) +function bumpDevVersion (next) { + var newVersion = semver.inc(getCurrentVersion(), 'preminor', 'dev') + series([ + run('npm --no-git-tag-version version ' + newVersion), + run('git commit -am "' + newVersion + '"') + ], next) } -function fetchUpstreamTags(next) { - console.log('Fetching upstream tags'); - exec('git fetch --tags', next) -} - -function updateVersionNumber(next) { - var newVersion - if (branchName === 'beta') { - newVersion = require('../package.json') - .version - .replace(/-\w+$/, '-beta-0') - } else { - newVersion = 'patch' - } - - console.log('Updating version to ' + newVersion); - exec('npm version ' + newVersion, next) -} - -function pushLocalChanges(next) { - console.log('Pushing local changes'); - exec('git push origin ' + branchName, next) -} - -function pushLocalTags(next) { - console.log('Pushing local tags'); - exec('git push --tags origin', next) -} - -function finish(error) { +function finish (error) { if (error) { console.log('Error: ' + error.message) process.exit(1) } - console.log('Success! Now just wait for all CI builds to pass on ' + branchName) + console.log('OK, now just wait for all CI builds to pass on beta and stable') +} + +function getCurrentVersion () { + return JSON.parse(fs.readFileSync(require.resolve('../package.json'))).version +} + +function run (command) { + return function (next) { + console.log('>', command) + exec(command, next) + } +} + +function section (message) { + return function (next) { + console.log() + console.log(message) + next() + } }