mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 23:02:35 +03:00
GH-666 Refactor slightly
This commit is contained in:
parent
c14d2c6b1e
commit
f68d01d1f1
@ -51,28 +51,6 @@ extension NvimView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final func scroll(_ array: [Int]) {
|
|
||||||
bridgeLogger.debug("[top, bot, left, right, rows, cols] = \(array)")
|
|
||||||
|
|
||||||
let (top, bottom, left, right, rows, cols)
|
|
||||||
= (array[0], array[1] - 1, array[2], array[3] - 1, array[4], array[5])
|
|
||||||
|
|
||||||
let scrollRegion = Region(
|
|
||||||
top: top, bottom: bottom,
|
|
||||||
left: left, right: right
|
|
||||||
)
|
|
||||||
let maxBottom = self.ugrid.size.height - 1
|
|
||||||
let regionToRender = Region(
|
|
||||||
top: min(max(0, top - rows), maxBottom),
|
|
||||||
bottom: max(0, min(bottom - rows, maxBottom)),
|
|
||||||
left: left, right: right
|
|
||||||
)
|
|
||||||
|
|
||||||
self.ugrid.scroll(region: scrollRegion, rows: rows, cols: cols)
|
|
||||||
self.markForRender(region: scrollRegion)
|
|
||||||
self.eventsSubject.onNext(.scroll)
|
|
||||||
}
|
|
||||||
|
|
||||||
final func unmark(_ value: MessagePackValue) {
|
final func unmark(_ value: MessagePackValue) {
|
||||||
// bridgeLogger.debug("\(row):\(column)")
|
// bridgeLogger.debug("\(row):\(column)")
|
||||||
//
|
//
|
||||||
@ -114,7 +92,7 @@ extension NvimView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self.scroll(values)
|
self.doScroll(values)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,6 +240,28 @@ extension NvimView {
|
|||||||
self.ugrid.goto(position)
|
self.ugrid.goto(position)
|
||||||
self.markForRender(cellPosition: self.ugrid.cursorPosition)
|
self.markForRender(cellPosition: self.ugrid.cursorPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func doScroll(_ array: [Int]) {
|
||||||
|
bridgeLogger.debug("[top, bot, left, right, rows, cols] = \(array)")
|
||||||
|
|
||||||
|
let (top, bottom, left, right, rows, cols)
|
||||||
|
= (array[0], array[1] - 1, array[2], array[3] - 1, array[4], array[5])
|
||||||
|
|
||||||
|
let scrollRegion = Region(
|
||||||
|
top: top, bottom: bottom,
|
||||||
|
left: left, right: right
|
||||||
|
)
|
||||||
|
let maxBottom = self.ugrid.size.height - 1
|
||||||
|
let regionToRender = Region(
|
||||||
|
top: min(max(0, top - rows), maxBottom),
|
||||||
|
bottom: max(0, min(bottom - rows, maxBottom)),
|
||||||
|
left: left, right: right
|
||||||
|
)
|
||||||
|
|
||||||
|
self.ugrid.scroll(region: scrollRegion, rows: rows, cols: cols)
|
||||||
|
self.markForRender(region: scrollRegion)
|
||||||
|
self.eventsSubject.onNext(.scroll)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Simple
|
// MARK: - Simple
|
||||||
|
Loading…
Reference in New Issue
Block a user