diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index 7ebcb1b30..807e5ab7b 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -1,11 +1,11 @@ _ = require 'underscore-plus' {extend, flatten, toArray, last} = _ -EditorView = require '../src/text-editor-view' -EditorComponent = require '../src/text-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/editor-spec.coffee index 8274c28ae..661bdf28a 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -1,7 +1,7 @@ clipboard = require 'clipboard' -Editor = require '../src/text-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 '?' diff --git a/spec/random-editor-spec.coffee b/spec/random-editor-spec.coffee index e08f598c0..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/text-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 d3cd09c54..0e64b60fd 100644 --- a/spec/selection-spec.coffee +++ b/spec/selection-spec.coffee @@ -1,11 +1,11 @@ -Editor = require '../src/text-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 9f99ba87f..b94d33f0d 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/text-editor' -EditorView = require '../src/text-editor-view' +TextEditor = require '../src/text-editor' +TextEditorView = require '../src/text-editor-view' TokenizedBuffer = require '../src/tokenized-buffer' -EditorComponent = require '../src/text-editor-component' +TextEditorComponent = require '../src/text-editor-component' pathwatcher = require 'pathwatcher' clipboard = require 'clipboard' @@ -92,7 +92,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 @@ -103,14 +103,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(WorkspaceView.prototype, 'setTitle').andCallFake (@title) -> 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/window-spec.coffee b/spec/window-spec.coffee index 7cfa93895..5f12a51fe 100644 --- a/spec/window-spec.coffee +++ b/spec/window-spec.coffee @@ -1,6 +1,6 @@ {$, $$} = require 'atom' path = require 'path' -Editor = require '../src/text-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 1efc240f1..f47b75e85 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/text-editor-view' +TextEditorView = require '../src/text-editor-view' PaneView = require '../src/pane-view' Workspace = require '../src/workspace' @@ -253,7 +253,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 cb80a90d0..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 './text-editor' + TextEditor = require './text-editor' @windowEventHandler = new WindowEventHandler 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/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 1b4de2895..127135134 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 93952b1a1..92a97a45e 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 './text-editor' +TextEditor = require './text-editor' PaneView = null # Extended: A container for presenting content in the center of the workspace. @@ -261,9 +261,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 8ecd6604b..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 './text-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 51721785b..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 './text-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/text-editor-component.coffee b/src/text-editor-component.coffee index bb5bc7eda..8fb98662e 100644 --- a/src/text-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/text-editor-view.coffee b/src/text-editor-view.coffee index 994d88d37..b613cbc95 100644 --- a/src/text-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 './text-editor' -EditorComponent = require './text-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 './text-editor-component' # console.log(editorView.getModel().getPath()) # ``` module.exports = -class EditorView extends View +class TextEditorView extends View @configDefaults: fontFamily: '' fontSize: 16 @@ -69,23 +69,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 +94,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 +128,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 +171,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 +251,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 +277,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 +312,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/text-editor.coffee b/src/text-editor.coffee index f382244af..33921a257 100644 --- a/src/text-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) @@ -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 2208d88cf..46de2ef49 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -13,7 +13,7 @@ PaneView = require './pane-view' PaneColumnView = require './pane-column-view' PaneRowView = require './pane-row-view' PaneContainerView = require './pane-container-view' -Editor = require './text-editor' +TextEditor = require './text-editor' atom.commands.add '.workspace', 'window:increase-font-size': -> @getModel().increaseFontSize() @@ -183,11 +183,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. @@ -403,7 +403,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() @@ -421,13 +421,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' @@ -451,38 +451,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 './text-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' @@ -504,7 +504,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 d4296f09c..65bf5895f 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -6,7 +6,7 @@ Q = require 'q' Serializable = require 'serializable' Delegator = require 'delegato' {Emitter} = require 'event-kit' -Editor = require './text-editor' +TextEditor = require './text-editor' PaneContainer = require './pane-container' Pane = require './pane' ViewRegistry = require './view-registry' @@ -19,7 +19,7 @@ WorkspaceView = null # 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 @@ -104,7 +104,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. @@ -200,7 +200,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. @@ -208,7 +208,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") @@ -221,7 +221,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 @@ -258,7 +258,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 @@ -352,7 +352,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 # @@ -391,17 +391,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: ->