1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

GH-666 Refactor slightly

This commit is contained in:
Tae Won Ha 2018-09-03 09:33:54 +02:00
parent 51fef549f2
commit 7dbde9beb6
4 changed files with 8 additions and 22 deletions

View File

@ -12,12 +12,12 @@ extension NvimView {
public func enterResizeMode() {
self.currentlyResizing = true
self.needsDisplay = true
self.markForRenderWholeView()
}
public func exitResizeMode() {
self.currentlyResizing = false
self.needsDisplay = true
self.markForRenderWholeView()
self.resizeNeoVimUi(to: self.bounds.size)
}

View File

@ -66,7 +66,7 @@ extension NvimView {
self.pinchBitmap = pinchImageRep
self.isCurrentlyPinching = true
self.needsDisplay = true
self.markForRenderWholeView()
case .ended, .cancelled:
self.isCurrentlyPinching = false
@ -74,7 +74,7 @@ extension NvimView {
self.pinchTargetScale = 1
default:
self.needsDisplay = true
self.markForRenderWholeView()
}
}

View File

@ -240,7 +240,9 @@ extension NvimView {
)
self.ugrid.goto(position)
self.markForRender(cellPosition: self.ugrid.cursorPosition)
self.markForRender(
region: self.cursorRegion(for: self.ugrid.cursorPosition)
)
}
private func doScroll(_ array: [Int]) {
@ -393,22 +395,6 @@ extension NvimView {
extension NvimView {
final func markForRender(cellPosition position: Position) {
self.markForRender(position: position)
if self.grid.isCellEmpty(position) {
self.markForRender(position: self.grid.previousCellPosition(position))
}
if self.grid.isNextCellEmpty(position) {
self.markForRender(position: self.grid.nextCellPosition(position))
}
}
final func markForRender(position: Position) {
self.markForRender(row: position.row, column: position.column)
}
final func markForRenderWholeView() {
self.needsDisplay = true
}

View File

@ -125,7 +125,7 @@ public class NvimView: NSView,
public var usesLigatures = false {
didSet {
self.runDrawer.usesLigatures = self.usesLigatures
self.needsDisplay = true
self.markForRenderWholeView()
}
}