diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 3a7df725b..4470328b5 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -31,13 +31,16 @@ module.exports = (grunt) -> # This allows all subsequent paths to the relative to the root of the repo grunt.file.setBase(path.resolve('..')) - [major, minor, patch] = packageJson.version.split('.') tmpDir = os.tmpdir() appName = if process.platform is 'darwin' then 'Atom.app' else 'Atom' buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build') buildDir = path.resolve(buildDir) installDir = grunt.option('install-dir') + channel = grunt.option('channel') + channel ?= process.env.JANKY_BRANCH if process.env.JANKY_BRANCH in ['stable', 'beta'] + channel ?= 'dev' + home = if process.platform is 'win32' then process.env.USERPROFILE else process.env.HOME electronDownloadDir = path.join(home, '.atom', 'electron') @@ -153,7 +156,7 @@ module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON('package.json') - atom: {appDir, appName, symbolsDir, buildDir, contentsDir, installDir, shellAppDir} + atom: {appDir, appName, symbolsDir, buildDir, contentsDir, installDir, shellAppDir, channel} docsOutputDir: 'docs/output' @@ -234,8 +237,8 @@ module.exports = (grunt) -> outputDirectory: path.join(buildDir, 'installer') authors: 'GitHub Inc.' loadingGif: path.resolve(__dirname, '..', 'resources', 'win', 'loading.gif') - iconUrl: 'https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico' - setupIcon: path.resolve(__dirname, '..', 'resources', 'win', 'atom.ico') + iconUrl: 'https://raw.githubusercontent.com/atom/atom/master/resources/app-icons/stable/atom.ico' + setupIcon: path.resolve(__dirname, '..', 'resources', 'app-icons', 'stable', 'atom.ico') remoteReleases: 'https://atom.io/api/updates' shell: diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index 803249c1c..415f2f660 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -40,7 +40,6 @@ module.exports = (grunt) -> 'benchmark' 'dot-atom' 'vendor' - 'resources' ] {devDependencies} = grunt.file.readJSON('package.json') @@ -86,9 +85,6 @@ module.exports = (grunt) -> path.join('build', 'Release', 'obj') path.join('build', 'Release', '.deps') path.join('vendor', 'apm') - path.join('resources', 'linux') - path.join('resources', 'mac') - path.join('resources', 'win') # These are only require in dev mode when the grammar isn't precompiled path.join('snippets', 'node_modules', 'loophole') @@ -179,10 +175,14 @@ module.exports = (grunt) -> if process.platform isnt 'win32' fs.symlinkSync(path.join('..', '..', 'bin', 'apm'), path.resolve(appDir, '..', 'new-app', 'apm', 'node_modules', '.bin', 'apm')) + channel = grunt.config.get('atom.channel') + + cp path.join('resources', 'app-icons', channel, 'png', '1024.png'), path.join(appDir, 'resources', 'atom.png') + if process.platform is 'darwin' - grunt.file.recurse path.join('resources', 'mac'), (sourcePath, rootDirectory, subDirectory='', filename) -> - unless /.+\.plist/.test(sourcePath) - grunt.file.copy(sourcePath, path.resolve(appDir, '..', subDirectory, filename)) + cp path.join('resources', 'app-icons', channel, 'atom.icns'), path.resolve(appDir, '..', 'atom.icns') + cp path.join('resources', 'mac', 'file.icns'), path.resolve(appDir, '..', 'file.icns') + cp path.join('resources', 'mac', 'speakeasy.pem'), path.resolve(appDir, '..', 'speakeasy.pem') if process.platform is 'win32' cp path.join('resources', 'win', 'atom.cmd'), path.join(shellAppDir, 'resources', 'cli', 'atom.cmd') @@ -191,7 +191,7 @@ module.exports = (grunt) -> cp path.join('resources', 'win', 'apm.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh') if process.platform is 'linux' - cp path.join('resources', 'linux', 'icons'), path.join(buildDir, 'icons') + cp path.join('resources', 'app-icons', channel, 'png'), path.join(buildDir, 'icons') dependencies = ['compile', 'generate-license:save', 'generate-module-cache', 'compile-packages-slug'] dependencies.push('copy-info-plist') if process.platform is 'darwin' diff --git a/build/tasks/mkdeb-task.coffee b/build/tasks/mkdeb-task.coffee index 9fb8c7e4b..e448bb91e 100644 --- a/build/tasks/mkdeb-task.coffee +++ b/build/tasks/mkdeb-task.coffee @@ -23,6 +23,7 @@ module.exports = (grunt) -> grunt.registerTask 'mkdeb', 'Create debian package', -> done = @async() buildDir = grunt.config.get('atom.buildDir') + channel = grunt.config.get('atom.channel') if process.arch is 'ia32' arch = 'i386' @@ -41,10 +42,10 @@ module.exports = (grunt) -> data = {name, version, description, section, arch, maintainer, installDir, iconName, installedSize, executable} controlFilePath = fillTemplate(path.join('resources', 'linux', 'debian', 'control'), data) desktopFilePath = fillTemplate(path.join('resources', 'linux', 'atom.desktop'), data) - icon = path.join('resources', 'atom.png') + iconPath = path.join('resources', 'app-icons', channel, 'png', '1024.png') cmd = path.join('script', 'mkdeb') - args = [version, arch, controlFilePath, desktopFilePath, icon, buildDir] + args = [version, arch, controlFilePath, desktopFilePath, iconPath, buildDir] spawn {cmd, args}, (error) -> if error? done(error) diff --git a/build/tasks/set-exe-icon-task.coffee b/build/tasks/set-exe-icon-task.coffee index 0d9e2c0f6..f29a19680 100644 --- a/build/tasks/set-exe-icon-task.coffee +++ b/build/tasks/set-exe-icon-task.coffee @@ -4,9 +4,10 @@ module.exports = (grunt) -> grunt.registerTask 'set-exe-icon', 'Set icon of the exe', -> done = @async() + channel = grunt.config.get('atom.channel') shellAppDir = grunt.config.get('atom.shellAppDir') shellExePath = path.join(shellAppDir, 'atom.exe') - iconPath = path.resolve('resources', 'win', 'atom.ico') + iconPath = path.resolve('resources', 'app-icons', channel, 'atom.ico') rcedit = require('rcedit') rcedit(shellExePath, {'icon': iconPath}, done) diff --git a/package.json b/package.json index 9af702726..baeb5f3a5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.0.12-dev", + "version": "1.2.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { @@ -109,7 +109,7 @@ "package-generator": "0.40.0", "release-notes": "0.53.0", "settings-view": "0.216.0", - "snippets": "0.98.0", + "snippets": "0.99.0", "spell-check": "0.59.0", "status-bar": "0.79.0", "styleguide": "0.44.0", @@ -121,14 +121,14 @@ "welcome": "0.30.0", "whitespace": "0.31.0", "wrap-guide": "0.36.0", - "language-c": "0.47.1", + "language-c": "0.48.0", "language-clojure": "0.16.0", "language-coffee-script": "0.41.0", "language-csharp": "0.10.0", "language-css": "0.34.0", "language-gfm": "0.81.0", "language-git": "0.10.0", - "language-go": "0.37.0", + "language-go": "0.39.0", "language-html": "0.41.2", "language-hyperlink": "0.14.0", "language-java": "0.16.0", @@ -142,7 +142,7 @@ "language-php": "0.30.0", "language-property-list": "0.8.0", "language-python": "0.40.0", - "language-ruby": "0.58.0", + "language-ruby": "0.59.0", "language-ruby-on-rails": "0.22.0", "language-sass": "0.41.0", "language-shellscript": "0.17.0", diff --git a/resources/app-icons/beta/atom.icns b/resources/app-icons/beta/atom.icns new file mode 100644 index 000000000..69abe031e Binary files /dev/null and b/resources/app-icons/beta/atom.icns differ diff --git a/resources/app-icons/beta/atom.ico b/resources/app-icons/beta/atom.ico new file mode 100644 index 000000000..e470837de Binary files /dev/null and b/resources/app-icons/beta/atom.ico differ diff --git a/resources/app-icons/beta/png/1024.png b/resources/app-icons/beta/png/1024.png new file mode 100644 index 000000000..b3d712d4a Binary files /dev/null and b/resources/app-icons/beta/png/1024.png differ diff --git a/resources/app-icons/beta/png/128.png b/resources/app-icons/beta/png/128.png new file mode 100644 index 000000000..e67a95a7a Binary files /dev/null and b/resources/app-icons/beta/png/128.png differ diff --git a/resources/app-icons/beta/png/16.png b/resources/app-icons/beta/png/16.png new file mode 100644 index 000000000..c7a0c0d72 Binary files /dev/null and b/resources/app-icons/beta/png/16.png differ diff --git a/resources/app-icons/beta/png/24.png b/resources/app-icons/beta/png/24.png new file mode 100644 index 000000000..dd8dcf22a Binary files /dev/null and b/resources/app-icons/beta/png/24.png differ diff --git a/resources/app-icons/beta/png/256.png b/resources/app-icons/beta/png/256.png new file mode 100644 index 000000000..b48fbf1ae Binary files /dev/null and b/resources/app-icons/beta/png/256.png differ diff --git a/resources/app-icons/beta/png/32.png b/resources/app-icons/beta/png/32.png new file mode 100644 index 000000000..238539f47 Binary files /dev/null and b/resources/app-icons/beta/png/32.png differ diff --git a/resources/app-icons/beta/png/48.png b/resources/app-icons/beta/png/48.png new file mode 100644 index 000000000..17b155db6 Binary files /dev/null and b/resources/app-icons/beta/png/48.png differ diff --git a/resources/app-icons/beta/png/512.png b/resources/app-icons/beta/png/512.png new file mode 100644 index 000000000..1fa42ab4f Binary files /dev/null and b/resources/app-icons/beta/png/512.png differ diff --git a/resources/app-icons/beta/png/64.png b/resources/app-icons/beta/png/64.png new file mode 100644 index 000000000..19d27487d Binary files /dev/null and b/resources/app-icons/beta/png/64.png differ diff --git a/resources/app-icons/dev/atom.icns b/resources/app-icons/dev/atom.icns new file mode 100644 index 000000000..84319be3d Binary files /dev/null and b/resources/app-icons/dev/atom.icns differ diff --git a/resources/app-icons/dev/atom.ico b/resources/app-icons/dev/atom.ico new file mode 100644 index 000000000..6656f2623 Binary files /dev/null and b/resources/app-icons/dev/atom.ico differ diff --git a/resources/app-icons/dev/png/1024.png b/resources/app-icons/dev/png/1024.png new file mode 100644 index 000000000..36dcbf3a7 Binary files /dev/null and b/resources/app-icons/dev/png/1024.png differ diff --git a/resources/app-icons/dev/png/128.png b/resources/app-icons/dev/png/128.png new file mode 100644 index 000000000..c0b33e630 Binary files /dev/null and b/resources/app-icons/dev/png/128.png differ diff --git a/resources/app-icons/dev/png/16.png b/resources/app-icons/dev/png/16.png new file mode 100644 index 000000000..8466559c2 Binary files /dev/null and b/resources/app-icons/dev/png/16.png differ diff --git a/resources/app-icons/dev/png/24.png b/resources/app-icons/dev/png/24.png new file mode 100644 index 000000000..55e6f2da7 Binary files /dev/null and b/resources/app-icons/dev/png/24.png differ diff --git a/resources/app-icons/dev/png/256.png b/resources/app-icons/dev/png/256.png new file mode 100644 index 000000000..3faf4d2c5 Binary files /dev/null and b/resources/app-icons/dev/png/256.png differ diff --git a/resources/app-icons/dev/png/32.png b/resources/app-icons/dev/png/32.png new file mode 100644 index 000000000..5f3a0e68c Binary files /dev/null and b/resources/app-icons/dev/png/32.png differ diff --git a/resources/app-icons/dev/png/48.png b/resources/app-icons/dev/png/48.png new file mode 100644 index 000000000..adbbcf751 Binary files /dev/null and b/resources/app-icons/dev/png/48.png differ diff --git a/resources/app-icons/dev/png/512.png b/resources/app-icons/dev/png/512.png new file mode 100644 index 000000000..c03c309fe Binary files /dev/null and b/resources/app-icons/dev/png/512.png differ diff --git a/resources/app-icons/dev/png/64.png b/resources/app-icons/dev/png/64.png new file mode 100644 index 000000000..8aba24648 Binary files /dev/null and b/resources/app-icons/dev/png/64.png differ diff --git a/resources/mac/atom.icns b/resources/app-icons/stable/atom.icns similarity index 100% rename from resources/mac/atom.icns rename to resources/app-icons/stable/atom.icns diff --git a/resources/win/atom.ico b/resources/app-icons/stable/atom.ico similarity index 100% rename from resources/win/atom.ico rename to resources/app-icons/stable/atom.ico diff --git a/resources/linux/icons/1024.png b/resources/app-icons/stable/png/1024.png similarity index 100% rename from resources/linux/icons/1024.png rename to resources/app-icons/stable/png/1024.png diff --git a/resources/linux/icons/128.png b/resources/app-icons/stable/png/128.png similarity index 100% rename from resources/linux/icons/128.png rename to resources/app-icons/stable/png/128.png diff --git a/resources/linux/icons/16.png b/resources/app-icons/stable/png/16.png similarity index 100% rename from resources/linux/icons/16.png rename to resources/app-icons/stable/png/16.png diff --git a/resources/linux/icons/24.png b/resources/app-icons/stable/png/24.png similarity index 100% rename from resources/linux/icons/24.png rename to resources/app-icons/stable/png/24.png diff --git a/resources/linux/icons/256.png b/resources/app-icons/stable/png/256.png similarity index 100% rename from resources/linux/icons/256.png rename to resources/app-icons/stable/png/256.png diff --git a/resources/linux/icons/32.png b/resources/app-icons/stable/png/32.png similarity index 100% rename from resources/linux/icons/32.png rename to resources/app-icons/stable/png/32.png diff --git a/resources/linux/icons/48.png b/resources/app-icons/stable/png/48.png similarity index 100% rename from resources/linux/icons/48.png rename to resources/app-icons/stable/png/48.png diff --git a/resources/linux/icons/512.png b/resources/app-icons/stable/png/512.png similarity index 100% rename from resources/linux/icons/512.png rename to resources/app-icons/stable/png/512.png diff --git a/resources/linux/icons/64.png b/resources/app-icons/stable/png/64.png similarity index 100% rename from resources/linux/icons/64.png rename to resources/app-icons/stable/png/64.png diff --git a/resources/atom.png b/resources/atom.png deleted file mode 100644 index a09f04805..000000000 Binary files a/resources/atom.png and /dev/null differ diff --git a/script/railcar b/script/railcar index fa3fca2cb..73a4b1dec 100755 --- a/script/railcar +++ b/script/railcar @@ -48,12 +48,12 @@ function bumpStableVersion (next) { } function bumpBetaVersion (next) { - var newVersion = semver.inc(getCurrentVersion(), 'prerelease', 'beta') + var newVersion = semver.inc(getCurrentVersion(), 'preminor', 'beta') run('npm version ' + newVersion)(next) } function bumpDevVersion (next) { - var newVersion = semver.inc(getCurrentVersion(), 'preminor', 'dev') + var newVersion = semver.inc(getCurrentVersion(), 'preminor', 'dev').replace(/\.0$/, '') series([ run('npm --no-git-tag-version version ' + newVersion), run('git commit -am "' + newVersion + '"') diff --git a/spec/fixtures/packages/package-with-cached-incompatible-native-module/main.js b/spec/fixtures/packages/package-with-cached-incompatible-native-module/main.js new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/packages/package-with-cached-incompatible-native-module/package.json b/spec/fixtures/packages/package-with-cached-incompatible-native-module/package.json new file mode 100644 index 000000000..1db0a0a9d --- /dev/null +++ b/spec/fixtures/packages/package-with-cached-incompatible-native-module/package.json @@ -0,0 +1,12 @@ +{ + "name": "package-with-cached-incompatible-native-module", + "version": "1.0.0", + "main": "./main.js", + "_atomModuleCache": { + "extensions": { + ".node": [ + "node_modules/native-module/build/Release/native.node" + ] + } + } +} diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/main.js b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/main.js new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/build/Release/native.node b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/build/Release/native.node new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/main.js b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/main.js new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/package.json b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/package.json new file mode 100644 index 000000000..77068f680 --- /dev/null +++ b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/compatible-native-module/package.json @@ -0,0 +1,4 @@ +{ + "name": "compatible-native-module", + "main": "./main.js" +} diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/build/Release/native.node b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/build/Release/native.node new file mode 100644 index 000000000..e69de29bb diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/main.js b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/main.js new file mode 100644 index 000000000..97f5c264e --- /dev/null +++ b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/main.js @@ -0,0 +1 @@ +throw new Error("this simulates a native module's failure to load") diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/package.json b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/package.json new file mode 100644 index 000000000..cac262cba --- /dev/null +++ b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/node_modules/native-module/package.json @@ -0,0 +1,4 @@ +{ + "name": "native-module", + "main": "./main.js" +} diff --git a/spec/fixtures/packages/package-with-ignored-incompatible-native-module/package.json b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/package.json new file mode 100644 index 000000000..4f6206828 --- /dev/null +++ b/spec/fixtures/packages/package-with-ignored-incompatible-native-module/package.json @@ -0,0 +1,12 @@ +{ + "name": "package-with-ignored-incompatible-native-module", + "version": "1.0.0", + "main": "./main.js", + "_atomModuleCache": { + "extensions": { + ".node": [ + "node_modules/compatible-native-module/build/Release/native.node" + ] + } + } +} diff --git a/spec/package-spec.coffee b/spec/package-spec.coffee index ef5f5a4c3..e73782219 100644 --- a/spec/package-spec.coffee +++ b/spec/package-spec.coffee @@ -19,6 +19,16 @@ describe "Package", -> expect(pack.incompatibleModules[0].name).toBe 'native-module' expect(pack.incompatibleModules[0].path).toBe path.join(packagePath, 'node_modules', 'native-module') + it "utilizes _atomModuleCache if present to determine the package's native dependencies", -> + packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-ignored-incompatible-native-module') + pack = new Package(packagePath) + expect(pack.getNativeModuleDependencyPaths().length).toBe(1) # doesn't see the incompatible module + expect(pack.isCompatible()).toBe true + + packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-cached-incompatible-native-module') + pack = new Package(packagePath) + expect(pack.isCompatible()).toBe false + it "caches the incompatible native modules in local storage", -> packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-incompatible-native-module') diff --git a/spec/text-editor-component-spec.coffee b/spec/text-editor-component-spec.coffee index 6aaba6cd4..4b69382b5 100644 --- a/spec/text-editor-component-spec.coffee +++ b/spec/text-editor-component-spec.coffee @@ -418,6 +418,24 @@ describe "TextEditorComponent", -> expect(leafNodes[0].classList.contains('trailing-whitespace')).toBe true expect(leafNodes[0].classList.contains('leading-whitespace')).toBe false + it "keeps rebuilding lines when continuous reflow is on", -> + wrapperNode.setContinuousReflow(true) + + oldLineNodes = componentNode.querySelectorAll(".line") + + advanceClock(10) + expect(nextAnimationFrame).toBe(noAnimationFrame) + + advanceClock(component.presenter.minimumReflowInterval - 10) + nextAnimationFrame() + + newLineNodes = componentNode.querySelectorAll(".line") + expect(oldLineNodes).not.toEqual(newLineNodes) + + wrapperNode.setContinuousReflow(false) + advanceClock(component.presenter.minimumReflowInterval) + expect(nextAnimationFrame).toBe(noAnimationFrame) + describe "when showInvisibles is enabled", -> invisibles = null @@ -855,6 +873,24 @@ describe "TextEditorComponent", -> expect(componentNode.querySelector('.gutter').style.display).toBe '' expect(component.lineNumberNodeForScreenRow(3)?).toBe true + it "keeps rebuilding line numbers when continuous reflow is on", -> + wrapperNode.setContinuousReflow(true) + + oldLineNodes = componentNode.querySelectorAll(".line-number") + + advanceClock(10) + expect(nextAnimationFrame).toBe(noAnimationFrame) + + advanceClock(component.presenter.minimumReflowInterval - 10) + nextAnimationFrame() + + newLineNodes = componentNode.querySelectorAll(".line-number") + expect(oldLineNodes).not.toEqual(newLineNodes) + + wrapperNode.setContinuousReflow(false) + advanceClock(component.presenter.minimumReflowInterval) + expect(nextAnimationFrame).toBe(noAnimationFrame) + describe "fold decorations", -> describe "rendering fold decorations", -> it "adds the foldable class to line numbers when the line is foldable", -> diff --git a/src/line-number-gutter-component.coffee b/src/line-number-gutter-component.coffee index f73068c30..b4a5bc168 100644 --- a/src/line-number-gutter-component.coffee +++ b/src/line-number-gutter-component.coffee @@ -64,6 +64,9 @@ class LineNumberGutterComponent extends TiledComponent buildComponentForTile: (id) -> new LineNumbersTileComponent({id, @domElementPool}) + shouldRecreateAllTilesOnUpdate: -> + @newState.continuousReflow + ### Section: Private Methods ### diff --git a/src/lines-component.coffee b/src/lines-component.coffee index b618563be..237f24958 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -32,7 +32,7 @@ class LinesComponent extends TiledComponent @domNode shouldRecreateAllTilesOnUpdate: -> - @oldState.indentGuidesVisible isnt @newState.indentGuidesVisible + @oldState.indentGuidesVisible isnt @newState.indentGuidesVisible or @newState.continuousReflow beforeUpdateSync: (state) -> if @newState.maxHeight isnt @oldState.maxHeight diff --git a/src/package.coffee b/src/package.coffee index f3f5cf4a2..6170a645e 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -590,10 +590,20 @@ class Package false # Get an array of all the native modules that this package depends on. - # This will recurse through all dependencies. + # + # First try to get this information from + # @metadata._atomModuleCache.extensions. If @metadata._atomModuleCache doesn't + # exist, recurse through all dependencies. getNativeModuleDependencyPaths: -> nativeModulePaths = [] + if @metadata._atomModuleCache? + relativeNativeModuleBindingPaths = @metadata._atomModuleCache.extensions?['.node'] ? [] + for relativeNativeModuleBindingPath in relativeNativeModuleBindingPaths + nativeModulePath = path.join(@path, relativeNativeModuleBindingPath, '..', '..', '..') + nativeModulePaths.push(nativeModulePath) + return nativeModulePaths + traversePath = (nodeModulesPath) => try for modulePath in fs.listSync(nodeModulesPath) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index b2f8e0b92..34052af11 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -832,6 +832,9 @@ class TextEditorComponent setInputEnabled: (@inputEnabled) -> @inputEnabled + setContinuousReflow: (continuousReflow) -> + @presenter.setContinuousReflow(continuousReflow) + updateParentViewFocusedClassIfNeeded: -> if @oldState.focused isnt @newState.focused @hostElement.classList.toggle('is-focused', @newState.focused) diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index fc027b0d8..55e4e8567 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -172,6 +172,12 @@ class TextEditorElement extends HTMLElement isUpdatedSynchronously: -> @updatedSynchronously + # Extended: Continuously reflows lines and line numbers. (Has performance overhead) + # + # `continuousReflow` A {Boolean} indicating whether to keep reflowing or not. + setContinuousReflow: (continuousReflow) -> + @component?.setContinuousReflow(continuousReflow) + # Extended: get the width of a character of text displayed in this element. # # Returns a {Number} of pixels. diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index f4986fe6a..4699486bf 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -11,6 +11,7 @@ class TextEditorPresenter mouseWheelScreenRow: null scopedCharacterWidthsChangeCount: 0 overlayDimensions: {} + minimumReflowInterval: 200 constructor: (params) -> {@model, @autoHeight, @explicitHeight, @contentFrameWidth, @scrollTop, @scrollLeft, @boundingClientRect, @windowWidth, @windowHeight, @gutterWidth} = params @@ -36,6 +37,7 @@ class TextEditorPresenter @buildState() @invalidate() @startBlinkingCursors() if @focused + @startReflowing() if @continuousReflow @updating = false setLinesYardstick: (@linesYardstick) -> @@ -86,6 +88,7 @@ class TextEditorPresenter @updateCommonGutterState() @updateHorizontalDimensions() + @updateReflowState() @updateFocusedState() if @shouldUpdateFocusedState @updateHeightState() if @shouldUpdateHeightState @@ -256,6 +259,23 @@ class TextEditorPresenter @lineNumberGutter = tiles: {} + setContinuousReflow: (@continuousReflow) -> + if @continuousReflow + @startReflowing() + else + @stopReflowing() + + updateReflowState: -> + @state.content.continuousReflow = @continuousReflow + @lineNumberGutter.continuousReflow = @continuousReflow + + startReflowing: -> + @reflowingInterval = setInterval(@emitDidUpdateState.bind(this), @minimumReflowInterval) + + stopReflowing: -> + clearInterval(@reflowingInterval) + @reflowingInterval = null + updateFocusedState: -> @state.focused = @focused