mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge branch 'master' of github.com:github/atom
Conflicts: src/app/editor.coffee
This commit is contained in:
@@ -13,7 +13,7 @@ class Cursor extends View
|
||||
editor: null
|
||||
wordRegex: /(\w+)|([^\w\s]+)/g
|
||||
|
||||
initialize: ({editor, screenPosition}) ->
|
||||
initialize: ({editor, screenPosition} = {}) ->
|
||||
@editor = editor
|
||||
@anchor = new Anchor(@editor, screenPosition)
|
||||
@selection = @editor.compositeSelection.addSelectionForCursor(this)
|
||||
|
||||
@@ -24,7 +24,7 @@ class Editor extends View
|
||||
@div class: 'vertical-scrollbar', outlet: 'verticalScrollbar', =>
|
||||
@div outlet: 'verticalScrollbarContent'
|
||||
|
||||
@classes: ({mini}) ->
|
||||
@classes: ({mini} = {}) ->
|
||||
classes = ['editor']
|
||||
classes.push 'mini' if mini
|
||||
classes.join(' ')
|
||||
@@ -57,7 +57,7 @@ class Editor extends View
|
||||
|
||||
new Editor(viewState)
|
||||
|
||||
initialize: ({editSessions, activeEditSessionIndex, buffer, isFocused, @mini}) ->
|
||||
initialize: ({editSessions, activeEditSessionIndex, buffer, isFocused, @mini} = {}) ->
|
||||
requireStylesheet 'editor.css'
|
||||
requireStylesheet 'theme/twilight.css'
|
||||
|
||||
@@ -228,6 +228,7 @@ class Editor extends View
|
||||
afterAttach: (onDom) ->
|
||||
return if @attached or not onDom
|
||||
@attached = true
|
||||
@clearLines()
|
||||
@subscribeToFontSize()
|
||||
@calculateDimensions()
|
||||
@setMaxLineLength() if @softWrap
|
||||
@@ -278,17 +279,22 @@ class Editor extends View
|
||||
@scrollTop() + @scrollView.height()
|
||||
|
||||
renderVisibleLines: ->
|
||||
@clearLines()
|
||||
@updateVisibleLines()
|
||||
|
||||
clearLines: ->
|
||||
@lineCache = []
|
||||
@lines.find('.line').remove()
|
||||
|
||||
@firstRenderedScreenRow = -1
|
||||
@lastRenderedScreenRow = -1
|
||||
@updateVisibleLines()
|
||||
|
||||
updateVisibleLines: ->
|
||||
firstVisibleScreenRow = @getFirstVisibleScreenRow()
|
||||
lastVisibleScreenRow = @getLastVisibleScreenRow()
|
||||
|
||||
return if @firstRenderedScreenRow <= firstVisibleScreenRow and @lastRenderedScreenRow >= lastVisibleScreenRow
|
||||
|
||||
@gutter.renderLineNumbers(firstVisibleScreenRow, lastVisibleScreenRow)
|
||||
|
||||
if firstVisibleScreenRow > @firstRenderedScreenRow
|
||||
@@ -396,6 +402,7 @@ class Editor extends View
|
||||
editSession = @getActiveEditSession()
|
||||
@scrollTop(editSession.scrollTop ? 0)
|
||||
@scrollView.scrollLeft(editSession.scrollLeft ? 0)
|
||||
@verticalScrollbar.trigger 'scroll'
|
||||
|
||||
saveCurrentEditSession: ->
|
||||
@editSessions[@activeEditSessionIndex] =
|
||||
@@ -560,13 +567,14 @@ class Editor extends View
|
||||
subscribeToFontSize: ->
|
||||
return unless rootView = @rootView()
|
||||
@setFontSize(rootView.getFontSize())
|
||||
rootView.on "font-size-change.editor#{@id}", =>
|
||||
@setFontSize(rootView.getFontSize())
|
||||
@calculateDimensions()
|
||||
@compositeCursor.updateAppearance()
|
||||
rootView.on "font-size-change.editor#{@id}", => @setFontSize(rootView.getFontSize())
|
||||
|
||||
setFontSize: (fontSize) ->
|
||||
@css('font-size', fontSize + 'px') if fontSize
|
||||
if fontSize
|
||||
@css('font-size', fontSize + 'px')
|
||||
@calculateDimensions()
|
||||
@compositeCursor.updateAppearance()
|
||||
@updateVisibleLines()
|
||||
|
||||
getCursors: -> @compositeCursor.getCursors()
|
||||
moveCursorUp: -> @compositeCursor.moveUp()
|
||||
|
||||
@@ -21,7 +21,7 @@ class RootView extends View
|
||||
@div id: 'panes', outlet: 'panes'
|
||||
|
||||
@deserialize: ({ projectPath, panesViewState, extensionStates }) ->
|
||||
rootView = new RootView(pathToOpen: projectPath)
|
||||
rootView = new RootView(projectPath)
|
||||
rootView.setRootPane(rootView.deserializeView(panesViewState)) if panesViewState
|
||||
rootView.extensionStates = extensionStates if extensionStates
|
||||
rootView
|
||||
@@ -30,7 +30,7 @@ class RootView extends View
|
||||
extensionStates: null
|
||||
fontSize: 18
|
||||
|
||||
initialize: ({ pathToOpen }) ->
|
||||
initialize: (pathToOpen) ->
|
||||
@extensions = {}
|
||||
@extensionStates = {}
|
||||
@project = new Project(pathToOpen)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Selection extends View
|
||||
retainSelection: null
|
||||
regions: null
|
||||
|
||||
initialize: ({@editor, @cursor}) ->
|
||||
initialize: ({@editor, @cursor} = {}) ->
|
||||
@regions = []
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
|
||||
@@ -42,7 +42,7 @@ windowAdditions =
|
||||
if rootViewState
|
||||
@rootView = RootView.deserialize(rootViewState)
|
||||
else
|
||||
@rootView = new RootView(pathToOpen: pathToOpen)
|
||||
@rootView = new RootView(pathToOpen)
|
||||
@rootView.open() unless pathToOpen
|
||||
|
||||
$(@rootViewParentSelector).append @rootView
|
||||
|
||||
@@ -5,12 +5,12 @@ $ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class Dialog extends View
|
||||
@content: ({prompt}) ->
|
||||
@content: ({prompt} = {}) ->
|
||||
@div class: 'tree-view-dialog', =>
|
||||
@div prompt, outlet: 'prompt'
|
||||
@subview 'miniEditor', new Editor(mini: true)
|
||||
|
||||
initialize: ({path, @onConfirm, select}) ->
|
||||
initialize: ({path, @onConfirm, select} = {}) ->
|
||||
@miniEditor.focus()
|
||||
@on 'tree-view:confirm', => @confirm()
|
||||
@on 'tree-view:cancel', => @cancel()
|
||||
|
||||
@@ -5,7 +5,7 @@ $ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class DirectoryView extends View
|
||||
@content: ({directory, isExpanded}) ->
|
||||
@content: ({directory, isExpanded} = {}) ->
|
||||
@li class: 'directory entry', =>
|
||||
@div outlet: 'header', class: 'header', =>
|
||||
@span '▸', class: 'disclosure-arrow', outlet: 'disclosureArrow'
|
||||
@@ -15,7 +15,7 @@ class DirectoryView extends View
|
||||
entries: null
|
||||
header: null
|
||||
|
||||
initialize: ({@directory, isExpanded}) ->
|
||||
initialize: ({@directory, isExpanded} = {}) ->
|
||||
@expand() if isExpanded
|
||||
@disclosureArrow.on 'click', => @toggleExpansion()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user