Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Commit

Permalink
Minor refactoring, and a fix for #303
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed May 1, 2016
1 parent a067551 commit 2f39b49
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
13 changes: 12 additions & 1 deletion app/CocoaPods/CPPodfileEditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,18 @@ extension EditorLineSelection {
extension CPPodfileEditorViewController: CPUserProjectDelegate {

func contentDidChangeinUserProject(userProject: CPUserProject) {
editor.string = userProject.contents
let contentChanged = editor.string != userProject.contents
let appIsActive = NSApplication.sharedApplication().active

if contentChanged && !appIsActive {
let selection = editor.textView.selectedRange()
let scroll = editor.scrollView.visibleRect

editor.string = userProject.contents

editor.textView.selectedRange = selection
editor.scrollView.scrollPoint(scroll.origin)
}

// Passing the message on to the syntax checker
syntaxChecker.textDidChange(NSNotification(name: "", object: nil))
Expand Down
10 changes: 5 additions & 5 deletions app/CocoaPods/CPPodfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,25 @@ class CPPodfileViewController: NSViewController, NSTabViewDelegate {

@IBAction func install(obj: AnyObject) {
let options = InstallOptions(verbose: false)
performInstall(.Install(options: options))
performInstallAction(.Install(options: options))
}

@IBAction func installVerbose(obj: AnyObject) {
let options = InstallOptions(verbose: true)
performInstall(.Install(options: options))
performInstallAction(.Install(options: options))
}

@IBAction func installUpdate(obj: AnyObject) {
let options = InstallOptions(verbose: false)
performInstall(.Update(options: options))
performInstallAction(.Update(options: options))
}

@IBAction func installUpdateVerbose(obj: AnyObject) {
let options = InstallOptions(verbose: true)
performInstall(.Update(options: options))
performInstallAction(.Update(options: options))
}

func performInstall(action: InstallActionType) {
func performInstallAction(action: InstallActionType) {
userProject.saveDocument(self)

let lastInstalledVersion = userProject.xcodeIntegrationDictionary["cocoapods_build_version"]
Expand Down
1 change: 0 additions & 1 deletion app/CocoaPods/CPUserProject.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ - (void)presentedItemDidChange
});
}
}

}

@end

0 comments on commit 2f39b49

Please sign in to comment.