From 1cb5d16a6076a6db41ba64a0e77140348ae323f4 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 4 Nov 2013 17:19:09 -0800 Subject: [PATCH 01/24] Style messages --- static/atom.less | 1 + static/messages.less | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 static/messages.less diff --git a/static/atom.less b/static/atom.less index 86edd5b83..943a8e022 100644 --- a/static/atom.less +++ b/static/atom.less @@ -15,6 +15,7 @@ @import "lists"; @import "popover-list"; @import "notification"; +@import "messages"; @import "markdown"; @import "editor"; @import "select-list"; diff --git a/static/messages.less b/static/messages.less new file mode 100644 index 000000000..61d19aeb4 --- /dev/null +++ b/static/messages.less @@ -0,0 +1,12 @@ +@import "ui-variables"; + +.info-messages, +.error-messages { + margin: 0; + padding: 0; + list-style: none; +} + +.error-messages { + color: @text-color-error; +} From 287f1984db7c4bf614f5b53683498860f6ed3a12 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Nov 2013 17:38:13 -0800 Subject: [PATCH 02/24] Update width in chars when editor's size changes Register an overflowchanged event listener on the editor's scroll view and update the width in chars when this event fires. Closes #928 Closes #961 Closes #993 --- spec/editor-spec.coffee | 14 ++++++++++++++ src/display-buffer.coffee | 4 +++- src/editor.coffee | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 18bde3bfa..72f85dc46 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -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) diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index f516f6805..8d6f71e63 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -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') diff --git a/src/editor.coffee b/src/editor.coffee index e657781dc..faf4a8aaa 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -704,6 +704,13 @@ 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()), 1) + @scrollView.on 'overflowchanged', => + updateWidthInChars() if @[0].classList.contains('soft-wrap') + handleInputEvents: -> @on 'cursor:moved', => return unless @isFocused From d20bff473bf8791e0eeae7c2e68ec2dd558c993e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Nov 2013 18:38:08 -0800 Subject: [PATCH 03/24] Increase overflowchanged timeout to 100ms --- src/editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index faf4a8aaa..9742d75f1 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -707,7 +707,7 @@ class Editor extends View # Listen for overflow events to detect when the editor's width changes # to update the soft wrap column. - updateWidthInChars = _.debounce((=> @setWidthInChars()), 1) + updateWidthInChars = _.debounce((=> @setWidthInChars()), 100) @scrollView.on 'overflowchanged', => updateWidthInChars() if @[0].classList.contains('soft-wrap') From aad23d4760da5f385b45e76b482a8d2f7c6f3578 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 4 Nov 2013 18:39:59 -0800 Subject: [PATCH 04/24] :lipstick: Remove extra empty line --- src/editor.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index 9742d75f1..538da45da 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -704,7 +704,6 @@ 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) From c59404b2b02eec49db26d21bd0dad5b047245245 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 10:43:41 -0800 Subject: [PATCH 05/24] Upgrade to tree-view@0.27.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a23576549..cb4e72a21 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "terminal": "0.15.0", "timecop": "0.9.0", "to-the-hubs": "0.8.0", - "tree-view": "0.26.0", + "tree-view": "0.27.0", "visual-bell": "0.3.0", "whitespace": "0.8.0", "wrap-guide": "0.4.0", From 8851120db2d6f05323f6abefd501049f1a75046b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 11:25:45 -0800 Subject: [PATCH 06/24] Add split: left handling to openSingletonSync() --- spec/root-view-spec.coffee | 22 ++++++++++++++++++++++ src/root-view.coffee | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/spec/root-view-spec.coffee b/spec/root-view-spec.coffee index 4f0180ef2..0d2daf3db 100644 --- a/spec/root-view-spec.coffee +++ b/spec/root-view-spec.coffee @@ -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') diff --git a/src/root-view.coffee b/src/root-view.coffee index a0fbccdfd..b482ef6b7 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -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 From 8739dfe739087844de3da875d310b6f575a1c621 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 12:01:02 -0800 Subject: [PATCH 07/24] Update to find-and-replace@0.37.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb4e72a21..7d9c20b6f 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "dev-live-reload": "0.13.0", "editor-stats": "0.5.0", "exception-reporting": "0.5.0", - "find-and-replace": "0.36.0", + "find-and-replace": "0.37.0", "fuzzy-finder": "0.19.0", "gists": "0.6.0", "git-diff": "0.13.0", From da2d37408f80857e15ecb45f876da94f77afa351 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 12:37:03 -0800 Subject: [PATCH 08/24] Upgrade to tree-view@0.28.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d9c20b6f..aadbd78ff 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "terminal": "0.15.0", "timecop": "0.9.0", "to-the-hubs": "0.8.0", - "tree-view": "0.27.0", + "tree-view": "0.28.0", "visual-bell": "0.3.0", "whitespace": "0.8.0", "wrap-guide": "0.4.0", From b9b9b7df91ddedd5b2012a30ebcbc1de26b18ac7 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 15:16:00 -0800 Subject: [PATCH 09/24] Upgradt to find-and-replace@0.38.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aadbd78ff..ec2a536f7 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "dev-live-reload": "0.13.0", "editor-stats": "0.5.0", "exception-reporting": "0.5.0", - "find-and-replace": "0.37.0", + "find-and-replace": "0.38.0", "fuzzy-finder": "0.19.0", "gists": "0.6.0", "git-diff": "0.13.0", From 3db786953cd29ab693a3b75639925e17098895da Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 15:17:45 -0800 Subject: [PATCH 10/24] Upgrade to atom-dark-syntax@0.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec2a536f7..5c2ca03a9 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "atom-light-ui": "0.6.0", "atom-light-syntax": "0.5.0", "atom-dark-ui": "0.5.0", - "atom-dark-syntax": "0.5.0", + "atom-dark-syntax": "0.6.0", "base16-tomorrow-dark-theme": "0.2.0", "solarized-dark-syntax": "0.3.0", From 103f602c9c62f9e8304d48206a7398ed9ab8f4c9 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 17:02:35 -0800 Subject: [PATCH 11/24] Upgrade dev-live-reload@0.14.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c2ca03a9..27e947969 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "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.38.0", From 08ee9c08b7375189f9cc941a2438ba14993e3c3e Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 17:08:17 -0800 Subject: [PATCH 12/24] Upgrade to atom-light-syntax@0.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 27e947969..6ce03055d 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ }, "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.6.0", "base16-tomorrow-dark-theme": "0.2.0", From 5a2730c8c002fc0000ddb6fa380cf785bbf0471f Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 17:23:45 -0800 Subject: [PATCH 13/24] Upgrade to solarized-dark-syntax@0.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ce03055d..b71cc6928 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "atom-dark-ui": "0.5.0", "atom-dark-syntax": "0.6.0", "base16-tomorrow-dark-theme": "0.2.0", - "solarized-dark-syntax": "0.3.0", + "solarized-dark-syntax": "0.4.0", "archive-view": "0.11.0", "autocomplete": "0.11.0", From 740085e56182f8bc9c93504b7d9f42a0a9435453 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 17:34:00 -0800 Subject: [PATCH 14/24] Upgrade base16-tomorrow-dark-theme@0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b71cc6928..a6bd6e3b1 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "atom-light-syntax": "0.6.0", "atom-dark-ui": "0.5.0", "atom-dark-syntax": "0.6.0", - "base16-tomorrow-dark-theme": "0.2.0", + "base16-tomorrow-dark-theme": "0.3.0", "solarized-dark-syntax": "0.4.0", "archive-view": "0.11.0", From 4dda2f93ae82f88f0708da6bfc32d2755f89e62e Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Tue, 5 Nov 2013 17:48:22 -0800 Subject: [PATCH 15/24] Upgrade to base16-tomorrow-dark-theme@0.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a6bd6e3b1..3481a79d4 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "atom-light-syntax": "0.6.0", "atom-dark-ui": "0.5.0", "atom-dark-syntax": "0.6.0", - "base16-tomorrow-dark-theme": "0.3.0", + "base16-tomorrow-dark-theme": "0.4.0", "solarized-dark-syntax": "0.4.0", "archive-view": "0.11.0", From 36c9d68009bfb9a8f515890849f084a5d5f62531 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 5 Nov 2013 16:21:40 -0800 Subject: [PATCH 16/24] Update to telepath@0.21.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3481a79d4..f9b69ceab 100644 --- a/package.json +++ b/package.json @@ -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" }, From 867a6ecd95d665fcf4de7f6027a1b8e51f874baa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 5 Nov 2013 16:22:03 -0800 Subject: [PATCH 17/24] Reenable insertNewlineBelow() specs --- spec/edit-session-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/edit-session-spec.coffee b/spec/edit-session-spec.coffee index 9ecb7fed9..019c10da7 100644 --- a/spec/edit-session-spec.coffee +++ b/spec/edit-session-spec.coffee @@ -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,7 +1334,7 @@ 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", -> + it "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", -> editSession.setAutoIndent(true) editSession.insertNewlineBelow() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" From 60fa937ed7e76ebb27dcab6dbcaa8e5a97d513f3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 5 Nov 2013 16:24:22 -0800 Subject: [PATCH 18/24] Add asserts for undoing an insertNewlineAbove --- spec/edit-session-spec.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/edit-session-spec.coffee b/spec/edit-session-spec.coffee index 019c10da7..a15625293 100644 --- a/spec/edit-session-spec.coffee +++ b/spec/edit-session-spec.coffee @@ -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 From 2be5790311fb602903dbad07104980d12168a9ec Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 5 Nov 2013 16:26:59 -0800 Subject: [PATCH 19/24] Set auto indent config setting in spec --- spec/edit-session-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/edit-session-spec.coffee b/spec/edit-session-spec.coffee index a15625293..b66b7d6aa 100644 --- a/spec/edit-session-spec.coffee +++ b/spec/edit-session-spec.coffee @@ -1335,7 +1335,7 @@ describe "EditSession", -> expect(editSession.getCursorBufferPosition()).toEqual [0,2] it "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", -> - editSession.setAutoIndent(true) + config.set("editor.autoIndent", true) editSession.insertNewlineBelow() expect(buffer.lineForRow(0)).toBe "var quicksort = function () {" expect(buffer.lineForRow(1)).toBe " " From efb87237e2006cfd4db1bdc37864c566090e74e1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 5 Nov 2013 16:29:27 -0800 Subject: [PATCH 20/24] Reenable undo, redo, and transaction specs --- spec/edit-session-spec.coffee | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/spec/edit-session-spec.coffee b/spec/edit-session-spec.coffee index b66b7d6aa..bc9cbeca9 100644 --- a/spec/edit-session-spec.coffee +++ b/spec/edit-session-spec.coffee @@ -2065,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() @@ -2113,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() @@ -2136,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", -> @@ -2277,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() From 5033fac8ebd4e32026d2c63d6fb08d862447ae10 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 6 Nov 2013 12:32:19 +0800 Subject: [PATCH 21/24] Update to atom-shell v0.6.8. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9b69ceab..7e591c967 100644 --- a/package.json +++ b/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", From 90c21906a498b214251d9d39b2506362299be1e6 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 6 Nov 2013 09:47:01 -0800 Subject: [PATCH 22/24] Add fold- prefix to selected class name This prevents interference with the base selected class which adds a noticeable blur to folded lines that are selected when using dark syntax and light ui. --- spec/editor-spec.coffee | 6 +++--- src/editor.coffee | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 72f85dc46..30cbcaaa7 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -2133,16 +2133,16 @@ describe "Editor", -> 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') diff --git a/src/editor.coffee b/src/editor.coffee index 538da45da..441fae9d6 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -929,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 @@ -942,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 From 383a724144debaad7dd1852894d6a6f68e391076 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 6 Nov 2013 09:50:06 -0800 Subject: [PATCH 23/24] Update class name to new fold-selected --- spec/editor-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 30cbcaaa7..ed50ee185 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -2145,7 +2145,7 @@ describe "Editor", -> 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 -> From 9f5e9138045582d892f2b950d6f28bc903763ce4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 6 Nov 2013 09:55:53 -0800 Subject: [PATCH 24/24] Update remaining selected class names to fold-selected --- spec/editor-spec.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index ed50ee185..5147a8ec8 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -2110,23 +2110,23 @@ 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])