From 20083b97c60992c0f1b3b48e6525efdd587f408f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 4 Apr 2013 21:18:21 +0800 Subject: [PATCH 1/8] Update node to v0.10.3 --- Rakefile | 2 +- script/bootstrap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 76c5a0c31..4738d367f 100644 --- a/Rakefile +++ b/Rakefile @@ -28,7 +28,7 @@ end desc "Download node binary" task "update-node" do - `script/update-node v0.10.1` + `script/update-node v0.10.3` end desc "Download debug symbols for CEF" diff --git a/script/bootstrap b/script/bootstrap index 4db2c1279..a2898082a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -21,7 +21,7 @@ exit_unless_npm_exists npm install npm --silent NODE_DIR="$HOME/.cefode-gyp" -NODE_VERSION="0.10.1" +NODE_VERSION="0.10.3" NODE_URL="https://gh-contractor-zcbenz.s3.amazonaws.com/cefode2/dist" if [ ! -d "node_modules/node-gyp" ]; then ./node_modules/.bin/npm install node-gyp --silent From 1730444db87cc21005142f3f0ebcfef3c6f30341 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Apr 2013 08:39:09 -0700 Subject: [PATCH 2/8] Use released version of nak --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d2e2541e..c691b0b27 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "coffee-cache": "0.1.0", "pegjs": "0.7.0", "async": "0.2.6", - "nak": "git://github.com/kevinsawicki/nak.git", + "nak": "0.2.12", "spellchecker": "0.2.0", "plist": "git://github.com/nathansobo/node-plist.git", "space-pen": "git://github.com/nathansobo/space-pen.git" From 4683285e0dc0118de36b2e12b99a0b83ef31c224 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Apr 2013 08:57:43 -0700 Subject: [PATCH 3/8] Move opacity to line numbers instead of gutter Having the opacity previously on the .gutter class was making the gutter background color for the current line be different than the editor background color. --- static/editor.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/editor.less b/static/editor.less index c9ab251fa..4ac5cb832 100644 --- a/static/editor.less +++ b/static/editor.less @@ -31,12 +31,12 @@ min-width: 1em; box-sizing: border-box; text-align: right; - opacity: 0.6; } .editor .gutter .line-number { padding-right: .5em; padding-left: .5em; + opacity: 0.6; } .editor .gutter .line-numbers { From 9773751e79165d9a033997460db6a62e8748f475 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Apr 2013 09:25:35 -0700 Subject: [PATCH 4/8] Delete left when meta-backspacing at start of line Previously EditSession.backspaceToBeginningOfLine() would do nothing if at the beginning of the line. Now it selects left and does a delete so it can be used to delete multiple lines continuously without having to move the cursor. Refs #134 --- spec/app/edit-session-spec.coffee | 8 +++++--- src/app/selection.coffee | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 06a0a047c..523564cc4 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -1283,9 +1283,11 @@ describe "EditSession", -> expect(cursor1.getBufferPosition()).toEqual [1, 0] expect(cursor2.getBufferPosition()).toEqual [2, 0] - editSession.backspaceToBeginningOfLine() - expect(buffer.lineForRow(1)).toBe 'ems) {' - expect(cursor1.getBufferPosition()).toEqual [1, 0] + describe "when at the beginning of the line", -> + it "deletes the newline", -> + editSession.setCursorBufferPosition([2]) + editSession.backspaceToBeginningOfLine() + expect(buffer.lineForRow(1)).toBe ' var sort = function(items) { if (items.length <= 1) return items;' describe "when text is selected", -> it "still deletes all text to begginning of the line", -> diff --git a/src/app/selection.coffee b/src/app/selection.coffee index 9be2f7f97..b4ed0f293 100644 --- a/src/app/selection.coffee +++ b/src/app/selection.coffee @@ -243,7 +243,10 @@ class Selection @deleteSelectedText() backspaceToBeginningOfLine: -> - @selectToBeginningOfLine() + if @isEmpty() and @cursor.isAtBeginningOfLine() + @selectLeft() + else + @selectToBeginningOfLine() @deleteSelectedText() delete: -> From bd4013327729591d5d70c50d0980805916e22bc0 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Apr 2013 09:57:27 -0700 Subject: [PATCH 5/8] Remove note that is now issue #479 --- notes/kyles-little-things.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 notes/kyles-little-things.md diff --git a/notes/kyles-little-things.md b/notes/kyles-little-things.md deleted file mode 100644 index 2f8f21efd..000000000 --- a/notes/kyles-little-things.md +++ /dev/null @@ -1,6 +0,0 @@ -## The Little Things™ -I recently switched over to Sublime Text 2 and for the most part it's been pretty awesome. But I've been noticing a lot of little things that I really appreciate in an editor, so I thought I'd note them down. - -1. Indenting soft-wrapped lines http://share.kyleneath.com/captures/_upsell.html.erb-20120127-231402.png -2. Respecting Chrome-like tab behavior (drag between windows/panes, `⌘+Shift+T` to get last closed tab back, `⌘+N` for a new tab in your current pane) -3. Indent markers http://share.kyleneath.com/captures/billing_dependency.rb-20120127-232754.png From 725e0d778a8fa848b265f0ef874dbe2f81a3e45a Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 4 Apr 2013 09:53:11 -0700 Subject: [PATCH 6/8] Remove notes directory --- notes/file-modification | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 notes/file-modification diff --git a/notes/file-modification b/notes/file-modification deleted file mode 100644 index a3df1c0be..000000000 --- a/notes/file-modification +++ /dev/null @@ -1,18 +0,0 @@ -Buffers - modify - - if dirty alert user (immediately if focused, or on next focus) - - if clean update contents - - remove - - mark file as unsaved (but maintains previous path) - - only unsubscribe from KQueue - - attempt to resubscribe after timeout (because of git weirdness) - - move file - - update path - - move ancestor directory - - update path on focus and save - - recreated after remove (at same path) - - resubscribe on focus or save \ No newline at end of file From 44d78ed30d516a3145331b8127afc5b6be0f10d3 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 4 Apr 2013 10:03:21 -0700 Subject: [PATCH 7/8] move files int tools/mac to scripts dir --- atom.gyp | 2 +- {tools/mac => script}/change_mach_o_flags.py | 0 {tools/mac => script}/make_more_helpers.sh | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {tools/mac => script}/change_mach_o_flags.py (100%) rename {tools/mac => script}/make_more_helpers.sh (100%) diff --git a/atom.gyp b/atom.gyp index ea825f03c..c586fc011 100644 --- a/atom.gyp +++ b/atom.gyp @@ -175,7 +175,7 @@ # is marked for no PIE (ASLR). 'postbuild_name': 'Make More Helpers', 'action': [ - 'tools/mac/make_more_helpers.sh', + 'script/make_more_helpers.sh', 'Frameworks', 'Atom', ], diff --git a/tools/mac/change_mach_o_flags.py b/script/change_mach_o_flags.py similarity index 100% rename from tools/mac/change_mach_o_flags.py rename to script/change_mach_o_flags.py diff --git a/tools/mac/make_more_helpers.sh b/script/make_more_helpers.sh similarity index 100% rename from tools/mac/make_more_helpers.sh rename to script/make_more_helpers.sh From e442dfff11eeb5d641cf0ba6ee73d08290be4939 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 4 Apr 2013 11:05:11 -0700 Subject: [PATCH 8/8] Support joining editor lines with ctrl-J This can be used with or without a selection to join one or more lines with the line below it separated by a space. Refs #134 --- spec/app/edit-session-spec.coffee | 37 +++++++++++++++++++++++++++++++ src/app/edit-session.coffee | 3 +++ src/app/editor.coffee | 2 ++ src/app/keymaps/editor.cson | 1 + src/app/selection.coffee | 25 +++++++++++++++++++++ 5 files changed, 68 insertions(+) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 523564cc4..bd4537617 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -2159,3 +2159,40 @@ describe "EditSession", -> expect(buffer.getMarkerCount()).toBeGreaterThan 0 editSession.destroy() expect(buffer.getMarkerCount()).toBe 0 + + describe ".joinLine()", -> + describe "when no text is selected", -> + describe "when the line below isn't empty", -> + it "joins the line below with the current line separated by a space and moves the cursor to the start of line that was moved up", -> + editSession.joinLine() + expect(editSession.lineForBufferRow(0)).toBe 'var quicksort = function () { var sort = function(items) {' + expect(editSession.getCursorBufferPosition()).toEqual [0, 30] + + describe "when the line below is empty", -> + it "deletes the line below and moves the cursor to the end of the line", -> + editSession.setCursorBufferPosition([9]) + editSession.joinLine() + expect(editSession.lineForBufferRow(9)).toBe ' };' + expect(editSession.lineForBufferRow(10)).toBe ' return sort(Array.apply(this, arguments));' + expect(editSession.getCursorBufferPosition()).toEqual [9, 4] + + describe "when the cursor is on the last row", -> + it "does nothing", -> + editSession.setCursorBufferPosition([Infinity, Infinity]) + editSession.joinLine() + expect(editSession.lineForBufferRow(12)).toBe '};' + + describe "when text is selected", -> + describe "when the selection does not span multiple lines", -> + it "joins the line below with the current line separated by a space and retains the selected text", -> + editSession.setSelectedBufferRange([[0, 1], [0, 3]]) + editSession.joinLine() + expect(editSession.lineForBufferRow(0)).toBe 'var quicksort = function () { var sort = function(items) {' + expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [0, 3]] + + describe "when the selection spans multiple lines", -> + it "joins all selected lines separated by a space and retains the selected text", -> + editSession.setSelectedBufferRange([[9, 3], [12, 1]]) + editSession.joinLine() + expect(editSession.lineForBufferRow(9)).toBe ' }; return sort(Array.apply(this, arguments)); };' + expect(editSession.getSelectedBufferRange()).toEqual [[9, 3], [9, 49]] diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index c72fc5302..a17c914f0 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -778,6 +778,9 @@ class EditSession lowerCase: -> @replaceSelectedText selectWordIfEmpty:true, (text) => text.toLowerCase() + joinLine: -> + @mutateSelectedText (selection) -> selection.joinLine() + expandLastSelectionOverLine: -> @getLastSelection().expandOverLine() diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 02ad2a73e..db183a383 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -155,6 +155,7 @@ class Editor extends View 'editor:move-line-up': @moveLineUp 'editor:move-line-down': @moveLineDown 'editor:duplicate-line': @duplicateLine + 'editor:join-line': @joinLine 'editor:toggle-indent-guide': => config.set('editor.showIndentGuide', !config.get('editor.showIndentGuide')) 'editor:save-debug-snapshot': @saveDebugSnapshot 'editor:toggle-line-numbers': => config.set('editor.showLineNumbers', !config.get('editor.showLineNumbers')) @@ -183,6 +184,7 @@ class Editor extends View moveLineDown: -> @activeEditSession.moveLineDown() setCursorScreenPosition: (position, options) -> @activeEditSession.setCursorScreenPosition(position, options) duplicateLine: -> @activeEditSession.duplicateLine() + joinLine: -> @activeEditSession.joinLine() getCursorScreenPosition: -> @activeEditSession.getCursorScreenPosition() getCursorScreenRow: -> @activeEditSession.getCursorScreenRow() setCursorBufferPosition: (position, options) -> @activeEditSession.setCursorBufferPosition(position, options) diff --git a/src/app/keymaps/editor.cson b/src/app/keymaps/editor.cson index f9675e6c1..52522ce73 100644 --- a/src/app/keymaps/editor.cson +++ b/src/app/keymaps/editor.cson @@ -24,6 +24,7 @@ 'ctrl-meta-up': 'editor:move-line-up' 'ctrl-meta-down': 'editor:move-line-down' 'meta-D': 'editor:duplicate-line' + 'ctrl-J': 'editor:join-line' '.editor.mini': 'enter': 'core:confirm', diff --git a/src/app/selection.coffee b/src/app/selection.coffee index b4ed0f293..817769281 100644 --- a/src/app/selection.coffee +++ b/src/app/selection.coffee @@ -286,6 +286,31 @@ class Selection end-- @editSession.buffer.deleteRows(start, end) + joinLine: -> + selectedRange = @getBufferRange() + if selectedRange.isEmpty() + return if selectedRange.start.row is @editSession.buffer.getLastRow() + else + joinMarker = @editSession.markBufferRange(selectedRange, invalidationStrategy: 'never') + + rowCount = Math.max(1, selectedRange.getRowCount() - 1) + for row in [0...rowCount] + @cursor.setBufferPosition([selectedRange.start.row]) + @cursor.moveToEndOfLine() + nextRow = selectedRange.start.row + 1 + if nextRow <= @editSession.buffer.getLastRow() and @editSession.buffer.lineLengthForRow(nextRow) > 0 + @insertText(' ') + @cursor.moveToEndOfLine() + @modifySelection => + @cursor.moveRight() + @cursor.moveToFirstCharacterOfLine() + @deleteSelectedText() + + if joinMarker? + newSelectedRange = @editSession.getMarkerBufferRange(joinMarker) + @setBufferRange(newSelectedRange) + @editSession.destroyMarker(joinMarker) + outdentSelectedRows: -> [start, end] = @getBufferRowRange() buffer = @editSession.buffer