Skip to content

Commit

Permalink
Revert aba97e2..171fdee
Browse files Browse the repository at this point in the history
This rolls back to commit aba97e2.
  • Loading branch information
Anviking committed Mar 14, 2015
1 parent 171fdee commit d223f74
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions Chromatism/Chromatism/JLKeywordScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private struct Branch: Node, Printable {
self.character = character
var dictionary = [String: [String]]()
for string in array {
if count(string) > 0 {
if countElements(string) > 0 {
let firstCharacter = String(string[string.startIndex ... string.startIndex])
let remainingString = string[string.startIndex.successor() ..< string.endIndex]
if var array = dictionary[firstCharacter] {
Expand All @@ -71,7 +71,7 @@ private struct Branch: Node, Printable {

var pattern: String {
var array = children.map { $0.pattern }
array.sort { count($0) < count($1) }
array.sort { countElements($0) < countElements($1) }

switch array.count {
case 0: return character + ""
Expand Down
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLNestedScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class JLNestedScope: JLScope {
println("Intersection: \(intersection)")

self.indexSet = newIndexSet
oldIndexSet = newIndexSet.mutableCopy() as! NSMutableIndexSet
oldIndexSet = newIndexSet.mutableCopy() as NSMutableIndexSet
}

func incrementingTokenIsValid(token: JLTokenizingScope.TokenResult) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLRegexScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class JLRegexScope: JLScope {
})
})

performSubscopes(attributedString, indexSet: indexSet.mutableCopy() as! NSMutableIndexSet)
performSubscopes(attributedString, indexSet: indexSet.mutableCopy() as NSMutableIndexSet)
}

private func process(result: NSTextCheckingResult, attributedString: NSMutableAttributedString) {
Expand Down
4 changes: 2 additions & 2 deletions Chromatism/Chromatism/JLScope.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public class JLScope: NSObject, Printable, Equatable {

// Create a copy of the indexSet and call perform to subscopes
// The results of the subscope is removed from the indexSet copy before the next subscope is performed
let indexSetCopy = indexSet.mutableCopy() as! NSMutableIndexSet
let indexSetCopy = indexSet.mutableCopy() as NSMutableIndexSet
performSubscopes(attributedString, indexSet: indexSetCopy)
self.indexSet = indexSet.mutableCopy() as! NSMutableIndexSet
self.indexSet = indexSet.mutableCopy() as NSMutableIndexSet
}

// Will change indexSet
Expand Down
4 changes: 2 additions & 2 deletions Chromatism/Chromatism/JLTextStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class JLTextStorage: NSTextStorage {

public override func processEditing() {
if let range = editedLineRange {
let layoutManager = layoutManagers[0] as! NSLayoutManager
let layoutManager = layoutManagers[0] as NSLayoutManager
//println("Non Contigigous Layout: \(layoutManager.hasNonContiguousLayout)")
let editedLineIndexSet = NSIndexSet(indexesInRange: range)
documentScope.perform(editedLineIndexSet)
Expand All @@ -48,7 +48,7 @@ public class JLTextStorage: NSTextStorage {

public override func replaceCharactersInRange(range: NSRange, withString str: String) {
let actions = NSTextStorageEditActions.EditedCharacters | NSTextStorageEditActions.EditedAttributes
let delta = count(str.utf16) - range.length
let delta = str.utf16Count - range.length
edited(actions, range: range, changeInLength: delta)
backingStore.replaceCharactersInRange(range, withString: str)
editedLineRange = (string as NSString).lineRangeForRange(editedRange)
Expand Down
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ extension JLTextView: JLNestedScopeDelegate {
additions.enumerateRangesUsingBlock { (range, stop) in

let range = self.textRange(range.start ..< range.end)
let array = self.selectionRectsForRange(range) as! [UITextSelectionRect]
let array = self.selectionRectsForRange(range) as [UITextSelectionRect]
for value in array {
self.flash(value.rect, color: UIColor(white: 0.0, alpha: 0.1))
}
Expand Down
2 changes: 1 addition & 1 deletion Chromatism/Chromatism/JLTextViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class JLTextViewController: UIViewController {
// FIXME: ! could be wrong
let info = notification.userInfo!
let scrollView = self.textView
let kbSize = (info[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue().size;
let kbSize = (info[UIKeyboardFrameBeginUserInfoKey] as NSValue).CGRectValue().size;

var contentInsets = scrollView.contentInset;
contentInsets.bottom = kbSize.height;
Expand Down
4 changes: 2 additions & 2 deletions Chromatism/Chromatism/NSIndexSet+Additions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ func NSIndexSetDelta(oldSet: NSIndexSet, newSet: NSIndexSet) -> (additions: NSMu
}

func -(left: NSIndexSet, right: NSIndexSet) -> NSMutableIndexSet {
let indexSet = left.mutableCopy() as! NSMutableIndexSet
let indexSet = left.mutableCopy() as NSMutableIndexSet
indexSet.removeIndexes(right)
return indexSet
}

func +(left: NSIndexSet, right: NSIndexSet) -> NSMutableIndexSet {
let indexSet = left.mutableCopy() as! NSMutableIndexSet
let indexSet = left.mutableCopy() as NSMutableIndexSet
indexSet.addIndexes(right)
return indexSet
}
Expand Down
4 changes: 2 additions & 2 deletions Chromatism/ChromatismTests/JLKeywordScopeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest

class JLKeywordScopeTests: XCTestCase {

let string = NSString(contentsOfURL: NSBundle(forClass: ObjectiveC.self).URLForResource("demo", withExtension: "txt")!, encoding: NSUTF8StringEncoding, error: nil) as! String
let string = NSString(contentsOfURL: NSBundle(forClass: ObjectiveC.self).URLForResource("demo", withExtension: "txt"), encoding: NSUTF8StringEncoding, error: nil)
var attributedString: NSMutableAttributedString!

var keywords = "Array|AutoreleasingUnsafePointer|BidirectionalReverseView|Bit|Bool|CFunctionPointer|COpaquePointer|CVaListPointer|Character|CollectionOfOne|ConstUnsafePointer|ContiguousArray|Dictionary|DictionaryGenerator|DictionaryIndex|Double|EmptyCollection|EmptyGenerator|EnumerateGenerator|FilterCollectionView|FilterCollectionViewIndex|FilterGenerator|FilterSequenceView|Float|Float80|FloatingPointClassification|GeneratorOf|GeneratorOfOne|GeneratorSequence|HeapBuffer|HeapBuffer|HeapBufferStorage|HeapBufferStorageBase|ImplicitlyUnwrappedOptional|IndexingGenerator|Int|Int16|Int32|Int64|Int8|IntEncoder|LazyBidirectionalCollection|LazyForwardCollection|LazyRandomAccessCollection|LazySequence|Less|MapCollectionView|MapSequenceGenerator|MapSequenceView|MirrorDisposition|ObjectIdentifier|OnHeap|Optional|PermutationGenerator|QuickLookObject|RandomAccessReverseView|Range|RangeGenerator|RawByte|Repeat|ReverseBidirectionalIndex|ReverseRandomAccessIndex|SequenceOf|SinkOf|Slice|StaticString|StrideThrough|StrideThroughGenerator|StrideTo|StrideToGenerator|String|Index|UTF8View|Index|UnicodeScalarView|IndexType|GeneratorType|UTF16View|UInt|UInt16|UInt32|UInt64|UInt8|UTF16|UTF32|UTF8|UnicodeDecodingResult|UnicodeScalar|Unmanaged|UnsafeArray|UnsafeArrayGenerator|UnsafeMutableArray|UnsafePointer|VaListBuilder|Header|Zip2|ZipGenerator2".componentsSeparatedByString("|")
Expand Down Expand Up @@ -45,7 +45,7 @@ class JLKeywordScopeTests: XCTestCase {

func testKeywordPattern() {
// This is an example of a performance test case.
let scope = JLKeywordScope(keywords: keywords, tokenType: .Keyword)
let scope = JLKeywordScope(keywords: keywords, tokenTypes: .Keyword)
scope.attributedString = attributedString
scope.theme = .Default
self.measureBlock() {
Expand Down
4 changes: 2 additions & 2 deletions Chromatism/ChromatismTests/JLScopeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ extension String {
}
}

func + (left: NSAttributedString, right: NSAttributedString) -> NSMutableAttributedString {
let string = left.mutableCopy() as! NSMutableAttributedString
@infix func + (left: NSAttributedString, right: NSAttributedString) -> NSMutableAttributedString {
let string = left.mutableCopy() as NSMutableAttributedString
string.appendAttributedString(right)
return string
}
2 changes: 1 addition & 1 deletion Chromatism/ChromatismTests/ObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest

class ObjectiveC: XCTestCase {

let string = NSString(contentsOfURL: NSBundle(forClass: ObjectiveC.self).URLForResource("demo", withExtension: "txt")!, encoding: NSUTF8StringEncoding, error: nil) as! String
let string = NSString(contentsOfURL: NSBundle(forClass: ObjectiveC.self).URLForResource("demo", withExtension: "txt"), encoding: NSUTF8StringEncoding, error: nil)

var attributedString: NSMutableAttributedString!
var language: JLLanguage.ObjectiveC!
Expand Down
6 changes: 3 additions & 3 deletions SwiftChromatismDemo/SwiftChromatismDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
// Override point for customization after application launch.

// Load demo text
let url = NSBundle.mainBundle().URLForResource("objc", withExtension: "txt");
let string = NSString(contentsOfURL: url!, encoding: NSUTF8StringEncoding, error: nil) as! String
let string = NSString(contentsOfURL: url!, encoding: NSUTF8StringEncoding, error: nil)

let viewController = JLTextViewController(text: string, language: .ObjectiveC, theme: .Default)
let viewController = JLTextViewController(text: string!, language: .ObjectiveC, theme: .Default)

viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Resign", style: .Plain, target: viewController.textView, action:"resignFirstResponder")

Expand Down

0 comments on commit d223f74

Please sign in to comment.