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

Handle move tab to last index

This commit is contained in:
Tae Won Ha 2020-12-07 20:37:35 +01:00
parent 08bc90ad9c
commit f63f6cdb7e
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
2 changed files with 8 additions and 2 deletions

View File

@ -485,6 +485,7 @@ extension NvimView {
switch event.stringValue {
case "tabline_update": self.tablineUpdate(args)
case "win_viewport": self.winViewportUpdate(args)
default: break
}
}
@ -600,6 +601,9 @@ extension NvimView {
gui.async { self.tabBar?.update(tabRepresentatives: self.tabEntries) }
}
func winViewportUpdate(_ args: [MessagePackValue]) {
}
private func bufferWritten(_ handle: Int) {
self
.currentBuffer()

View File

@ -171,9 +171,11 @@ public class NvimView: NSView,
.subscribe()
.disposed(by: db)
}
self.tabBar?.reorderHandler = { [weak self] index, _, _ in
self.tabBar?.reorderHandler = { [weak self] index, _, entries in
// I don't know why, but `tabm ${last_index}` does not always work.
let command = (index == entries.count - 1) ? "tabm" : "tabm \(index)"
self?.api
.command(command: "tabm \(index)")
.command(command: command)
.subscribe()
.disposed(by: db)
}