mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
We use multiple ace editors per window now.
This commit is contained in:
@@ -7,16 +7,20 @@ ace = require 'ace/ace'
|
||||
|
||||
module.exports =
|
||||
class EditorPane extends Pane
|
||||
html: $ "<div id='ace-editor'></div>"
|
||||
id: null
|
||||
|
||||
html: null
|
||||
|
||||
position: 'main'
|
||||
|
||||
editor: null
|
||||
|
||||
constructor: ->
|
||||
@id = _.uniqueId 'editor-'
|
||||
@html = $ "<div id='#{@id}'></div>"
|
||||
@show()
|
||||
|
||||
@ace = ace.edit 'ace-editor'
|
||||
@ace = ace.edit @id
|
||||
|
||||
# This stuff should all be grabbed from the .atomicity dir
|
||||
@ace.setTheme require "ace/theme/twilight"
|
||||
|
||||
@@ -56,18 +56,17 @@ class Editor extends Resource
|
||||
if @url then _.last @url.split '/' else 'untitled'
|
||||
|
||||
show: ->
|
||||
@ace.setSession @session
|
||||
@pane.show()
|
||||
@ace.resize()
|
||||
window.setTitle @title()
|
||||
|
||||
open: (url) ->
|
||||
if url
|
||||
return false if not fs.isFile url
|
||||
return false if @url
|
||||
|
||||
# HACK! We want only one EditorPane for all the Editors.
|
||||
@pane = Editor.pane ?= new EditorPane
|
||||
window.setTitle @title()
|
||||
|
||||
@pane ?= new EditorPane
|
||||
@ace = @pane.ace
|
||||
@url = url
|
||||
|
||||
@@ -77,6 +76,7 @@ class Editor extends Resource
|
||||
@session.setTabSize if useSoftTabs then @guessTabSize code else 8
|
||||
@session.setUndoManager new UndoManager
|
||||
@session.on 'change', => @dirty = true
|
||||
@ace.setSession @session
|
||||
|
||||
@show()
|
||||
@setModeForURL @url if @url
|
||||
|
||||
Reference in New Issue
Block a user