diff --git a/git2/frameworks/libgit2.0.17.0.dylib b/git2/frameworks/libgit2.0.17.0.dylib index f76d63a47..96d777c4d 100755 Binary files a/git2/frameworks/libgit2.0.17.0.dylib and b/git2/frameworks/libgit2.0.17.0.dylib differ diff --git a/native/v8_extensions/git.mm b/native/v8_extensions/git.mm index 960b44da2..36229345e 100644 --- a/native/v8_extensions/git.mm +++ b/native/v8_extensions/git.mm @@ -370,6 +370,7 @@ namespace v8_extensions { }; Git::Git() : CefV8Handler() { + git_threads_init(); } void Git::CreateContextBinding(CefRefPtr context) { diff --git a/script/update-libgit2 b/script/update-libgit2 index 301b1f24c..3960f37c0 100755 --- a/script/update-libgit2 +++ b/script/update-libgit2 @@ -3,7 +3,8 @@ # From root of libgit2 repo: # mkdir build # cd build -# cmake .. -DCMAKE_INSTALL_PREFIX=~/repos/atom/git2 -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DCMAKE_BUILD_TYPE=Release +# cmake .. -DCMAKE_INSTALL_PREFIX=~/github/atom/git2 -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" -DCMAKE_BUILD_TYPE=Release -DTHREADSAFE=1 -DBUILD_CLAR=OFF + # cmake --build . --target install # # From root of atom repo: diff --git a/spec/app/display-buffer-spec.coffee b/spec/app/display-buffer-spec.coffee index 6f87a7ddb..fe5dc83f7 100644 --- a/spec/app/display-buffer-spec.coffee +++ b/spec/app/display-buffer-spec.coffee @@ -1,5 +1,6 @@ DisplayBuffer = require 'display-buffer' Buffer = require 'buffer' +_ = require 'underscore' describe "DisplayBuffer", -> [editSession, displayBuffer, buffer, changeHandler, tabLength] = [] @@ -55,6 +56,13 @@ describe "DisplayBuffer", -> describe "when the buffer changes", -> describe "when buffer lines are updated", -> + describe "when whitespace is added after the max line length", -> + it "adds whitespace to the end of the current line and wraps an empty line", -> + fiftyCharacters = _.multiplyString("x", 50) + editSession.buffer.setText(fiftyCharacters) + editSession.setCursorBufferPosition([0, 51]) + editSession.insertText(" ") + describe "when the update makes a soft-wrapped line shorter than the max line length", -> it "rewraps the line and emits a change event", -> buffer.delete([[6, 24], [6, 42]]) diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 51a1fa12f..fce910c73 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -793,12 +793,21 @@ describe "EditSession", -> expect(editSession.indentationForBufferRow(2)).toBe editSession.indentationForBufferRow(1) describe "when the preceding does not match an auto-indent pattern", -> - it "auto-decreases the indentation of the line to be one level below that of the preceding line", -> - editSession.setCursorBufferPosition([3, Infinity]) - editSession.insertText('\n', autoIndent: true) - expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) - editSession.insertText(' }', autoIndent: true) - expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) - 1 + describe "when the inserted text is whitespace", -> + it "does not auto-decreases the indentation", -> + editSession.setCursorBufferPosition([12, 0]) + editSession.insertText(' ', autoIndent: true) + expect(editSession.lineForBufferRow(12)).toBe ' };' + editSession.insertText('\t\t', autoIndent: true) + expect(editSession.lineForBufferRow(12)).toBe ' \t\t};' + + describe "when the inserted text is non-whitespace", -> + it "auto-decreases the indentation of the line to be one level below that of the preceding line", -> + editSession.setCursorBufferPosition([3, Infinity]) + editSession.insertText('\n', autoIndent: true) + expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) + editSession.insertText(' }', autoIndent: true) + expect(editSession.indentationForBufferRow(4)).toBe editSession.indentationForBufferRow(3) - 1 describe "when the current line does not match an auto-outdent pattern", -> it "leaves the line unchanged", -> diff --git a/spec/stdlib/cson-spec.coffee b/spec/stdlib/cson-spec.coffee index 361eaf330..a1207203c 100644 --- a/spec/stdlib/cson-spec.coffee +++ b/spec/stdlib/cson-spec.coffee @@ -62,10 +62,14 @@ describe "CSON", -> it "formats the undefined value as null", -> expect(CSON.stringify(['a', undefined, 'b'])).toBe "[\n 'a'\n null\n 'b'\n]" + describe "when the array contains an object", -> + it "wraps the object in {}", -> + expect(CSON.stringify([{a:'b', a1: 'b1'}, {c: 'd'}])).toBe "[\n {\n 'a': 'b'\n 'a1': 'b1'\n }\n {\n 'c': 'd'\n }\n]" + describe "when formatting an object", -> describe "when the object is empty", -> - it "returns the empty string", -> - expect(CSON.stringify({})).toBe "" + it "returns {}", -> + expect(CSON.stringify({})).toBe "{}" it "returns formatted CSON", -> expect(CSON.stringify(a: {b: 'c'})).toBe "'a':\n 'b': 'c'" diff --git a/src/app/screen-line.coffee b/src/app/screen-line.coffee index 0c8822499..739d23eff 100644 --- a/src/app/screen-line.coffee +++ b/src/app/screen-line.coffee @@ -12,6 +12,8 @@ class ScreenLine new ScreenLine({@tokens, @ruleStack, @bufferRows, @startBufferColumn, @fold}) clipScreenColumn: (column, options={}) -> + return 0 if @tokens.length == 0 + { skipAtomicTokens } = options column = Math.min(column, @getMaxScreenColumn()) diff --git a/src/app/selection.coffee b/src/app/selection.coffee index 62a513984..9377498a2 100644 --- a/src/app/selection.coffee +++ b/src/app/selection.coffee @@ -164,7 +164,7 @@ class Selection if options.autoIndent if text == '\n' @editSession.autoIndentBufferRow(newBufferRange.end.row) - else + else if /\S/.test(text) @editSession.autoDecreaseIndentForRow(newBufferRange.start.row) newBufferRange diff --git a/src/packages/spell-check/lib/misspelling-view.coffee b/src/packages/spell-check/lib/misspelling-view.coffee index eeb537671..ba57e4164 100644 --- a/src/packages/spell-check/lib/misspelling-view.coffee +++ b/src/packages/spell-check/lib/misspelling-view.coffee @@ -39,6 +39,11 @@ class MisspellingView extends View getScreenRange: -> new Range(@startPosition, @endPosition) + unsubscribe: -> + super + + @editSession.destroyMarker(@marker) + containsCursor: -> cursor = @editor.getCursorScreenPosition() @getScreenRange().containsPoint(cursor, exclusive: false) diff --git a/src/packages/spell-check/spec/spell-check-spec.coffee b/src/packages/spell-check/spec/spell-check-spec.coffee index abdb98ac3..bf3fba917 100644 --- a/src/packages/spell-check/spec/spell-check-spec.coffee +++ b/src/packages/spell-check/spec/spell-check-spec.coffee @@ -96,3 +96,19 @@ describe "Spell check", -> expect(editor.find('.corrections').length).toBe 1 expect(editor.find('.corrections li').length).toBe 0 expect(editor.find('.corrections .error').text()).toBe "No corrections found" + + describe "when the edit session is destroyed", -> + it "destroys all misspelling markers", -> + editor.setText("mispelling") + config.set('spell-check.grammars', ['source.js']) + + waitsFor -> + editor.find('.misspelling').length > 0 + + runs -> + expect(editor.find('.misspelling').length).toBe 1 + view = editor.find('.misspelling').view() + buffer = editor.getBuffer() + expect(buffer.getMarkerPosition(view.marker)).not.toBeUndefined() + editor.destroyEditSessions() + expect(buffer.getMarkerPosition(view.marker)).toBeUndefined() diff --git a/src/packages/wrap-guide/spec/wrap-guide-spec.coffee b/src/packages/wrap-guide/spec/wrap-guide-spec.coffee index 391fe54ae..5944b7692 100644 --- a/src/packages/wrap-guide/spec/wrap-guide-spec.coffee +++ b/src/packages/wrap-guide/spec/wrap-guide-spec.coffee @@ -11,6 +11,7 @@ describe "WrapGuide", -> editor = rootView.getActiveEditor() wrapGuide = rootView.find('.wrap-guide').view() editor.width(editor.charWidth * wrapGuide.getDefaultColumn() * 2) + editor.trigger 'resize' describe "@initialize", -> it "appends a wrap guide to all existing and new editors", -> diff --git a/src/stdlib/cson.coffee b/src/stdlib/cson.coffee index 63158f006..382d8600a 100644 --- a/src/stdlib/cson.coffee +++ b/src/stdlib/cson.coffee @@ -21,7 +21,8 @@ module.exports = cson = '[\n' for value in array - cson += @stringifyIndent(indentLevel + 2) + indent = @stringifyIndent(indentLevel + 2) + cson += indent if _.isString(value) cson += @stringifyString(value) else if _.isBoolean(value) @@ -33,13 +34,15 @@ module.exports = else if _.isArray(value) cson += @stringifyArray(value, indentLevel + 2) else if _.isObject(value) - cson += @stringifyObject(value, indentLevel + 2) + cson += "{\n#{@stringifyObject(value, indentLevel + 4)}\n#{indent}}" else throw new Error("Unrecognized type for array value: #{value}") cson += '\n' "#{cson}#{@stringifyIndent(indentLevel)}]" stringifyObject: (object, indentLevel=0) -> + return '{}' if _.isEmpty(object) + cson = '' prefix = '' for key, value of object