diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index c5d161b91..5880f5566 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -235,7 +235,9 @@ module.exports = (grunt) -> ciTasks.push('set-version', 'check-licenses', 'lint') ciTasks.push('mkdeb') if process.platform is 'linux' ciTasks.push('test') if process.platform isnt 'linux' - ciTasks.push('codesign', 'publish-build') + ciTasks.push('codesign') + ciTasks.push('create-installer') if process.platform is 'win32' + ciTasks.push('publish-build') grunt.registerTask('ci', ciTasks) defaultTasks = ['download-atom-shell', 'build', 'set-version'] diff --git a/build/tasks/codesign-task.coffee b/build/tasks/codesign-task.coffee index 7f579cbca..55aa12df9 100644 --- a/build/tasks/codesign-task.coffee +++ b/build/tasks/codesign-task.coffee @@ -31,6 +31,11 @@ module.exports = (grunt) -> spawn {cmd: 'taskkill', args: ['/F', '/IM', 'atom.exe']}, -> cmd = process.env.JANKY_SIGNTOOL ? 'signtool' args = [path.join(grunt.config.get('atom.shellAppDir'), 'atom.exe')] - spawn {cmd, args}, (error) -> callback(error) + + spawn {cmd, args}, (error) -> + return callback(error) if error? + + args = [path.join(grunt.config.get('atom.shellAppDir'), '..', 'Releases', 'setup.exe')] + spawn {cmd, args}, (error) -> callback(error) else callback() diff --git a/build/tasks/create-installer.coffee b/build/tasks/create-installer.coffee new file mode 100644 index 000000000..fa6152f40 --- /dev/null +++ b/build/tasks/create-installer.coffee @@ -0,0 +1,41 @@ +fs = require 'fs' +path = require 'path' +_ = require 'underscore-plus' + +module.exports = (grunt) -> + {spawn, rm} = require('./task-helpers')(grunt) + + grunt.registerTask 'create-installer', 'Create the Windows installer', -> + return unless process.platform is 'win32' + + done = @async() + + buildDir = grunt.config.get('atom.buildDir') + atomDir = path.join(buildDir, 'Atom') + + packageInfo = grunt.file.readJSON(path.join(atomDir, 'resources', 'app', 'package.json')) + inputTemplate = grunt.file.read(path.join('build', 'windows', 'atom.nuspec.erb')) + + # NB: Build server has some sort of stamp on the version number + packageInfo.version = packageInfo.version.replace(/-.*$/, '') + + targetNuspecPath = path.join(buildDir, 'atom.nuspec') + grunt.file.write(targetNuspecPath, _.template(inputTemplate, packageInfo)) + + cmd = 'build/windows/nuget.exe' + args = ['pack', targetNuspecPath, '-BasePath', atomDir, '-OutputDirectory', buildDir] + + spawn {cmd, args}, (error, result, code) -> + return done(error) if error? + + pkgs = pkg for pkg in fs.readdirSync(buildDir) when path.extname(pkg) is '.nupkg' + + releasesDir = path.join(buildDir, 'Releases') + + # NB: Gonna clear Releases for now, in the future we need to pull down + # the existing version + rm(releasesDir) + + cmd = 'build/windows/update.com' + args = ['--releasify', path.join(buildDir, pkgs), '-r', releasesDir, '-g', 'build/windows/install-spinner.gif'] + spawn {cmd, args}, (error, result, code) -> done(error) diff --git a/build/windows/NuGet.exe b/build/windows/NuGet.exe new file mode 100644 index 000000000..c41a0d0de Binary files /dev/null and b/build/windows/NuGet.exe differ diff --git a/build/windows/Setup.exe b/build/windows/Setup.exe new file mode 100644 index 000000000..73603d2d2 Binary files /dev/null and b/build/windows/Setup.exe differ diff --git a/build/windows/Setup.pdb b/build/windows/Setup.pdb new file mode 100644 index 000000000..2568e268e Binary files /dev/null and b/build/windows/Setup.pdb differ diff --git a/build/windows/Update.com b/build/windows/Update.com new file mode 100644 index 000000000..31bb30230 Binary files /dev/null and b/build/windows/Update.com differ diff --git a/build/windows/Update.exe b/build/windows/Update.exe new file mode 100644 index 000000000..6969bf563 Binary files /dev/null and b/build/windows/Update.exe differ diff --git a/build/windows/Update.exe.pdb b/build/windows/Update.exe.pdb new file mode 100644 index 000000000..9f8afd8e9 Binary files /dev/null and b/build/windows/Update.exe.pdb differ diff --git a/build/windows/atom.nuspec.erb b/build/windows/atom.nuspec.erb new file mode 100644 index 000000000..51b7ac057 --- /dev/null +++ b/build/windows/atom.nuspec.erb @@ -0,0 +1,32 @@ + + + + <%= name %> + <%= version %> + The Atom Community + The Atom Community + https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico + false + <%= description %> + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/windows/install-spinner.gif b/build/windows/install-spinner.gif new file mode 100644 index 000000000..9be998f3d Binary files /dev/null and b/build/windows/install-spinner.gif differ diff --git a/exports/atom.coffee b/exports/atom.coffee index 6b97846ac..5d707553d 100644 --- a/exports/atom.coffee +++ b/exports/atom.coffee @@ -8,10 +8,6 @@ module.exports = Point: Point Range: Range -Object.defineProperty module.exports, 'Git', get: -> - deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" - module.exports.GitRepository - # The following classes can't be used from a Task handler and should therefore # only be exported when not running as a child node process unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE @@ -20,7 +16,7 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE module.exports.$ = $ module.exports.$$ = $$ module.exports.$$$ = $$$ - module.exports.EditorView = require '../src/editor-view' + module.exports.TextEditorView = require '../src/text-editor-view' module.exports.ScrollView = require '../src/scroll-view' module.exports.SelectListView = require '../src/select-list-view' module.exports.Task = require '../src/task' @@ -29,3 +25,11 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE module.exports.Workspace = require '../src/workspace' module.exports.React = require 'react-atom-fork' module.exports.Reactionary = require 'reactionary-atom-fork' + +Object.defineProperty module.exports, 'Git', get: -> + deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`" + module.exports.GitRepository + +Object.defineProperty module.exports, 'EditorView', get: -> + deprecate "Please require `TextEditorView` instead of `EditorView`: `{TextEditorView} = require 'atom'`" + module.exports.TextEditorView diff --git a/menus/win32.cson b/menus/win32.cson index d002c2428..588e21978 100644 --- a/menus/win32.cson +++ b/menus/win32.cson @@ -33,8 +33,8 @@ { label: '&Undo', command: 'core:undo' } { label: '&Redo', command: 'core:redo' } { type: 'separator' } - { label: '&Cut', command: 'core:cut' } - { label: 'C&opy', command: 'core:copy' } + { label: 'Cu&t', command: 'core:cut' } + { label: '&Copy', command: 'core:copy' } { label: 'Copy Pat&h', command: 'editor:copy-path' } { label: '&Paste', command: 'core:paste' } { label: 'Select &All', command: 'core:select-all' } diff --git a/package.json b/package.json index 39382ab61..c8359c0e6 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "autosave": "0.18.0", "background-tips": "0.17.0", "bookmarks": "0.28.0", - "bracket-matcher": "0.59.0", + "bracket-matcher": "0.60.0", "command-palette": "0.27.0", "deprecation-cop": "0.10.0", "dev-live-reload": "0.34.0", @@ -93,19 +93,19 @@ "keybinding-resolver": "0.20.0", "link": "0.25.0", "markdown-preview": "0.103.0", - "metrics": "0.34.0", + "metrics": "0.36.0", "open-on-github": "0.30.0", "package-generator": "0.31.0", "release-notes": "0.36.0", - "settings-view": "0.145.0", + "settings-view": "0.147.0", "snippets": "0.53.0", "spell-check": "0.42.0", "status-bar": "0.46.0", "styleguide": "0.30.0", "symbols-view": "0.66.0", - "tabs": "0.52.0", + "tabs": "0.53.0", "timecop": "0.22.0", - "tree-view": "0.126.0", + "tree-view": "0.127.0", "update-package-dependencies": "0.6.0", "welcome": "0.18.0", "whitespace": "0.25.0", @@ -131,7 +131,7 @@ "language-python": "0.19.0", "language-ruby": "0.38.0", "language-ruby-on-rails": "0.18.0", - "language-sass": "0.21.0", + "language-sass": "0.22.0", "language-shellscript": "0.8.0", "language-source": "0.8.0", "language-sql": "0.11.0", diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee index 9890504d3..b5583c0ad 100644 --- a/spec/display-buffer-spec.coffee +++ b/spec/display-buffer-spec.coffee @@ -1100,6 +1100,33 @@ describe "DisplayBuffer", -> expect(displayBuffer.setScrollTop(maxScrollTop + 50)).toBe maxScrollTop expect(displayBuffer.getScrollTop()).toBe maxScrollTop + describe "editor.scrollPastEnd", -> + describe "when editor.scrollPastEnd is false", -> + beforeEach -> + atom.config.set("editor.scrollPastEnd", false) + displayBuffer.manageScrollPosition = true + displayBuffer.setLineHeightInPixels(10) + + it "does not add the height of the view to the scroll height", -> + lineHeight = displayBuffer.getLineHeightInPixels() + originalScrollHeight = displayBuffer.getScrollHeight() + displayBuffer.setHeight(50) + + expect(displayBuffer.getScrollHeight()).toBe originalScrollHeight + + describe "when editor.scrollPastEnd is true", -> + beforeEach -> + atom.config.set("editor.scrollPastEnd", true) + displayBuffer.manageScrollPosition = true + displayBuffer.setLineHeightInPixels(10) + + it "adds the height of the view to the scroll height", -> + lineHeight = displayBuffer.getLineHeightInPixels() + originalScrollHeight = displayBuffer.getScrollHeight() + displayBuffer.setHeight(50) + + expect(displayBuffer.getScrollHeight()).toEqual(originalScrollHeight + displayBuffer.height - (lineHeight * 3)) + describe "::setScrollLeft", -> beforeEach -> displayBuffer.manageScrollPosition = true diff --git a/spec/language-mode-spec.coffee b/spec/language-mode-spec.coffee index f6f0ebdd7..952326fbe 100644 --- a/spec/language-mode-spec.coffee +++ b/spec/language-mode-spec.coffee @@ -14,6 +14,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-javascript') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe ".minIndentLevelForRowRange(startRow, endRow)", -> it "returns the minimum indent level for the given row range", -> expect(languageMode.minIndentLevelForRowRange(4, 7)).toBe 2 @@ -149,6 +153,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-coffee-script') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe ".toggleLineCommentsForBufferRows(start, end)", -> it "comments/uncomments lines in the given range", -> languageMode.toggleLineCommentsForBufferRows(4, 6) @@ -200,6 +208,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-css') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe ".toggleLineCommentsForBufferRows(start, end)", -> it "comments/uncomments lines in the given range", -> languageMode.toggleLineCommentsForBufferRows(0, 1) @@ -248,6 +260,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-css') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe "when commenting lines", -> it "only uses the `commentEnd` pattern if it comes from the same grammar as the `commentStart`", -> languageMode.toggleLineCommentsForBufferRows(0, 0) @@ -264,6 +280,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-xml') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe "when uncommenting lines", -> it "removes the leading whitespace from the comment end pattern match", -> languageMode.toggleLineCommentsForBufferRows(0, 0) @@ -279,6 +299,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-javascript') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + it "maintains cursor buffer position when a folding/unfolding", -> editor.setCursorBufferPosition([5,5]) languageMode.foldAll() @@ -366,6 +390,10 @@ describe "LanguageMode", -> waitsForPromise -> atom.packages.activatePackage('language-javascript') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe ".unfoldAll()", -> it "unfolds every folded line", -> initialScreenLineCount = editor.getScreenLineCount() @@ -435,6 +463,10 @@ describe "LanguageMode", -> atom.packages.activatePackage('language-source') atom.packages.activatePackage('language-css') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe "suggestedIndentForBufferRow", -> it "does not return negative values (regression)", -> editor.setText('.test {\npadding: 0;\n}') diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index f7c3084f4..a4f7cfc7a 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -461,6 +461,7 @@ describe "PackageManager", -> themeActivator = spyOn(atom.themes, 'activatePackages') afterEach -> + atom.packages.deactivatePackages() atom.packages.unloadPackages() Syntax = require '../src/syntax' diff --git a/spec/random-editor-spec.coffee b/spec/random-editor-spec.coffee index 8c3a65d0b..bb5028d9a 100644 --- a/spec/random-editor-spec.coffee +++ b/spec/random-editor-spec.coffee @@ -1,9 +1,9 @@ {times, random} = require 'underscore-plus' randomWords = require 'random-words' TextBuffer = require 'text-buffer' -Editor = require '../src/editor' +TextEditor = require '../src/text-editor' -describe "Editor", -> +describe "TextEditor", -> [editor, tokenizedBuffer, buffer, steps, previousSteps] = [] softWrapColumn = 80 @@ -17,7 +17,7 @@ describe "Editor", -> times 10, (i) -> buffer = new TextBuffer - editor = new Editor({buffer}) + editor = new TextEditor({buffer}) editor.setEditorWidthInChars(80) tokenizedBuffer = editor.displayBuffer.tokenizedBuffer steps = [] diff --git a/spec/selection-spec.coffee b/spec/selection-spec.coffee index cbaf3be86..0e64b60fd 100644 --- a/spec/selection-spec.coffee +++ b/spec/selection-spec.coffee @@ -1,11 +1,11 @@ -Editor = require '../src/editor' +TextEditor = require '../src/text-editor' describe "Selection", -> [buffer, editor, selection] = [] beforeEach -> buffer = atom.project.bufferForPathSync('sample.js') - editor = new Editor(buffer: buffer, tabLength: 2) + editor = new TextEditor(buffer: buffer, tabLength: 2) selection = editor.getLastSelection() afterEach -> diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 667d89e17..08531106c 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -12,10 +12,10 @@ KeymapManager = require '../src/keymap-extensions' Config = require '../src/config' {Point} = require 'text-buffer' Project = require '../src/project' -Editor = require '../src/editor' -EditorView = require '../src/editor-view' +TextEditor = require '../src/text-editor' +TextEditorView = require '../src/text-editor-view' TokenizedBuffer = require '../src/tokenized-buffer' -EditorComponent = require '../src/editor-component' +TextEditorComponent = require '../src/text-editor-component' pathwatcher = require 'pathwatcher' clipboard = require 'clipboard' @@ -99,7 +99,7 @@ beforeEach -> spyOn(config, 'load') spyOn(config, 'save') config.setDefaults('core', WorkspaceView.configDefaults) - config.setDefaults('editor', EditorView.configDefaults) + config.setDefaults('editor', TextEditorView.configDefaults) config.set "core.destroyEmptyPanes", false config.set "editor.fontFamily", "Courier" config.set "editor.fontSize", 16 @@ -110,14 +110,14 @@ beforeEach -> atom.config = config # make editor display updates synchronous - spyOn(EditorView.prototype, 'requestDisplayUpdate').andCallFake -> @updateDisplay() - EditorComponent.performSyncUpdates = true + spyOn(TextEditorView.prototype, 'requestDisplayUpdate').andCallFake -> @updateDisplay() + TextEditorComponent.performSyncUpdates = true spyOn(atom, "setRepresentedFilename") spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout spyOn(window, "clearTimeout").andCallFake window.fakeClearTimeout spyOn(pathwatcher.File.prototype, "detectResurrectionAfterDelay").andCallFake -> @detectResurrection() - spyOn(Editor.prototype, "shouldPromptToSave").andReturn false + spyOn(TextEditor.prototype, "shouldPromptToSave").andReturn false # make tokenization synchronous TokenizedBuffer.prototype.chunkSize = Infinity diff --git a/spec/syntax-spec.coffee b/spec/syntax-spec.coffee index 3b6745155..12bd277b7 100644 --- a/spec/syntax-spec.coffee +++ b/spec/syntax-spec.coffee @@ -4,7 +4,6 @@ temp = require 'temp' describe "the `syntax` global", -> beforeEach -> - waitsForPromise -> atom.packages.activatePackage('language-text') @@ -17,6 +16,10 @@ describe "the `syntax` global", -> waitsForPromise -> atom.packages.activatePackage('language-ruby') + afterEach -> + atom.packages.deactivatePackages() + atom.packages.unloadPackages() + describe "serialization", -> it "remembers grammar overrides by path", -> filePath = '/foo/bar/file.js' diff --git a/spec/editor-component-spec.coffee b/spec/text-editor-component-spec.coffee similarity index 99% rename from spec/editor-component-spec.coffee rename to spec/text-editor-component-spec.coffee index 1a6d58af5..807e5ab7b 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -1,11 +1,11 @@ _ = require 'underscore-plus' {extend, flatten, toArray, last} = _ -EditorView = require '../src/editor-view' -EditorComponent = require '../src/editor-component' +TextEditorView = require '../src/text-editor-view' +TextEditorComponent = require '../src/text-editor-component' nbsp = String.fromCharCode(160) -describe "EditorComponent", -> +describe "TextEditorComponent", -> [contentNode, editor, wrapperView, wrapperNode, component, componentNode, verticalScrollbarNode, horizontalScrollbarNode] = [] [lineHeightInPixels, charWidth, nextAnimationFrame, noAnimationFrame, lineOverdrawMargin] = [] @@ -34,7 +34,7 @@ describe "EditorComponent", -> contentNode = document.querySelector('#jasmine-content') contentNode.style.width = '1000px' - wrapperView = new EditorView(editor, {lineOverdrawMargin}) + wrapperView = new TextEditorView(editor, {lineOverdrawMargin}) wrapperView.attachToDom() wrapperNode = wrapperView.element @@ -1999,7 +1999,7 @@ describe "EditorComponent", -> hiddenParent.style.display = 'none' contentNode.appendChild(hiddenParent) - wrapperView = new EditorView(editor, {lineOverdrawMargin}) + wrapperView = new TextEditorView(editor, {lineOverdrawMargin}) wrapperNode = wrapperView.element wrapperView.appendTo(hiddenParent) diff --git a/spec/editor-spec.coffee b/spec/text-editor-spec.coffee similarity index 99% rename from spec/editor-spec.coffee rename to spec/text-editor-spec.coffee index d95dbc7c6..fa24d8266 100644 --- a/spec/editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1,7 +1,7 @@ clipboard = require 'clipboard' -Editor = require '../src/editor' +TextEditor = require '../src/text-editor' -describe "Editor", -> +describe "TextEditor", -> [buffer, editor, lineLengths] = [] convertToHardTabs = (buffer) -> @@ -49,7 +49,7 @@ describe "Editor", -> state = editor.serialize() atom.config.set('editor.invisibles', eol: '?') - editor2 = Editor.deserialize(state) + editor2 = TextEditor.deserialize(state) expect(editor2.displayBuffer.invisibles.eol).toBe '?' expect(editor2.displayBuffer.tokenizedBuffer.invisibles.eol).toBe '?' @@ -3263,6 +3263,9 @@ describe "Editor", -> runs -> expect(editor.softTabs).toBe false + atom.packages.deactivatePackage('language-coffee-script') + atom.packages.unloadPackage('language-coffee-script') + describe ".destroy()", -> it "destroys all markers associated with the edit session", -> expect(buffer.getMarkerCount()).toBeGreaterThan 0 @@ -3669,7 +3672,7 @@ describe "Editor", -> describe '.get/setPlaceholderText()', -> it 'can be created with placeholderText', -> TextBuffer = require 'text-buffer' - newEditor = new Editor + newEditor = new TextEditor buffer: new TextBuffer mini: true placeholderText: 'yep' diff --git a/spec/window-spec.coffee b/spec/window-spec.coffee index 00e21ffd4..c35d607de 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -1,6 +1,6 @@ {$, $$} = require 'atom' path = require 'path' -Editor = require '../src/editor' +TextEditor = require '../src/text-editor' WindowEventHandler = require '../src/window-event-handler' describe "Window", -> @@ -59,7 +59,7 @@ describe "Window", -> [beforeUnloadEvent] = [] beforeEach -> - jasmine.unspy(Editor.prototype, "shouldPromptToSave") + jasmine.unspy(TextEditor.prototype, "shouldPromptToSave") beforeUnloadEvent = $.Event(new Event('beforeunload')) describe "when pane items are are modified", -> diff --git a/spec/workspace-view-spec.coffee b/spec/workspace-view-spec.coffee index b738349c5..8fc7f29be 100644 --- a/spec/workspace-view-spec.coffee +++ b/spec/workspace-view-spec.coffee @@ -2,7 +2,7 @@ Q = require 'q' path = require 'path' temp = require 'temp' -EditorView = require '../src/editor-view' +TextEditorView = require '../src/text-editor-view' PaneView = require '../src/pane-view' Workspace = require '../src/workspace' @@ -203,7 +203,7 @@ describe "WorkspaceView", -> editorViewCreatedHandler = jasmine.createSpy('editorViewCreatedHandler') atom.workspaceView.eachEditorView(editorViewCreatedHandler) editorViewCreatedHandler.reset() - miniEditor = new EditorView(mini: true) + miniEditor = new TextEditorView(mini: true) atom.workspaceView.append(miniEditor) expect(editorViewCreatedHandler).not.toHaveBeenCalled() diff --git a/src/atom.coffee b/src/atom.coffee index b3c1fc17a..ba209151f 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -215,7 +215,7 @@ class Atom extends Model @deserializers.add(TextBuffer) TokenizedBuffer = require './tokenized-buffer' DisplayBuffer = require './display-buffer' - Editor = require './editor' + TextEditor = require './text-editor' @windowEventHandler = new WindowEventHandler @@ -468,7 +468,7 @@ class Atom extends Model dimensions = @restoreWindowDimensions() @config.load() @config.setDefaults('core', require('./workspace-view').configDefaults) - @config.setDefaults('editor', require('./editor-view').configDefaults) + @config.setDefaults('editor', require('./text-editor-view').configDefaults) @keymaps.loadBundledKeymaps() @themes.loadBaseStylesheets() @packages.loadPackages() diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 7460952a1..5aad02674 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -492,6 +492,14 @@ class AtomApplication else BrowserWindow.getFocusedWindow() + openOptions = + properties: properties.concat(['multiSelections', 'createDirectory']) + title: 'Open' + + if process.platform is 'linux' + if projectPath = @lastFocusedWindow?.projectPath + openOptions.defaultPath = projectPath + dialog = require 'dialog' - dialog.showOpenDialog parentWindow, title: 'Open', properties: properties.concat(['multiSelections', 'createDirectory']), (pathsToOpen) => + dialog.showOpenDialog parentWindow, openOptions, (pathsToOpen) => @openPaths({pathsToOpen, devMode, safeMode, window}) diff --git a/src/cursor.coffee b/src/cursor.coffee index 8947a3a78..7ad9ac5f6 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -7,7 +7,7 @@ Grim = require 'grim' # Extended: The `Cursor` class represents the little blinking line identifying # where text can be inserted. # -# Cursors belong to {Editor}s and have some metadata attached in the form +# Cursors belong to {TextEditor}s and have some metadata attached in the form # of a {Marker}. module.exports = class Cursor extends Model @@ -17,7 +17,7 @@ class Cursor extends Model visible: true needsAutoscroll: null - # Instantiated by an {Editor} + # Instantiated by an {TextEditor} constructor: ({@editor, @marker, id}) -> @emitter = new Emitter @@ -114,7 +114,7 @@ class Cursor extends Model # # * `screenPosition` {Array} of two numbers: the screen row, and the screen column. # * `options` (optional) {Object} with the following keys: - # * `autoscroll` A Boolean which, if `true`, scrolls the {Editor} to wherever + # * `autoscroll` A Boolean which, if `true`, scrolls the {TextEditor} to wherever # the cursor moves to. setScreenPosition: (screenPosition, options={}) -> @changePosition options, => @@ -128,7 +128,7 @@ class Cursor extends Model # # * `bufferPosition` {Array} of two numbers: the buffer row, and the buffer column. # * `options` (optional) {Object} with the following keys: - # * `autoscroll` A Boolean which, if `true`, scrolls the {Editor} to wherever + # * `autoscroll` A Boolean which, if `true`, scrolls the {TextEditor} to wherever # the cursor moves to. setBufferPosition: (bufferPosition, options={}) -> @changePosition options, => @@ -232,7 +232,7 @@ class Cursor extends Model else bufferPosition.column > firstCharacterColumn - # Public: Identifies if this cursor is the last in the {Editor}. + # Public: Identifies if this cursor is the last in the {TextEditor}. # # "Last" is defined as the most recently added cursor. # diff --git a/src/decoration.coffee b/src/decoration.coffee index 45e265044..827675c90 100644 --- a/src/decoration.coffee +++ b/src/decoration.coffee @@ -12,7 +12,7 @@ nextId = -> idCounter++ # around marked ranges of text. # # {Decoration} objects are not meant to be created directly, but created with -# {Editor::decorateMarker}. eg. +# {TextEditor::decorateMarker}. eg. # # ```coffee # range = editor.getSelectedBufferRange() # any range you like diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee index 4a686c88b..60430692b 100644 --- a/src/display-buffer.coffee +++ b/src/display-buffer.coffee @@ -315,9 +315,14 @@ class DisplayBuffer extends Model @charWidthsByScope = {} getScrollHeight: -> - return 0 unless @getLineHeightInPixels() > 0 + lineHeight = @getLineHeightInPixels() + return 0 unless lineHeight > 0 - @getLineCount() * @getLineHeightInPixels() + scrollHeight = @getLineCount() * lineHeight + if @height? and atom.config.get('editor.scrollPastEnd') + scrollHeight = scrollHeight + @height - (lineHeight * 3) + + scrollHeight getScrollWidth: -> @scrollWidth diff --git a/src/language-mode.coffee b/src/language-mode.coffee index 6ce4b7b3a..b1327a2b4 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -8,9 +8,9 @@ class LanguageMode Emitter.includeInto(this) Subscriber.includeInto(this) - # Sets up a `LanguageMode` for the given {Editor}. + # Sets up a `LanguageMode` for the given {TextEditor}. # - # editor - The {Editor} to associate with + # editor - The {TextEditor} to associate with constructor: (@editor) -> {@buffer} = @editor @@ -283,7 +283,7 @@ class LanguageMode # Given a buffer row, this indents it. # # bufferRow - The row {Number}. - # options - An options {Object} to pass through to {Editor::setIndentationForBufferRow}. + # options - An options {Object} to pass through to {TextEditor::setIndentationForBufferRow}. autoIndentBufferRow: (bufferRow, options) -> indentLevel = @suggestedIndentForBufferRow(bufferRow) @editor.setIndentationForBufferRow(bufferRow, indentLevel, options) diff --git a/src/marker.coffee b/src/marker.coffee index e54fc5248..e373c2f60 100644 --- a/src/marker.coffee +++ b/src/marker.coffee @@ -12,7 +12,7 @@ Grim = require 'grim' # # ### Marker Creation # -# Use {Editor::markBufferRange} rather than creating Markers directly. +# Use {TextEditor::markBufferRange} rather than creating Markers directly. # # ### Head and Tail # @@ -42,7 +42,7 @@ Grim = require 'grim' # region in any way, including changes that end at the marker's # start or start at the marker's end. This is the most fragile strategy. # -# See {Editor::markBufferRange} for usage. +# See {TextEditor::markBufferRange} for usage. module.exports = class Marker EmitterMixin.includeInto(this) diff --git a/src/pane-view.coffee b/src/pane-view.coffee index 24e971de7..058422a48 100644 --- a/src/pane-view.coffee +++ b/src/pane-view.coffee @@ -8,7 +8,7 @@ Pane = require './pane' # A container which can contains multiple items to be switched between. # -# Items can be almost anything however most commonly they're {EditorView}s. +# Items can be almost anything however most commonly they're {TextEditorView}s. # # Most packages won't need to use this class, unless you're interested in # building a package that deals with switching between panes or items. diff --git a/src/pane.coffee b/src/pane.coffee index 79652a0b0..a501d8a9d 100644 --- a/src/pane.coffee +++ b/src/pane.coffee @@ -4,7 +4,7 @@ Serializable = require 'serializable' Grim = require 'grim' PaneAxis = require './pane-axis' -Editor = require './editor' +TextEditor = require './text-editor' PaneView = null # Extended: A container for presenting content in the center of the workspace. @@ -260,9 +260,9 @@ class Pane extends Model @emitter.emit 'did-change-active-item', @activeItem @activeItem - # Return an {Editor} if the pane item is an {Editor}, or null otherwise. + # Return an {TextEditor} if the pane item is an {TextEditor}, or null otherwise. getActiveEditor: -> - @activeItem if @activeItem instanceof Editor + @activeItem if @activeItem instanceof TextEditor # Public: Return the item at the given index. # diff --git a/src/project.coffee b/src/project.coffee index 529acd830..805afa49b 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -11,7 +11,7 @@ Serializable = require 'serializable' TextBuffer = require 'text-buffer' {Directory} = require 'pathwatcher' -Editor = require './editor' +TextEditor = require './text-editor' Task = require './task' GitRepository = require './git-repository' @@ -232,12 +232,12 @@ class Project extends Model ### # Given a path to a file, this constructs and associates a new - # {Editor}, showing the file. + # {TextEditor}, showing the file. # # * `filePath` The {String} path of the file to associate with. - # * `options` Options that you can pass to the {Editor} constructor. + # * `options` Options that you can pass to the {TextEditor} constructor. # - # Returns a promise that resolves to an {Editor}. + # Returns a promise that resolves to an {TextEditor}. open: (filePath, options={}) -> filePath = @resolve(filePath) @bufferForPath(filePath).then (buffer) => @@ -330,7 +330,7 @@ class Project extends Model buffer?.destroy() buildEditorForBuffer: (buffer, editorOptions) -> - editor = new Editor(_.extend({buffer, registerEditor: true}, editorOptions)) + editor = new TextEditor(_.extend({buffer, registerEditor: true}, editorOptions)) editor eachBuffer: (args...) -> diff --git a/src/select-list-view.coffee b/src/select-list-view.coffee index b3cc4a1bc..1fdc60e4a 100644 --- a/src/select-list-view.coffee +++ b/src/select-list-view.coffee @@ -1,5 +1,5 @@ {$, View} = require './space-pen-extensions' -EditorView = require './editor-view' +TextEditorView = require './text-editor-view' fuzzyFilter = require('fuzzaldrin').filter # Essential: Provides a view that renders a list of items with an editor that @@ -34,7 +34,7 @@ module.exports = class SelectListView extends View @content: -> @div class: 'select-list', => - @subview 'filterEditorView', new EditorView(mini: true) + @subview 'filterEditorView', new TextEditorView(mini: true) @div class: 'error-message', outlet: 'error' @div class: 'loading', outlet: 'loadingArea', => @span class: 'loading-message', outlet: 'loading' diff --git a/src/selection.coffee b/src/selection.coffee index f17455cb9..525c56f0e 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -4,7 +4,7 @@ {Emitter} = require 'event-kit' Grim = require 'grim' -# Extended: Represents a selection in the {Editor}. +# Extended: Represents a selection in the {TextEditor}. module.exports = class Selection extends Model cursor: null @@ -93,7 +93,7 @@ class Selection extends Model # * `screenRange` The new {Range} to select. # * `options` (optional) {Object} with the keys: # * `preserveFolds` if `true`, the fold settings are preserved after the selection moves. - # * `autoscroll` if `true`, the {Editor} scrolls to the new selection. + # * `autoscroll` if `true`, the {TextEditor} scrolls to the new selection. setBufferRange: (bufferRange, options={}) -> bufferRange = Range.fromObject(bufferRange) @needsAutoscroll = options.autoscroll @@ -591,7 +591,7 @@ class Selection extends Model # # * `options` (optional) {Object} with the keys: # * `autoIndent` If `true`, the line is indented to an automatically-inferred - # level. Otherwise, {Editor::getTabText} is inserted. + # level. Otherwise, {TextEditor::getTabText} is inserted. indent: ({ autoIndent }={}) -> { row, column } = @cursor.getBufferPosition() diff --git a/src/editor-component.coffee b/src/text-editor-component.coffee similarity index 99% rename from src/editor-component.coffee rename to src/text-editor-component.coffee index bb5bc7eda..8fb98662e 100644 --- a/src/editor-component.coffee +++ b/src/text-editor-component.coffee @@ -14,8 +14,8 @@ ScrollbarCornerComponent = require './scrollbar-corner-component' SubscriberMixin = require './subscriber-mixin' module.exports = -EditorComponent = React.createClass - displayName: 'EditorComponent' +TextEditorComponent = React.createClass + displayName: 'TextEditorComponent' mixins: [SubscriberMixin] statics: @@ -236,7 +236,7 @@ EditorComponent = React.createClass @updateRequestedWhilePaused = true return - if @performSyncUpdates ? EditorComponent.performSyncUpdates + if @performSyncUpdates ? TextEditorComponent.performSyncUpdates @forceUpdate() else unless @updateRequested @updateRequested = true @@ -606,7 +606,7 @@ EditorComponent = React.createClass onScrollViewScroll: -> if @isMounted() - console.warn "EditorScrollView scrolled when it shouldn't have." + console.warn "TextEditorScrollView scrolled when it shouldn't have." scrollViewNode = @refs.scrollView.getDOMNode() scrollViewNode.scrollTop = 0 scrollViewNode.scrollLeft = 0 diff --git a/src/editor-view.coffee b/src/text-editor-view.coffee similarity index 83% rename from src/editor-view.coffee rename to src/text-editor-view.coffee index b96d523b3..2e6663fcf 100644 --- a/src/editor-view.coffee +++ b/src/text-editor-view.coffee @@ -2,24 +2,24 @@ React = require 'react-atom-fork' {defaults} = require 'underscore-plus' TextBuffer = require 'text-buffer' -Editor = require './editor' -EditorComponent = require './editor-component' +TextEditor = require './text-editor' +TextEditorComponent = require './text-editor-component' {deprecate} = require 'grim' # Public: Represents the entire visual pane in Atom. # -# The EditorView manages the {Editor}, which manages the file buffers. -# `EditorView` is intentionally sparse. Most of the things you'll want -# to do are on {Editor}. +# The TextEditorView manages the {TextEditor}, which manages the file buffers. +# `TextEditorView` is intentionally sparse. Most of the things you'll want +# to do are on {TextEditor}. # # ## Examples # # Requiring in packages # # ```coffee -# {EditorView} = require 'atom' +# {TextEditorView} = require 'atom' # -# miniEditorView = new EditorView(mini: true) +# miniEditorView = new TextEditorView(mini: true) # ``` # # Iterating over the open editor views @@ -36,7 +36,7 @@ EditorComponent = require './editor-component' # console.log(editorView.getModel().getPath()) # ``` module.exports = -class EditorView extends View +class TextEditorView extends View @configDefaults: fontFamily: '' fontSize: 16 @@ -60,6 +60,7 @@ class EditorView extends View space: '\u00b7' tab: '\u00bb' cr: '\u00a4' + scrollPastEnd: false @content: (params) -> attributes = params.attributes ? {} @@ -69,23 +70,23 @@ class EditorView extends View focusOnAttach: false - # The constructor for setting up an `EditorView` instance. + # The constructor for setting up an `TextEditorView` instance. # - # * `editorOrParams` Either an {Editor}, or an object with one property, `mini`. - # If `mini` is `true`, a "miniature" `Editor` is constructed. + # * `editorOrParams` Either an {TextEditor}, or an object with one property, `mini`. + # If `mini` is `true`, a "miniature" `TextEditor` is constructed. # Typically, this is ideal for scenarios where you need an Atom editor, # but without all the chrome, like scrollbars, gutter, _e.t.c._. # constructor: (editorOrParams, props) -> super - if editorOrParams instanceof Editor + if editorOrParams instanceof TextEditor @editor = editorOrParams else {@editor, mini, placeholderText} = editorOrParams props ?= {} props.mini = mini - @editor ?= new Editor + @editor ?= new TextEditor buffer: new TextBuffer softWrapped: false tabLength: 2 @@ -94,7 +95,7 @@ class EditorView extends View placeholderText: placeholderText props = defaults({@editor, parentView: this}, props) - @component = React.renderComponent(EditorComponent(props), @element) + @component = React.renderComponent(TextEditorComponent(props), @element) node = @component.getDOMNode() @@ -128,7 +129,7 @@ class EditorView extends View # Public: Get the underlying editor model for this view. # - # Returns an {Editor} + # Returns an {TextEditor} getModel: -> @editor getEditor: -> @editor @@ -171,27 +172,27 @@ class EditorView extends View @editor.getScrollLeft() scrollToBottom: -> - deprecate 'Use Editor::scrollToBottom instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::scrollToBottom instead. You can get the editor via editorView.getModel()' @editor.setScrollBottom(Infinity) scrollToScreenPosition: (screenPosition, options) -> - deprecate 'Use Editor::scrollToScreenPosition instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::scrollToScreenPosition instead. You can get the editor via editorView.getModel()' @editor.scrollToScreenPosition(screenPosition, options) scrollToBufferPosition: (bufferPosition, options) -> - deprecate 'Use Editor::scrollToBufferPosition instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::scrollToBufferPosition instead. You can get the editor via editorView.getModel()' @editor.scrollToBufferPosition(bufferPosition, options) scrollToCursorPosition: -> - deprecate 'Use Editor::scrollToCursorPosition instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::scrollToCursorPosition instead. You can get the editor via editorView.getModel()' @editor.scrollToCursorPosition() pixelPositionForBufferPosition: (bufferPosition) -> - deprecate 'Use Editor::pixelPositionForBufferPosition instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::pixelPositionForBufferPosition instead. You can get the editor via editorView.getModel()' @editor.pixelPositionForBufferPosition(bufferPosition) pixelPositionForScreenPosition: (screenPosition) -> - deprecate 'Use Editor::pixelPositionForScreenPosition instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::pixelPositionForScreenPosition instead. You can get the editor via editorView.getModel()' @editor.pixelPositionForScreenPosition(screenPosition) appendToLinesView: (view) -> @@ -251,13 +252,13 @@ class EditorView extends View pane = @getPaneView() pane?.splitDown(pane?.copyActiveItem()).activeView - # Public: Get this {EditorView}'s {PaneView}. + # Public: Get this {TextEditorView}'s {PaneView}. # # Returns a {PaneView} getPaneView: -> @parent('.item-views').parents('.pane').view() getPane: -> - deprecate 'Use EditorView::getPaneView() instead' + deprecate 'Use TextEditorView::getPaneView() instead' @getPaneView() show: -> @@ -277,11 +278,11 @@ class EditorView extends View @editor.pageUp() getFirstVisibleScreenRow: -> - deprecate 'Use Editor::getFirstVisibleScreenRow instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::getFirstVisibleScreenRow instead. You can get the editor via editorView.getModel()' @editor.getFirstVisibleScreenRow() getLastVisibleScreenRow: -> - deprecate 'Use Editor::getLastVisibleScreenRow instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::getLastVisibleScreenRow instead. You can get the editor via editorView.getModel()' @editor.getLastVisibleScreenRow() getFontFamily: -> @@ -312,7 +313,7 @@ class EditorView extends View @component.setShowIndentGuide(showIndentGuide) setSoftWrap: (softWrapped) -> - deprecate 'Use Editor::setSoftWrapped instead. You can get the editor via editorView.getModel()' + deprecate 'Use TextEditor::setSoftWrapped instead. You can get the editor via editorView.getModel()' @editor.setSoftWrapped(softWrapped) setShowInvisibles: (showInvisibles) -> diff --git a/src/editor.coffee b/src/text-editor.coffee similarity index 96% rename from src/editor.coffee rename to src/text-editor.coffee index eb18ccc43..33921a257 100644 --- a/src/editor.coffee +++ b/src/text-editor.coffee @@ -16,16 +16,16 @@ TextMateScopeSelector = require('first-mate').ScopeSelector # Public: This class represents all essential editing state for a single # {TextBuffer}, including cursor and selection positions, folds, and soft wraps. # If you're manipulating the state of an editor, use this class. If you're -# interested in the visual appearance of editors, use {EditorView} instead. +# interested in the visual appearance of editors, use {TextEditorView} instead. # # A single {TextBuffer} can belong to multiple editors. For example, if the # same file is open in two different panes, Atom creates a separate editor for # each pane. If the buffer is manipulated the changes are reflected in both # editors, but each maintains its own cursor position, folded lines, etc. # -# ## Accessing Editor Instances +# ## Accessing TextEditor Instances # -# The easiest way to get hold of `Editor` objects is by registering a callback +# The easiest way to get hold of `TextEditor` objects is by registering a callback # with `::observeTextEditors` on the `atom.workspace` global. Your callback will # then be called with all current editor instances and also when any editor is # created in the future. @@ -53,7 +53,7 @@ TextMateScopeSelector = require('first-mate').ScopeSelector # **When in doubt, just default to buffer coordinates**, then experiment with # soft wraps and folds to ensure your code interacts with them correctly. module.exports = -class Editor extends Model +class TextEditor extends Model Serializable.includeInto(this) atom.deserializers.add(this) Delegator.includeInto(this) @@ -163,7 +163,7 @@ class Editor extends Model @subscribe @displayBuffer.onDidRemoveDecoration (decoration) => @emit 'decoration-removed', decoration getViewClass: -> - require './editor-view' + require './text-editor-view' destroyed: -> @unsubscribe() @@ -426,57 +426,57 @@ class Editor extends Model on: (eventName) -> switch eventName when 'title-changed' - deprecate("Use Editor::onDidChangeTitle instead") + deprecate("Use TextEditor::onDidChangeTitle instead") when 'path-changed' - deprecate("Use Editor::onDidChangePath instead") + deprecate("Use TextEditor::onDidChangePath instead") when 'modified-status-changed' - deprecate("Use Editor::onDidChangeModified instead") + deprecate("Use TextEditor::onDidChangeModified instead") when 'soft-wrap-changed' - deprecate("Use Editor::onDidChangeSoftWrapped instead") + deprecate("Use TextEditor::onDidChangeSoftWrapped instead") when 'grammar-changed' - deprecate("Use Editor::onDidChangeGrammar instead") + deprecate("Use TextEditor::onDidChangeGrammar instead") when 'character-widths-changed' - deprecate("Use Editor::onDidChangeCharacterWidths instead") + deprecate("Use TextEditor::onDidChangeCharacterWidths instead") when 'contents-modified' - deprecate("Use Editor::onDidStopChanging instead") + deprecate("Use TextEditor::onDidStopChanging instead") when 'contents-conflicted' - deprecate("Use Editor::onDidConflict instead") + deprecate("Use TextEditor::onDidConflict instead") when 'will-insert-text' - deprecate("Use Editor::onWillInsertText instead") + deprecate("Use TextEditor::onWillInsertText instead") when 'did-insert-text' - deprecate("Use Editor::onDidInsertText instead") + deprecate("Use TextEditor::onDidInsertText instead") when 'cursor-added' - deprecate("Use Editor::onDidAddCursor instead") + deprecate("Use TextEditor::onDidAddCursor instead") when 'cursor-removed' - deprecate("Use Editor::onDidRemoveCursor instead") + deprecate("Use TextEditor::onDidRemoveCursor instead") when 'cursor-moved' - deprecate("Use Editor::onDidChangeCursorPosition instead") + deprecate("Use TextEditor::onDidChangeCursorPosition instead") when 'selection-added' - deprecate("Use Editor::onDidAddSelection instead") + deprecate("Use TextEditor::onDidAddSelection instead") when 'selection-removed' - deprecate("Use Editor::onDidRemoveSelection instead") + deprecate("Use TextEditor::onDidRemoveSelection instead") when 'selection-screen-range-changed' - deprecate("Use Editor::onDidChangeSelectionRange instead") + deprecate("Use TextEditor::onDidChangeSelectionRange instead") when 'decoration-added' - deprecate("Use Editor::onDidAddDecoration instead") + deprecate("Use TextEditor::onDidAddDecoration instead") when 'decoration-removed' - deprecate("Use Editor::onDidRemoveDecoration instead") + deprecate("Use TextEditor::onDidRemoveDecoration instead") when 'decoration-updated' - deprecate("Use Decoration::onDidChangeProperties instead. You will get the decoration back from `Editor::decorateMarker()`") + deprecate("Use Decoration::onDidChangeProperties instead. You will get the decoration back from `TextEditor::decorateMarker()`") when 'decoration-changed' deprecate("Use Marker::onDidChange instead. eg. `editor::decorateMarker(...).getMarker().onDidChange()`") when 'screen-lines-changed' - deprecate("Use Editor::onDidChange instead") + deprecate("Use TextEditor::onDidChange instead") when 'scroll-top-changed' - deprecate("Use Editor::onDidChangeScrollTop instead") + deprecate("Use TextEditor::onDidChangeScrollTop instead") when 'scroll-left-changed' - deprecate("Use Editor::onDidChangeScrollLeft instead") + deprecate("Use TextEditor::onDidChangeScrollLeft instead") EmitterMixin::on.apply(this, arguments) @@ -486,12 +486,12 @@ class Editor extends Model # Retrieves the current buffer's URI. getUri: -> @buffer.getUri() - # Create an {Editor} with its initial state based on this object + # Create an {TextEditor} with its initial state based on this object copy: -> tabLength = @getTabLength() displayBuffer = @displayBuffer.copy() softTabs = @getSoftTabs() - newEditor = new Editor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true, registerEditor: true}) + newEditor = new TextEditor({@buffer, displayBuffer, tabLength, softTabs, suppressCursorCreation: true, registerEditor: true}) for marker in @findMarkers(editorId: @id) marker.copy(editorId: newEditor.id, preserveFolds: true) newEditor @@ -507,7 +507,7 @@ class Editor extends Model # Set the number of characters that can be displayed horizontally in the # editor. # - # * `editorWidthInChars` A {Number} representing the width of the {EditorView} + # * `editorWidthInChars` A {Number} representing the width of the {TextEditorView} # in characters. setEditorWidthInChars: (editorWidthInChars) -> @displayBuffer.setEditorWidthInChars(editorWidthInChars) @@ -615,7 +615,7 @@ class Editor extends Model # * `bufferRow` A {Number} representing a zero-indexed buffer row. lineTextForBufferRow: (bufferRow) -> @buffer.lineForRow(bufferRow) lineForBufferRow: (bufferRow) -> - deprecate 'Use Editor::lineTextForBufferRow(bufferRow) instead' + deprecate 'Use TextEditor::lineTextForBufferRow(bufferRow) instead' @lineTextForBufferRow(bufferRow) # Essential: Returns a {String} representing the contents of the line at the @@ -631,13 +631,13 @@ class Editor extends Model # Returns {TokenizedLine} tokenizedLineForScreenRow: (screenRow) -> @displayBuffer.tokenizedLineForScreenRow(screenRow) lineForScreenRow: (screenRow) -> - deprecate "Editor::tokenizedLineForScreenRow(bufferRow) is the new name. But it's private. Try to use Editor::lineTextForScreenRow instead" + deprecate "TextEditor::tokenizedLineForScreenRow(bufferRow) is the new name. But it's private. Try to use TextEditor::lineTextForScreenRow instead" @tokenizedLineForScreenRow(screenRow) # {Delegates to: DisplayBuffer.tokenizedLinesForScreenRows} tokenizedLinesForScreenRows: (start, end) -> @displayBuffer.tokenizedLinesForScreenRows(start, end) linesForScreenRows: (start, end) -> - deprecate "Use Editor::tokenizedLinesForScreenRows instead" + deprecate "Use TextEditor::tokenizedLinesForScreenRows instead" @tokenizedLinesForScreenRows(start, end) # Returns a {Number} representing the line length for the given @@ -889,7 +889,7 @@ class Editor extends Model # Deprecated: Use {::duplicateLines} instead. duplicateLine: -> - deprecate("Use Editor::duplicateLines() instead") + deprecate("Use TextEditor::duplicateLines() instead") @duplicateLines() replaceSelectedText: (options={}, fn) -> @@ -1024,12 +1024,12 @@ class Editor extends Model # Deprecated: Use {::deleteToBeginningOfWord} instead. backspaceToBeginningOfWord: -> - deprecate("Use Editor::deleteToBeginningOfWord() instead") + deprecate("Use TextEditor::deleteToBeginningOfWord() instead") @deleteToBeginningOfWord() # Deprecated: Use {::deleteToBeginningOfLine} instead. backspaceToBeginningOfLine: -> - deprecate("Use Editor::deleteToBeginningOfLine() instead") + deprecate("Use TextEditor::deleteToBeginningOfLine() instead") @deleteToBeginningOfLine() ### @@ -1075,7 +1075,7 @@ class Editor extends Model abortTransaction: -> @buffer.abortTransaction() ### - Section: Editor Coordinates + Section: TextEditor Coordinates ### # Essential: Convert a position in buffer-coordinates to screen-coordinates. @@ -1438,7 +1438,7 @@ class Editor extends Model moveUp: (lineCount) -> @moveCursors (cursor) -> cursor.moveUp(lineCount, moveToEndOfSelection: true) moveCursorUp: (lineCount) -> - deprecate("Use Editor::moveUp() instead") + deprecate("Use TextEditor::moveUp() instead") @moveUp(lineCount) # Essential: Move every cursor down one row in screen coordinates. @@ -1447,7 +1447,7 @@ class Editor extends Model moveDown: (lineCount) -> @moveCursors (cursor) -> cursor.moveDown(lineCount, moveToEndOfSelection: true) moveCursorDown: (lineCount) -> - deprecate("Use Editor::moveDown() instead") + deprecate("Use TextEditor::moveDown() instead") @moveDown(lineCount) # Essential: Move every cursor left one column. @@ -1456,7 +1456,7 @@ class Editor extends Model moveLeft: (columnCount) -> @moveCursors (cursor) -> cursor.moveLeft(columnCount, moveToEndOfSelection: true) moveCursorLeft: -> - deprecate("Use Editor::moveLeft() instead") + deprecate("Use TextEditor::moveLeft() instead") @moveLeft() # Essential: Move every cursor right one column. @@ -1465,56 +1465,56 @@ class Editor extends Model moveRight: (columnCount) -> @moveCursors (cursor) -> cursor.moveRight(columnCount, moveToEndOfSelection: true) moveCursorRight: -> - deprecate("Use Editor::moveRight() instead") + deprecate("Use TextEditor::moveRight() instead") @moveRight() # Essential: Move every cursor to the beginning of its line in buffer coordinates. moveToBeginningOfLine: -> @moveCursors (cursor) -> cursor.moveToBeginningOfLine() moveCursorToBeginningOfLine: -> - deprecate("Use Editor::moveToBeginningOfLine() instead") + deprecate("Use TextEditor::moveToBeginningOfLine() instead") @moveToBeginningOfLine() # Essential: Move every cursor to the beginning of its line in screen coordinates. moveToBeginningOfScreenLine: -> @moveCursors (cursor) -> cursor.moveToBeginningOfScreenLine() moveCursorToBeginningOfScreenLine: -> - deprecate("Use Editor::moveToBeginningOfScreenLine() instead") + deprecate("Use TextEditor::moveToBeginningOfScreenLine() instead") @moveToBeginningOfScreenLine() # Essential: Move every cursor to the first non-whitespace character of its line. moveToFirstCharacterOfLine: -> @moveCursors (cursor) -> cursor.moveToFirstCharacterOfLine() moveCursorToFirstCharacterOfLine: -> - deprecate("Use Editor::moveToFirstCharacterOfLine() instead") + deprecate("Use TextEditor::moveToFirstCharacterOfLine() instead") @moveToFirstCharacterOfLine() # Essential: Move every cursor to the end of its line in buffer coordinates. moveToEndOfLine: -> @moveCursors (cursor) -> cursor.moveToEndOfLine() moveCursorToEndOfLine: -> - deprecate("Use Editor::moveToEndOfLine() instead") + deprecate("Use TextEditor::moveToEndOfLine() instead") @moveToEndOfLine() # Essential: Move every cursor to the end of its line in screen coordinates. moveToEndOfScreenLine: -> @moveCursors (cursor) -> cursor.moveToEndOfScreenLine() moveCursorToEndOfScreenLine: -> - deprecate("Use Editor::moveToEndOfScreenLine() instead") + deprecate("Use TextEditor::moveToEndOfScreenLine() instead") @moveToEndOfScreenLine() # Essential: Move every cursor to the beginning of its surrounding word. moveToBeginningOfWord: -> @moveCursors (cursor) -> cursor.moveToBeginningOfWord() moveCursorToBeginningOfWord: -> - deprecate("Use Editor::moveToBeginningOfWord() instead") + deprecate("Use TextEditor::moveToBeginningOfWord() instead") @moveToBeginningOfWord() # Essential: Move every cursor to the end of its surrounding word. moveToEndOfWord: -> @moveCursors (cursor) -> cursor.moveToEndOfWord() moveCursorToEndOfWord: -> - deprecate("Use Editor::moveToEndOfWord() instead") + deprecate("Use TextEditor::moveToEndOfWord() instead") @moveToEndOfWord() # Cursor Extended @@ -1525,7 +1525,7 @@ class Editor extends Model moveToTop: -> @moveCursors (cursor) -> cursor.moveToTop() moveCursorToTop: -> - deprecate("Use Editor::moveToTop() instead") + deprecate("Use TextEditor::moveToTop() instead") @moveToTop() # Extended: Move every cursor to the bottom of the buffer. @@ -1534,42 +1534,42 @@ class Editor extends Model moveToBottom: -> @moveCursors (cursor) -> cursor.moveToBottom() moveCursorToBottom: -> - deprecate("Use Editor::moveToBottom() instead") + deprecate("Use TextEditor::moveToBottom() instead") @moveToBottom() # Extended: Move every cursor to the beginning of the next word. moveToBeginningOfNextWord: -> @moveCursors (cursor) -> cursor.moveToBeginningOfNextWord() moveCursorToBeginningOfNextWord: -> - deprecate("Use Editor::moveToBeginningOfNextWord() instead") + deprecate("Use TextEditor::moveToBeginningOfNextWord() instead") @moveToBeginningOfNextWord() # Extended: Move every cursor to the previous word boundary. moveToPreviousWordBoundary: -> @moveCursors (cursor) -> cursor.moveToPreviousWordBoundary() moveCursorToPreviousWordBoundary: -> - deprecate("Use Editor::moveToPreviousWordBoundary() instead") + deprecate("Use TextEditor::moveToPreviousWordBoundary() instead") @moveToPreviousWordBoundary() # Extended: Move every cursor to the next word boundary. moveToNextWordBoundary: -> @moveCursors (cursor) -> cursor.moveToNextWordBoundary() moveCursorToNextWordBoundary: -> - deprecate("Use Editor::moveToNextWordBoundary() instead") + deprecate("Use TextEditor::moveToNextWordBoundary() instead") @moveToNextWordBoundary() # Extended: Move every cursor to the beginning of the next paragraph. moveToBeginningOfNextParagraph: -> @moveCursors (cursor) -> cursor.moveToBeginningOfNextParagraph() moveCursorToBeginningOfNextParagraph: -> - deprecate("Use Editor::moveToBeginningOfNextParagraph() instead") + deprecate("Use TextEditor::moveToBeginningOfNextParagraph() instead") @moveToBeginningOfNextParagraph() # Extended: Move every cursor to the beginning of the previous paragraph. moveToBeginningOfPreviousParagraph: -> @moveCursors (cursor) -> cursor.moveToBeginningOfPreviousParagraph() moveCursorToBeginningOfPreviousParagraph: -> - deprecate("Use Editor::moveToBeginningOfPreviousParagraph() instead") + deprecate("Use TextEditor::moveToBeginningOfPreviousParagraph() instead") @moveToBeginningOfPreviousParagraph() # Extended: Returns the most recently added {Cursor} @@ -1578,7 +1578,7 @@ class Editor extends Model # Deprecated: getCursor: -> - deprecate("Use Editor::getLastCursor() instead") + deprecate("Use TextEditor::getLastCursor() instead") @getLastCursor() # Extended: Returns the word surrounding the most recently added cursor. @@ -1892,14 +1892,14 @@ class Editor extends Model selectLinesContainingCursors: -> @expandSelectionsForward (selection) -> selection.selectLine() selectLine: -> - deprecate('Use Editor::selectLinesContainingCursors instead') + deprecate('Use TextEditor::selectLinesContainingCursors instead') @selectLinesContainingCursors() # Essential: Select the word surrounding each cursor. selectWordsContainingCursors: -> @expandSelectionsForward (selection) -> selection.selectWord() selectWord: -> - deprecate('Use Editor::selectWordsContainingCursors instead') + deprecate('Use TextEditor::selectWordsContainingCursors instead') @selectWordsContainingCursors() # Selection Extended @@ -1959,10 +1959,10 @@ class Editor extends Model # Deprecated: getSelection: (index) -> if index? - deprecate("Use Editor::getSelections()[index] instead when getting a specific selection") + deprecate("Use TextEditor::getSelections()[index] instead when getting a specific selection") @getSelections()[index] else - deprecate("Use Editor::getLastSelection() instead") + deprecate("Use TextEditor::getLastSelection() instead") @getLastSelection() # Extended: Get current {Selection}s. @@ -2222,7 +2222,7 @@ class Editor extends Model # Returns a {Boolean}. isSoftWrapped: (softWrapped) -> @displayBuffer.isSoftWrapped() getSoftWrapped: -> - deprecate("Use Editor::isSoftWrapped instead") + deprecate("Use TextEditor::isSoftWrapped instead") @displayBuffer.isSoftWrapped() # Essential: Enable or disable soft wrapping for this editor. @@ -2232,7 +2232,7 @@ class Editor extends Model # Returns a {Boolean}. setSoftWrapped: (softWrapped) -> @displayBuffer.setSoftWrapped(softWrapped) setSoftWrap: (softWrapped) -> - deprecate("Use Editor::setSoftWrapped instead") + deprecate("Use TextEditor::setSoftWrapped instead") @setSoftWrapped(softWrapped) # Essential: Toggle soft wrapping for this editor @@ -2240,7 +2240,7 @@ class Editor extends Model # Returns a {Boolean}. toggleSoftWrapped: -> @setSoftWrapped(not @isSoftWrapped()) toggleSoftWrap: -> - deprecate("Use Editor::toggleSoftWrapped instead") + deprecate("Use TextEditor::toggleSoftWrapped instead") @toggleSoftWrapped() # Public: Gets the column at which column will soft wrap @@ -2354,7 +2354,7 @@ class Editor extends Model # Returns an {Array} of {String}s. scopesAtCursor: -> @getLastCursor().getScopes() getCursorScopes: -> - deprecate 'Use Editor::scopesAtCursor() instead' + deprecate 'Use TextEditor::scopesAtCursor() instead' @scopesAtCursor() # Essential: Get the syntactic scopes for the given position in buffer @@ -2574,7 +2574,7 @@ class Editor extends Model @displayBuffer.outermostFoldsInBufferRowRange(startRow, endRow) ### - Section: Scrolling the Editor + Section: Scrolling the TextEditor ### # Essential: Scroll the editor to reveal the most recently added cursor if it is @@ -2676,7 +2676,7 @@ class Editor extends Model @addSelection(marker) ### - Section: Editor Rendering + Section: TextEditor Rendering ### # Public: Retrieves the greyed out placeholder of a mini editor. @@ -2783,7 +2783,7 @@ class Editor extends Model # Deprecated: Call {::joinLines} instead. joinLine: -> - deprecate("Use Editor::joinLines() instead") + deprecate("Use TextEditor::joinLines() instead") @joinLines() ### @@ -2791,6 +2791,6 @@ class Editor extends Model ### inspect: -> - "" + "" logScreenLines: (start, end) -> @displayBuffer.logLines(start, end) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 2a3971501..ffb0ac7f9 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -9,7 +9,7 @@ scrollbarStyle = require 'scrollbar-style' fs = require 'fs-plus' PaneView = require './pane-view' PaneContainerView = require './pane-container-view' -Editor = require './editor' +TextEditor = require './text-editor' # Extended: The top-level view for the entire window. An instance of this class is # available via the `atom.workspaceView` global. @@ -94,11 +94,11 @@ class WorkspaceView extends View ### # Essential: Register a function to be called for every current and future - # editor view in the workspace (only includes {EditorView}s that are pane + # editor view in the workspace (only includes {TextEditorView}s that are pane # items). # - # * `callback` A {Function} with an {EditorView} as its only argument. - # * `editorView` {EditorView} + # * `callback` A {Function} with an {TextEditorView} as its only argument. + # * `editorView` {TextEditorView} # # Returns a subscription object with an `.off` method that you can call to # unregister the callback. @@ -240,7 +240,7 @@ class WorkspaceView extends View # to the view objects. Also consider using {::eachEditorView}, which will call # a callback for all current and *future* editor views. # - # Returns an {Array} of {EditorView}s. + # Returns an {Array} of {TextEditorView}s. getEditorViews: -> for editorElement in @panes.element.querySelectorAll('.pane > .item-views > .editor') $(editorElement).view() @@ -258,13 +258,13 @@ class WorkspaceView extends View when 'beep' deprecate('Use Atom::onDidBeep instead') when 'cursor:moved' - deprecate('Use Editor::onDidChangeCursorPosition instead') + deprecate('Use TextEditor::onDidChangeCursorPosition instead') when 'editor:attached' - deprecate('Use Editor::onDidAddTextEditor instead') + deprecate('Use TextEditor::onDidAddTextEditor instead') when 'editor:detached' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'editor:will-be-removed' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'pane:active-item-changed' deprecate('Use Pane::onDidChangeActiveItem instead') when 'pane:active-item-modified-status-changed' @@ -288,38 +288,38 @@ class WorkspaceView extends View when 'pane-container:active-pane-item-changed' deprecate('Use Workspace::onDidChangeActivePaneItem instead') when 'selection:changed' - deprecate('Use Editor::onDidChangeSelectionRange instead') + deprecate('Use TextEditor::onDidChangeSelectionRange instead') when 'uri-opened' deprecate('Use Workspace::onDidOpen instead') originalWorkspaceViewOn.apply(this, arguments) - EditorView = require './editor-view' - originalEditorViewOn = EditorView::on - EditorView::on = (eventName) -> + TextEditorView = require './text-editor-view' + originalEditorViewOn = TextEditorView::on + TextEditorView::on = (eventName) -> switch eventName when 'cursor:moved' - deprecate('Use Editor::onDidChangeCursorPosition instead') + deprecate('Use TextEditor::onDidChangeCursorPosition instead') when 'editor:attached' - deprecate('Use Editor::onDidAddTextEditor instead') + deprecate('Use TextEditor::onDidAddTextEditor instead') when 'editor:detached' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'editor:will-be-removed' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'selection:changed' - deprecate('Use Editor::onDidChangeSelectionRange instead') + deprecate('Use TextEditor::onDidChangeSelectionRange instead') originalEditorViewOn.apply(this, arguments) originalPaneViewOn = PaneView::on PaneView::on = (eventName) -> switch eventName when 'cursor:moved' - deprecate('Use Editor::onDidChangeCursorPosition instead') + deprecate('Use TextEditor::onDidChangeCursorPosition instead') when 'editor:attached' - deprecate('Use Editor::onDidAddTextEditor instead') + deprecate('Use TextEditor::onDidAddTextEditor instead') when 'editor:detached' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'editor:will-be-removed' - deprecate('Use Editor::onDidDestroy instead') + deprecate('Use TextEditor::onDidDestroy instead') when 'pane:active-item-changed' deprecate('Use Pane::onDidChangeActiveItem instead') when 'pane:active-item-modified-status-changed' @@ -341,7 +341,7 @@ class WorkspaceView extends View when 'pane:removed' deprecate('Use Pane::onDidDestroy instead') when 'selection:changed' - deprecate('Use Editor::onDidChangeSelectionRange instead') + deprecate('Use TextEditor::onDidChangeSelectionRange instead') originalPaneViewOn.apply(this, arguments) # Deprecated diff --git a/src/workspace.coffee b/src/workspace.coffee index 78c178e19..3bdf1d2bb 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -7,7 +7,7 @@ Serializable = require 'serializable' Delegator = require 'delegato' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' CommandInstaller = require './command-installer' -Editor = require './editor' +TextEditor = require './text-editor' PaneContainer = require './pane-container' Pane = require './pane' ViewRegistry = require './view-registry' @@ -20,7 +20,7 @@ WorkspaceElement = require './workspace-element' # editors, and manipulate panes. To add panels, you'll need to use the # {WorkspaceView} class for now until we establish APIs at the model layer. # -# * `editor` {Editor} the new editor +# * `editor` {TextEditor} the new editor # module.exports = class Workspace extends Model @@ -161,7 +161,7 @@ class Workspace extends Model # editors in the workspace. # # * `callback` {Function} to be called with current and future text editors. - # * `editor` An {Editor} that is present in {::getTextEditors} at the time + # * `editor` An {TextEditor} that is present in {::getTextEditors} at the time # of subscription or that is added at some later time. # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. @@ -266,7 +266,7 @@ class Workspace extends Model # # * `callback` {Function} to be called panes are added. # * `event` {Object} with the following keys: - # * `textEditor` {Editor} that was added. + # * `textEditor` {TextEditor} that was added. # * `pane` {Pane} containing the added text editor. # * `index` {Number} indicating the index of the added text editor in its # pane. @@ -274,7 +274,7 @@ class Workspace extends Model # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidAddTextEditor: (callback) -> @onDidAddPaneItem ({item, pane, index}) -> - callback({textEditor: item, pane, index}) if item instanceof Editor + callback({textEditor: item, pane, index}) if item instanceof TextEditor eachEditor: (callback) -> deprecate("Use Workspace::observeTextEditors instead") @@ -287,7 +287,7 @@ class Workspace extends Model editors = [] for pane in @paneContainer.getPanes() - editors.push(item) for item in pane.getItems() when item instanceof Editor + editors.push(item) for item in pane.getItems() when item instanceof TextEditor editors @@ -324,7 +324,7 @@ class Workspace extends Model # If `false`, only the active pane will be searched for # an existing item for the same URI. Defaults to `false`. # - # Returns a promise that resolves to the {Editor} for the file URI. + # Returns a promise that resolves to the {TextEditor} for the file URI. open: (uri, options={}) -> searchAllPanes = options.searchAllPanes split = options.split @@ -418,7 +418,7 @@ class Workspace extends Model # Public: Register an opener for a uri. # - # An {Editor} will be used if no openers return a value. + # An {TextEditor} will be used if no openers return a value. # # ## Examples # @@ -457,17 +457,17 @@ class Workspace extends Model # Essential: Get all text editors in the workspace. # - # Returns an {Array} of {Editor}s. + # Returns an {Array} of {TextEditor}s. getTextEditors: -> - @getPaneItems().filter (item) -> item instanceof Editor + @getPaneItems().filter (item) -> item instanceof TextEditor - # Essential: Get the active item if it is an {Editor}. + # Essential: Get the active item if it is an {TextEditor}. # - # Returns an {Editor} or `undefined` if the current active item is not an - # {Editor}. + # Returns an {TextEditor} or `undefined` if the current active item is not an + # {TextEditor}. getActiveTextEditor: -> activeItem = @getActivePaneItem() - activeItem if activeItem instanceof Editor + activeItem if activeItem instanceof TextEditor # Deprecated: getActiveEditor: ->