1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-29 16:56:40 +03:00

Use offsetBy instead of custom translating

This commit is contained in:
Tae Won Ha 2017-05-29 20:23:32 +02:00
parent c5974abd63
commit 689fc8d0a3
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 3 additions and 7 deletions

View File

@ -17,10 +17,6 @@ extension CGRect: Hashable {
size: CGSize(width: self.size.width + dw, height: self.size.height + dh))
}
public func translating(x: CGFloat, y: CGFloat) -> CGRect {
return CGRect(origin: CGPoint(x: self.origin.x + x, y: self.origin.y + y), size: self.size)
}
func scaling(_ factor: CGFloat) -> CGRect {
return CGRect(origin: self.origin.scaling(factor), size: self.size.scaling(factor))
}

View File

@ -112,7 +112,7 @@ extension NeoVimView {
let rectToScroll = self.rect(for: self.grid.region)
let clipRect: CGRect
if count > 0 {
clipRect = rectToScroll.translating(x: 0, y: offset).resizing(dw: 0, dh: -offset)
clipRect = rectToScroll.offsetBy(dx: 0, dy: offset).resizing(dw: 0, dh: -offset)
} else {
clipRect = rectToScroll.resizing(dw: 0, dh: offset)
}
@ -149,7 +149,7 @@ extension NeoVimView {
public func put(_ string: String, screenCursor: Position) {
gui.async {
let curPos = self.grid.putPosition
self.bridgeLogger.debug("\(curPos) -> '\(string)' <- screen: \(screenCursor)")
// self.bridgeLogger.debug("\(curPos) -> '\(string)' <- screen: \(screenCursor)")
self.grid.put(string)
@ -286,7 +286,7 @@ extension NeoVimView {
public func autoCommandEvent(_ event: NeoVimAutoCommandEvent, bufferHandle: Int) {
gui.async {
self.bridgeLogger.debug("\(neoVimAutoCommandEventName(event)) -> \(bufferHandle)")
// self.bridgeLogger.debug("\(neoVimAutoCommandEventName(event)) -> \(bufferHandle)")
if event == .BUFWINENTER || event == .BUFWINLEAVE {
self.bufferListChanged()