diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 837961e6a..c8a79b4e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -285,8 +285,8 @@ If you want to read about using Atom or developing packages in Atom, the [Atom F All JavaScript must adhere to [JavaScript Standard Style](http://standardjs.com/). -* Prefer `Object.assign()` to the object spread operator (`{...anotherObj}`) -* Inline `export`s with expressions +* Prefer the object spread operator (`{...anotherObj}`) to `Object.assign()` +* Inline `export`s with expressions whenever possible ```js // Use this: export default class ClassName { diff --git a/package.json b/package.json index a409f6a9b..9ea5e5538 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "sinon": "1.17.4", "source-map-support": "^0.3.2", "temp": "0.8.1", - "text-buffer": "9.2.6", + "text-buffer": "9.2.7", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", "winreg": "^1.2.1", @@ -93,7 +93,7 @@ "deprecation-cop": "0.54.1", "dev-live-reload": "0.47.0", "encoding-selector": "0.22.0", - "exception-reporting": "0.38.4", + "exception-reporting": "0.39.0", "find-and-replace": "0.201.0", "fuzzy-finder": "1.3.0", "git-diff": "1.1.0", @@ -112,7 +112,7 @@ "settings-view": "0.241.1", "snippets": "1.0.2", "spell-check": "0.67.1", - "status-bar": "1.4.0", + "status-bar": "1.4.1", "styleguide": "0.47.0", "symbols-view": "0.113.0", "tabs": "0.100.0", diff --git a/resources/linux/atom.desktop.in b/resources/linux/atom.desktop.in index 290d368d2..6fa5d79c8 100644 --- a/resources/linux/atom.desktop.in +++ b/resources/linux/atom.desktop.in @@ -2,7 +2,7 @@ Name=<%= appName %> Comment=<%= description %> GenericName=Text Editor -Exec=<%= installDir %>/share/<%= appFileName %>/atom %U +Exec=<%= installDir %>/share/<%= appFileName %>/atom %F Icon=<%= iconPath %> Type=Application StartupNotify=true diff --git a/spec/git-spec.coffee b/spec/git-repository-spec.coffee similarity index 94% rename from spec/git-spec.coffee rename to spec/git-repository-spec.coffee index ef87d83ee..d427fc3b9 100644 --- a/spec/git-spec.coffee +++ b/spec/git-repository-spec.coffee @@ -199,7 +199,7 @@ describe "GitRepository", -> beforeEach -> workingDirectory = copyRepository() - repo = new GitRepository(workingDirectory) + repo = new GitRepository(workingDirectory, {project: atom.project, config: atom.config}) modifiedPath = path.join(workingDirectory, 'file.txt') newPath = path.join(workingDirectory, 'untracked.txt') cleanPath = path.join(workingDirectory, 'other.txt') @@ -249,6 +249,22 @@ describe "GitRepository", -> expect(repo.isStatusModified(status)).toBe false expect(repo.isStatusNew(status)).toBe false + it "works correctly when the project has multiple folders (regression)", -> + atom.project.addPath(workingDirectory) + atom.project.addPath(path.join(__dirname, 'fixtures', 'dir')) + statusHandler = jasmine.createSpy('statusHandler') + repo.onDidChangeStatuses statusHandler + + repo.refreshStatus() + + waitsFor -> + statusHandler.callCount > 0 + + runs -> + expect(repo.getCachedPathStatus(cleanPath)).toBeUndefined() + expect(repo.isStatusNew(repo.getCachedPathStatus(newPath))).toBeTruthy() + expect(repo.isStatusModified(repo.getCachedPathStatus(modifiedPath))).toBeTruthy() + it 'caches statuses that were looked up synchronously', -> originalContent = 'undefined' fs.writeFileSync(modifiedPath, 'making this path modified') diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 83f5d1b80..756358874 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -2251,6 +2251,17 @@ describe('TextEditorComponent', function () { expect(overlay.style.left).toBe(windowWidth - itemWidth + 'px') expect(overlay.style.top).toBe(position.top + editor.getLineHeightInPixels() + 'px') + + // window size change + + windowWidth = Math.round(gutterWidth + 29 * editor.getDefaultCharWidth()) + await atom.setWindowDimensions({ + width: windowWidth, + height: windowHeight, + }) + atom.views.performDocumentPoll() + expect(overlay.style.left).toBe(windowWidth - itemWidth + 'px') + expect(overlay.style.top).toBe(position.top + editor.getLineHeightInPixels() + 'px') }) }) }) diff --git a/src/application-delegate.coffee b/src/application-delegate.coffee index 74c498e78..3372962be 100644 --- a/src/application-delegate.coffee +++ b/src/application-delegate.coffee @@ -1,5 +1,5 @@ _ = require 'underscore-plus' -{screen, ipcRenderer, remote, shell, webFrame} = require 'electron' +{screen, ipcRenderer, remote, shell, systemPreferences, webFrame} = require 'electron' ipcHelpers = require './ipc-helpers' {Disposable} = require 'event-kit' {getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers' @@ -57,12 +57,18 @@ class ApplicationDelegate reloadWindow: -> ipcRenderer.send("call-window-method", "reload") + minimizeWindow: -> + ipcRenderer.send("call-window-method", "minimize") + isWindowMaximized: -> remote.getCurrentWindow().isMaximized() maximizeWindow: -> ipcRenderer.send("call-window-method", "maximize") + unmaximizeWindow: -> + ipcRenderer.send("call-window-method", "unmaximize") + isWindowFullScreen: -> remote.getCurrentWindow().isFullScreen() @@ -130,6 +136,9 @@ class ApplicationDelegate getPrimaryDisplayWorkAreaSize: -> remote.screen.getPrimaryDisplay().workAreaSize + getUserDefault: (key, type) -> + remote.systemPreferences.getUserDefault(key, type) + confirm: ({message, detailedMessage, buttons}) -> buttons ?= {} if _.isArray(buttons) diff --git a/src/config-schema.coffee b/src/config-schema.coffee index 2a29c4da4..b138a3b7f 100644 --- a/src/config-schema.coffee +++ b/src/config-schema.coffee @@ -271,4 +271,4 @@ if process.platform is 'darwin' module.exports.core.properties.useCustomTitleBar = type: 'boolean' default: false - description: 'Use custom, theme-aware title-bar.
Note: Note: This currently does not include a proxy icon.
This setting will require a relaunch of Atom to take effect.' + description: 'Use custom, theme-aware title bar.
Note: This currently does not include a proxy icon.
This setting will require a relaunch of Atom to take effect.' diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 85600bba7..e0d7dfb25 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -3,6 +3,7 @@ _ = require 'underscore-plus' {Emitter, Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' +path = require 'path' GitUtils = require 'git-utils' Task = require './task' @@ -309,8 +310,8 @@ class GitRepository getDirectoryStatus: (directoryPath) -> directoryPath = "#{@relativize(directoryPath)}/" directoryStatus = 0 - for path, status of @statuses - directoryStatus |= status if path.indexOf(directoryPath) is 0 + for statusPath, status of @statuses + directoryStatus |= status if statusPath.indexOf(directoryPath) is 0 directoryStatus # Public: Get the status of a single path in the repository. @@ -432,8 +433,8 @@ class GitRepository # Subscribes to buffer events. subscribeToBuffer: (buffer) -> getBufferPathStatus = => - if path = buffer.getPath() - @getPathStatus(path) + if bufferPath = buffer.getPath() + @getPathStatus(bufferPath) bufferSubscriptions = new CompositeDisposable bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus) @@ -468,8 +469,8 @@ class GitRepository @handlerPath ?= require.resolve('./repository-status-handler') relativeProjectPaths = @project?.getPaths() - .map (path) => @relativize(path) - .filter (path) -> path.length > 0 + .map (projectPath) => @relativize(projectPath) + .filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath) @statusTask?.terminate() new Promise (resolve) => diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 3949f18e5..5f03f6c34 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -757,6 +757,7 @@ class TextEditorComponent pollDOM: => unless @checkForVisibilityChange() @sampleBackgroundColors() + @measureWindowSize() @measureDimensions() @sampleFontStyling() @overlayManager?.measureOverlays() diff --git a/src/title-bar.coffee b/src/title-bar.coffee index e2da3ed62..b81b08060 100644 --- a/src/title-bar.coffee +++ b/src/title-bar.coffee @@ -8,12 +8,25 @@ class TitleBar @titleElement.classList.add('title') @element.appendChild(@titleElement) + @element.addEventListener 'dblclick', @dblclickHandler + @workspace.onDidChangeActivePaneItem => @updateTitle() @themes.onDidChangeActiveThemes => @updateWindowSheetOffset() @updateTitle() @updateWindowSheetOffset() + dblclickHandler: => + # User preference deciding which action to take on a title bar double-click + switch @applicationDelegate.getUserDefault('AppleActionOnDoubleClick', 'string') + when 'Minimize' + @applicationDelegate.minimizeWindow() + when 'Maximize' + if @applicationDelegate.isWindowMaximized() + @applicationDelegate.unmaximizeWindow() + else + @applicationDelegate.maximizeWindow() + updateTitle: -> @titleElement.textContent = document.title diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index ea7082a6d..a79e37493 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -242,6 +242,17 @@ class TokenizedBuffer extends Model row + delta handleBufferChange: (e) -> + if @lastBufferChangeEventId? + @assert( + @lastBufferChangeEventId is e.eventId - 1, + 'Buffer Change Event Ids are not sequential', + (error) => + error.metadata = { + tokenizedBufferEventId: @lastBufferChangeEventId, + nextTokenizedBufferEventId: e.eventId, + } + ) + @lastBufferChangeEventId = e.eventId @changeCount = @buffer.changeCount {oldRange, newRange} = e