mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-28 11:35:35 +03:00
Make some fields of structs var and make some op overloading functions static
This commit is contained in:
parent
48ae3bcf74
commit
7480ff4a50
@ -7,18 +7,18 @@ import Cocoa
|
||||
|
||||
// The definition can be found in NeoVimUiBridgeProtocol.h
|
||||
|
||||
public func == (left: CellAttributes, right: CellAttributes) -> Bool {
|
||||
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
|
||||
}
|
||||
|
||||
extension CellAttributes: CustomStringConvertible, Equatable {
|
||||
|
||||
|
||||
public static func ==(left: CellAttributes, right: CellAttributes) -> Bool {
|
||||
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
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return "CellAttributes<fg: \(String(format: "%x", self.foreground)), bg: \(String(format: "%x", self.background)))"
|
||||
}
|
||||
|
@ -6,9 +6,10 @@
|
||||
import Cocoa
|
||||
|
||||
struct Cell: CustomStringConvertible {
|
||||
|
||||
fileprivate let attributes: CellAttributes
|
||||
|
||||
let string: String
|
||||
var string: String
|
||||
var marked: Bool
|
||||
|
||||
var attrs: CellAttributes {
|
||||
@ -30,43 +31,43 @@ extension Position: CustomStringConvertible, Equatable {
|
||||
|
||||
static let zero = Position(row: 0, column: 0)
|
||||
static let null = Position(row: -1, column: -1)
|
||||
|
||||
public static func ==(left: Position, right: Position) -> Bool {
|
||||
if left.row != right.row { return false }
|
||||
if left.column != right.column { return false }
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
public var description: String {
|
||||
return "Position<\(self.row):\(self.column)>"
|
||||
}
|
||||
}
|
||||
|
||||
public func == (left: Position, right: Position) -> Bool {
|
||||
if left.row != right.row { return false }
|
||||
if left.column != right.column { return false }
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
struct Size: CustomStringConvertible, Equatable {
|
||||
|
||||
static let zero = Size(width: 0, height: 0)
|
||||
|
||||
static func ==(left: Size, right: Size) -> Bool {
|
||||
return left.width == right.width && left.height == right.height
|
||||
}
|
||||
|
||||
let width: Int
|
||||
let height: Int
|
||||
var width: Int
|
||||
var height: Int
|
||||
|
||||
var description: String {
|
||||
return "Size<\(self.width):\(self.height)>"
|
||||
}
|
||||
}
|
||||
|
||||
func == (left: Size, right: Size) -> Bool {
|
||||
return left.width == right.width && left.height == right.height
|
||||
}
|
||||
|
||||
struct Region: CustomStringConvertible {
|
||||
|
||||
static let zero = Region(top: 0, bottom: 0, left: 0, right: 0)
|
||||
|
||||
let top: Int
|
||||
let bottom: Int
|
||||
let left: Int
|
||||
let right: Int
|
||||
var top: Int
|
||||
var bottom: Int
|
||||
var left: Int
|
||||
var right: Int
|
||||
|
||||
var description: String {
|
||||
return "Region<\(self.top)...\(self.bottom):\(self.left)...\(self.right)>"
|
||||
|
@ -8,9 +8,9 @@ import Cocoa
|
||||
/// Contiguous piece of cells of a row that has the same attributes.
|
||||
fileprivate struct RowRun: CustomStringConvertible {
|
||||
|
||||
let row: Int
|
||||
let range: CountableClosedRange<Int>
|
||||
let attrs: CellAttributes
|
||||
var row: Int
|
||||
var range: CountableClosedRange<Int>
|
||||
var attrs: CellAttributes
|
||||
|
||||
var description: String {
|
||||
return "RowRun<\(row): \(range)\n\(attrs)>"
|
||||
@ -20,7 +20,8 @@ fileprivate struct RowRun: CustomStringConvertible {
|
||||
public class NeoVimView: NSView, NeoVimUiBridgeProtocol, NSUserInterfaceValidations {
|
||||
|
||||
public struct Config {
|
||||
let useInteractiveZsh: Bool
|
||||
|
||||
var useInteractiveZsh: Bool
|
||||
|
||||
public init(useInteractiveZsh: Bool) {
|
||||
self.useInteractiveZsh = useInteractiveZsh
|
||||
|
Loading…
Reference in New Issue
Block a user