2016-06-19 16:17:43 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
|
|
// The definition can be found in NeoVimUiBridgeProtocol.h
|
|
|
|
|
2016-10-25 00:03:58 +03:00
|
|
|
public func == (left: CellAttributes, right: CellAttributes) -> Bool {
|
2016-06-19 16:17:43 +03:00
|
|
|
if left.foreground != right.foreground { return false }
|
|
|
|
if left.fontTrait != right.fontTrait { return false }
|
|
|
|
|
|
|
|
if left.background != right.background { return false }
|
|
|
|
if left.special != right.special { return false }
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2016-10-25 00:03:58 +03:00
|
|
|
extension CellAttributes: CustomStringConvertible, Equatable {
|
2016-06-19 16:17:43 +03:00
|
|
|
|
|
|
|
public var description: String {
|
|
|
|
return "CellAttributes<fg: \(String(format: "%x", self.foreground)), bg: \(String(format: "%x", self.background)))"
|
|
|
|
}
|
2016-06-24 22:08:34 +03:00
|
|
|
|
2016-07-03 22:59:03 +03:00
|
|
|
public var inverted: CellAttributes {
|
2016-06-24 22:08:34 +03:00
|
|
|
var result = self
|
|
|
|
|
|
|
|
result.background = self.foreground
|
|
|
|
result.foreground = self.background
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
2016-06-19 16:17:43 +03:00
|
|
|
}
|