1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-25 06:43:24 +03:00

GH-666 Implement clear

This commit is contained in:
Tae Won Ha 2018-09-02 17:53:34 +02:00
parent 10d475dbaa
commit d60bec50f4
2 changed files with 18 additions and 10 deletions

View File

@ -11,7 +11,9 @@ import MessagePack
extension NvimView {
final func resize(_ value: MessagePackValue) {
guard let array = MessagePackUtils.array(from: value, ofSize: 2, conversion: { $0.intValue }) else {
guard let array = MessagePackUtils.array(
from: value, ofSize: 2, conversion: { $0.intValue }
) else {
return
}
@ -26,16 +28,22 @@ extension NvimView {
bridgeLogger.mark()
gui.async {
// self.ugrid.clear()
self.ugrid.clear()
self.markForRenderWholeView()
}
}
final func modeChange(_ value: MessagePackValue) {
guard let mode = MessagePackUtils.value(from: value, conversion: { v -> CursorModeShape? in
guard let mode = MessagePackUtils.value(
from: value, conversion: { v -> CursorModeShape? in
guard let rawValue = v.intValue else { return nil }
return CursorModeShape(rawValue: UInt(rawValue))
}) else { return }
}) else {
return
}
bridgeLogger.debug(name(of: mode))
gui.async {

View File

@ -103,7 +103,11 @@ final class UGrid {
}
func clear() {
// self.clear(region: self.region)
let emptyRow = Array(
repeating: UCell(string: clearString, attrId: defaultAttrId),
count: size.width
)
self.cells = Array(repeating: emptyRow, count: size.height)
}
func clear(region: Region) {
@ -133,11 +137,7 @@ final class UGrid {
self.size = size
self.posision = .zero
let emptyRow = Array(
repeating: UCell(string: clearString, attrId: defaultAttrId),
count: size.width
)
self.cells = Array(repeating: emptyRow, count: size.height)
self.clear()
}
// endCol and clearCol are past last index