mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Merge branch 'master' into as-tiled-gutter
This commit is contained in:
@@ -2,24 +2,31 @@
|
||||
* Your Stylesheet
|
||||
*
|
||||
* This stylesheet is loaded when Atom starts up and is reloaded automatically
|
||||
* when it is changed.
|
||||
* when it is changed and saved.
|
||||
*
|
||||
* If you are unfamiliar with LESS, you can read more about it here:
|
||||
* http://www.lesscss.org
|
||||
* Add your own CSS or Less to fully customize Atom.
|
||||
* If you are unfamiliar with Less, you can read more about it here:
|
||||
* http://lesscss.org
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Examples
|
||||
* (To see them, uncomment and save)
|
||||
*/
|
||||
|
||||
// style the background color of the tree view
|
||||
.tree-view {
|
||||
|
||||
// background-color: whitesmoke;
|
||||
}
|
||||
|
||||
// style the background and foreground colors on the atom-text-editor-element
|
||||
// itself
|
||||
// style the background and foreground colors on the atom-text-editor-element itself
|
||||
atom-text-editor {
|
||||
|
||||
// color: white;
|
||||
// background-color: hsl(180, 24%, 12%);
|
||||
}
|
||||
|
||||
// To style other content in the text editor's shadow DOM, use the ::shadow
|
||||
// expression
|
||||
// To style other content in the text editor's shadow DOM, use the ::shadow expression
|
||||
atom-text-editor::shadow .cursor {
|
||||
|
||||
// border-color: red;
|
||||
}
|
||||
|
||||
16
package.json
16
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "atom",
|
||||
"productName": "Atom",
|
||||
"version": "0.210.0",
|
||||
"version": "0.211.0",
|
||||
"description": "A hackable text editor for the 21st Century.",
|
||||
"main": "./src/browser/main.js",
|
||||
"repository": {
|
||||
@@ -87,7 +87,7 @@
|
||||
"autocomplete-atom-api": "0.9.0",
|
||||
"autocomplete-css": "0.7.2",
|
||||
"autocomplete-html": "0.7.2",
|
||||
"autocomplete-plus": "2.17.3",
|
||||
"autocomplete-plus": "2.17.4",
|
||||
"autocomplete-snippets": "1.7.0",
|
||||
"autoflow": "0.25.0",
|
||||
"autosave": "0.21.0",
|
||||
@@ -98,7 +98,7 @@
|
||||
"deprecation-cop": "0.52.0",
|
||||
"dev-live-reload": "0.46.0",
|
||||
"encoding-selector": "0.20.0",
|
||||
"exception-reporting": "0.24.0",
|
||||
"exception-reporting": "0.25.0",
|
||||
"find-and-replace": "0.173.0",
|
||||
"fuzzy-finder": "0.87.0",
|
||||
"git-diff": "0.55.0",
|
||||
@@ -110,7 +110,7 @@
|
||||
"link": "0.30.0",
|
||||
"markdown-preview": "0.150.0",
|
||||
"metrics": "0.51.0",
|
||||
"notifications": "0.54.0",
|
||||
"notifications": "0.56.0",
|
||||
"open-on-github": "0.37.0",
|
||||
"package-generator": "0.39.0",
|
||||
"release-notes": "0.53.0",
|
||||
@@ -128,13 +128,13 @@
|
||||
"whitespace": "0.30.0",
|
||||
"wrap-guide": "0.35.0",
|
||||
"language-c": "0.45.0",
|
||||
"language-clojure": "0.15.0",
|
||||
"language-clojure": "0.16.0",
|
||||
"language-coffee-script": "0.41.0",
|
||||
"language-csharp": "0.6.0",
|
||||
"language-css": "0.30.0",
|
||||
"language-css": "0.31.0",
|
||||
"language-gfm": "0.77.0",
|
||||
"language-git": "0.10.0",
|
||||
"language-go": "0.26.0",
|
||||
"language-go": "0.27.0",
|
||||
"language-html": "0.40.0",
|
||||
"language-hyperlink": "0.13.0",
|
||||
"language-java": "0.15.0",
|
||||
@@ -154,7 +154,7 @@
|
||||
"language-shellscript": "0.15.0",
|
||||
"language-source": "0.9.0",
|
||||
"language-sql": "0.16.0",
|
||||
"language-text": "0.6.0",
|
||||
"language-text": "0.7.0",
|
||||
"language-todo": "0.23.0",
|
||||
"language-toml": "0.16.0",
|
||||
"language-xml": "0.30.0",
|
||||
|
||||
@@ -101,6 +101,18 @@ describe "LanguageMode", ->
|
||||
expect(languageMode.suggestedIndentForBufferRow(0)).toBe 0
|
||||
expect(languageMode.suggestedIndentForBufferRow(1)).toBe 1
|
||||
expect(languageMode.suggestedIndentForBufferRow(2)).toBe 2
|
||||
expect(languageMode.suggestedIndentForBufferRow(5)).toBe 3
|
||||
expect(languageMode.suggestedIndentForBufferRow(7)).toBe 2
|
||||
expect(languageMode.suggestedIndentForBufferRow(9)).toBe 1
|
||||
expect(languageMode.suggestedIndentForBufferRow(11)).toBe 1
|
||||
|
||||
it "does not take invisibles into account", ->
|
||||
atom.config.set('editor.showInvisibles', true)
|
||||
expect(languageMode.suggestedIndentForBufferRow(0)).toBe 0
|
||||
expect(languageMode.suggestedIndentForBufferRow(1)).toBe 1
|
||||
expect(languageMode.suggestedIndentForBufferRow(2)).toBe 2
|
||||
expect(languageMode.suggestedIndentForBufferRow(5)).toBe 3
|
||||
expect(languageMode.suggestedIndentForBufferRow(7)).toBe 2
|
||||
expect(languageMode.suggestedIndentForBufferRow(9)).toBe 1
|
||||
expect(languageMode.suggestedIndentForBufferRow(11)).toBe 1
|
||||
|
||||
|
||||
@@ -788,6 +788,16 @@ describe "TextEditorComponent", ->
|
||||
beforeEach ->
|
||||
gutterNode = componentNode.querySelector('.gutter')
|
||||
|
||||
describe "when the component is destroyed", ->
|
||||
it "stops listening for folding events", ->
|
||||
component.destroy()
|
||||
|
||||
lineNumber = component.lineNumberNodeForScreenRow(1)
|
||||
target = lineNumber.querySelector('.icon-right')
|
||||
target.dispatchEvent(buildClickEvent(target))
|
||||
|
||||
expect(nextAnimationFrame).toBe(noAnimationFrame)
|
||||
|
||||
it "folds and unfolds the block represented by the fold indicator when clicked", ->
|
||||
expect(lineNumberHasClass(1, 'folded')).toBe false
|
||||
|
||||
@@ -1772,6 +1782,14 @@ describe "TextEditorComponent", ->
|
||||
beforeEach ->
|
||||
gutterNode = componentNode.querySelector('.gutter')
|
||||
|
||||
describe "when the component is destroyed", ->
|
||||
it "stops listening for selection events", ->
|
||||
component.destroy()
|
||||
|
||||
gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(1)))
|
||||
|
||||
expect(editor.getSelectedScreenRange()).toEqual [[0, 0], [0, 0]]
|
||||
|
||||
describe "when the gutter is clicked", ->
|
||||
it "selects the clicked row", ->
|
||||
gutterNode.dispatchEvent(buildMouseEvent('mousedown', clientCoordinatesForScreenRowInGutter(4)))
|
||||
|
||||
@@ -2929,34 +2929,45 @@ describe "TextEditor", ->
|
||||
beforeEach ->
|
||||
atom.config.set("editor.autoIndentOnPaste", true)
|
||||
|
||||
describe "when only whitespace precedes the cursor", ->
|
||||
describe "when pasting multiple lines before any non-whitespace characters", ->
|
||||
it "auto-indents the lines spanned by the pasted text, based on the first pasted line", ->
|
||||
expect(editor.indentationForBufferRow(5)).toBe(3)
|
||||
|
||||
atom.clipboard.write("a(x);\n b(x);\n c(x);\n", indentBasis: 0)
|
||||
editor.setCursorBufferPosition([5, 0])
|
||||
editor.pasteText()
|
||||
|
||||
# Adjust the indentation of the pasted block
|
||||
expect(editor.indentationForBufferRow(5)).toBe(3)
|
||||
expect(editor.indentationForBufferRow(6)).toBe(4)
|
||||
expect(editor.indentationForBufferRow(7)).toBe(5)
|
||||
# Adjust the indentation of the pasted lines while preserving
|
||||
# their indentation relative to each other. Also preserve the
|
||||
# indentation of the following line.
|
||||
expect(editor.lineTextForBufferRow(5)).toBe " a(x);"
|
||||
expect(editor.lineTextForBufferRow(6)).toBe " b(x);"
|
||||
expect(editor.lineTextForBufferRow(7)).toBe " c(x);"
|
||||
expect(editor.lineTextForBufferRow(8)).toBe " current = items.shift();"
|
||||
|
||||
# Preserve the indentation of the next row
|
||||
expect(editor.indentationForBufferRow(8)).toBe(3)
|
||||
describe "when pasting a single line of text", ->
|
||||
it "does not auto-indent the text", ->
|
||||
atom.clipboard.write("a(x);", indentBasis: 0)
|
||||
editor.setCursorBufferPosition([5, 0])
|
||||
editor.pasteText()
|
||||
|
||||
describe "when non-whitespace characters precede the cursor", ->
|
||||
it "does not auto-indent the first line being pasted", ->
|
||||
expect(editor.lineTextForBufferRow(5)).toBe "a(x); current = items.shift();"
|
||||
expect(editor.lineTextForBufferRow(6)).toBe " current < pivot ? left.push(current) : right.push(current);"
|
||||
|
||||
describe "when pasting on a line after non-whitespace characters", ->
|
||||
it "does not auto-indent the affected line", ->
|
||||
# Before the paste, the indentation is non-standard.
|
||||
editor.setText """
|
||||
if (x) {
|
||||
y();
|
||||
}
|
||||
if (x) {
|
||||
y();
|
||||
}
|
||||
"""
|
||||
|
||||
atom.clipboard.write(" z();")
|
||||
atom.clipboard.write(" z();\n h();")
|
||||
editor.setCursorBufferPosition([1, Infinity])
|
||||
|
||||
# The indentation of the non-standard line is unchanged.
|
||||
editor.pasteText()
|
||||
expect(editor.lineTextForBufferRow(1)).toBe(" y(); z();")
|
||||
expect(editor.lineTextForBufferRow(2)).toBe(" h();")
|
||||
|
||||
describe "when `autoIndentOnPaste` is false", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -103,12 +103,12 @@ module.exports =
|
||||
default: ''
|
||||
fontSize:
|
||||
type: 'integer'
|
||||
default: 16
|
||||
default: 14
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
lineHeight:
|
||||
type: ['string', 'number']
|
||||
default: 1.3
|
||||
default: 1.5
|
||||
showInvisibles:
|
||||
type: 'boolean'
|
||||
default: false
|
||||
|
||||
@@ -15,7 +15,12 @@ class GutterContainerComponent
|
||||
|
||||
@domNode = document.createElement('div')
|
||||
@domNode.classList.add('gutter-container')
|
||||
@domNode.style.display = 'flex';
|
||||
@domNode.style.display = 'flex'
|
||||
|
||||
destroy: ->
|
||||
for {name, component} in @gutterComponents
|
||||
component.destroy?()
|
||||
return
|
||||
|
||||
getDomNode: ->
|
||||
@domNode
|
||||
|
||||
@@ -261,7 +261,8 @@ class LanguageMode
|
||||
desiredIndentLevel += 1 if increaseIndentRegex.testSync(precedingLine) and not @editor.isBufferRowCommented(precedingRow)
|
||||
|
||||
return desiredIndentLevel unless decreaseIndentRegex = @decreaseIndentRegexForScopeDescriptor(scopeDescriptor)
|
||||
desiredIndentLevel -= 1 if decreaseIndentRegex.testSync(tokenizedLine.text)
|
||||
line = @buffer.lineForRow(bufferRow)
|
||||
desiredIndentLevel -= 1 if decreaseIndentRegex.testSync(line)
|
||||
|
||||
Math.max(desiredIndentLevel, 0)
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ class LineNumberGutterComponent extends TiledComponent
|
||||
@domNode.addEventListener 'click', @onClick
|
||||
@domNode.addEventListener 'mousedown', @onMouseDown
|
||||
|
||||
destroy: ->
|
||||
@domNode.removeEventListener 'click', @onClick
|
||||
@domNode.removeEventListener 'mousedown', @onMouseDown
|
||||
|
||||
getDomNode: ->
|
||||
@domNode
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ class Selection extends Model
|
||||
indentAdjustment = @editor.indentLevelForLine(precedingText) - options.indentBasis
|
||||
@adjustIndent(remainingLines, indentAdjustment)
|
||||
|
||||
if options.autoIndent and not NonWhitespaceRegExp.test(precedingText)
|
||||
if options.autoIndent and not NonWhitespaceRegExp.test(precedingText) and remainingLines.length > 0
|
||||
autoIndentFirstLine = true
|
||||
firstLine = precedingText + firstInsertedLine
|
||||
desiredIndentLevel = @editor.languageMode.suggestedIndentForLineAtBufferRow(oldBufferRange.start.row, firstLine)
|
||||
|
||||
@@ -106,6 +106,7 @@ class TextEditorComponent
|
||||
@mounted = false
|
||||
@disposables.dispose()
|
||||
@presenter.destroy()
|
||||
@gutterContainerComponent?.destroy()
|
||||
window.removeEventListener 'resize', @requestHeightAndWidthMeasurement
|
||||
|
||||
getDomNode: ->
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
atom-text-editor {
|
||||
display: block;
|
||||
font-family: Inconsolata, Monaco, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
line-height: 1.3;
|
||||
font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
}
|
||||
|
||||
atom-text-editor[mini] {
|
||||
|
||||
Reference in New Issue
Block a user