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

Merge remote-tracking branch 'origin/develop' into update-neovim

This commit is contained in:
Tae Won Ha 2017-12-09 18:02:58 +01:00
commit 1106a692d4
17 changed files with 128 additions and 74 deletions

View File

@ -218,7 +218,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -278,7 +278,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -308,7 +308,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MsgPackRpc/Info.plist;
@ -331,7 +331,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MsgPackRpc/Info.plist;

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>SNAPSHOT-246</string>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -52,8 +52,11 @@ public class Connection {
locked(with: condition) { condition.broadcast() }
}
}
self.stopped = true
self.session.disconnectAndStop()
locked(with: self.sessionLock) {
self.stopped = true
self.session.disconnectAndStop()
}
}
@discardableResult
@ -64,6 +67,8 @@ public class Connection {
expectsReturnValue: Bool)
-> MsgPackRpc.Response {
let packed = pack(
[
.uint(UInt64(type)),
@ -74,18 +79,25 @@ public class Connection {
)
guard expectsReturnValue else {
self.session.write(packed)
return self.nilResponse(with: msgid)
return locked(with: self.sessionLock) {
if !self.stopped {
self.session.write(packed)
}
return self.nilResponse(with: msgid)
}
}
let condition = NSCondition()
locked(with: self.conditionsLock) { self.conditions[msgid] = condition }
if self.stopped {
return self.nilResponse(with: msgid)
}
locked(with: self.sessionLock) {
if self.stopped {
return
}
self.session.write(packed)
self.session.write(packed)
}
locked(with: condition) {
while !self.stopped && self.responses[msgid] == nil && condition.wait(until: Date(timeIntervalSinceNow: 5)) {}
@ -113,6 +125,7 @@ public class Connection {
private var conditions: [UInt32: NSCondition] = [:]
private let conditionsLock = NSRecursiveLock()
private let sessionLock = NSRecursiveLock()
private var stopped = false
private func nilResponse(with msgid: UInt32) -> MsgPackRpc.Response {

View File

@ -216,7 +216,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -276,7 +276,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -306,7 +306,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = NvimMsgPack/Info.plist;
@ -329,7 +329,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = NvimMsgPack/Info.plist;

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>SNAPSHOT-246</string>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -11,6 +11,7 @@
1929B86897DAEFDBABAB1C14 /* NvimApiExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BBD7F88AE4F01E626691 /* NvimApiExtension.swift */; };
4B2016EE1FD45EED0038528A /* NvimAutoCommandEvent.generated.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B2016EC1FD45EED0038528A /* NvimAutoCommandEvent.generated.m */; };
4B2016EF1FD45EED0038528A /* NvimAutoCommandEvent.generated.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B2016ED1FD45EED0038528A /* NvimAutoCommandEvent.generated.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B8662E81FDC3F9F007F490D /* vimr.vim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B8662E41FDC3D4F007F490D /* vimr.vim */; };
4B90F02D1FD2AFAE008A39E0 /* NvimUiBridgeProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B90F00F1FD2AFAC008A39E0 /* NvimUiBridgeProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B90F02E1FD2AFAE008A39E0 /* NvimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0101FD2AFAC008A39E0 /* NvimView.swift */; };
4B90F02F1FD2AFAE008A39E0 /* NvimView+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0111FD2AFAC008A39E0 /* NvimView+Resize.swift */; };
@ -62,6 +63,16 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
4B8662E71FDC3F70007F490D /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = runtime/plugin;
dstSubfolderSpec = 7;
files = (
4B8662E81FDC3F9F007F490D /* vimr.vim in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
4B90F04D1FD2AFD3008A39E0 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@ -88,6 +99,7 @@
1929BBD7F88AE4F01E626691 /* NvimApiExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NvimApiExtension.swift; sourceTree = "<group>"; };
4B2016EC1FD45EED0038528A /* NvimAutoCommandEvent.generated.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NvimAutoCommandEvent.generated.m; sourceTree = "<group>"; };
4B2016ED1FD45EED0038528A /* NvimAutoCommandEvent.generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NvimAutoCommandEvent.generated.h; sourceTree = "<group>"; };
4B8662E41FDC3D4F007F490D /* vimr.vim */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = vimr.vim; sourceTree = "<group>"; };
4B90F0041FD2AF59008A39E0 /* NvimView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NvimView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4B90F0081FD2AF59008A39E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4B90F00F1FD2AFAC008A39E0 /* NvimUiBridgeProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NvimUiBridgeProtocol.h; sourceTree = "<group>"; };
@ -185,6 +197,7 @@
isa = PBXGroup;
children = (
4B90F0081FD2AF59008A39E0 /* Info.plist */,
4B8662E41FDC3D4F007F490D /* vimr.vim */,
4BF18C5C1FD2EEE400DF95D1 /* NvimView.h */,
4B90F02B1FD2AFAD008A39E0 /* CellAttributes.swift */,
4B90F0161FD2AFAC008A39E0 /* CocoaExtensions.swift */,
@ -277,6 +290,7 @@
4B90F0001FD2AF59008A39E0 /* Frameworks */,
4B90F0011FD2AF59008A39E0 /* Headers */,
4B90F0021FD2AF59008A39E0 /* Resources */,
4B8662E71FDC3F70007F490D /* CopyFiles */,
4BE45C071FD2D4D7005C0A95 /* CopyFiles */,
);
buildRules = (
@ -470,7 +484,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -528,7 +542,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -555,7 +569,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;
@ -577,7 +591,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 245;
DYLIB_CURRENT_VERSION = 246;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>SNAPSHOT-246</string>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -59,10 +59,6 @@ extension NvimView {
self.nvim.connect()
self.nvim.setOption(name: "mouse", value: .string("a"))
self.nvim.setOption(name: "title", value: .bool(true))
self.nvim.setOption(name: "termguicolors", value: .bool(true))
if noErrorDuringInitialization == false {
self.logger.fault("There was an error launching neovim.")

View File

@ -180,8 +180,8 @@ extension NvimView {
public func stop() {
self.bridgeLogger.hr()
self.agent.quit()
self.nvim.disconnect()
self.agent.quit()
gui.async {
self.waitForNeoVimToQuit()

View File

@ -0,0 +1,3 @@
set termguicolors
set mouse=a
set title

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-243</string>
<string>SNAPSHOT-246</string>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -1105,7 +1105,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -1160,7 +1160,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 245;
CURRENT_PROJECT_VERSION = 246;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;

View File

@ -94,6 +94,7 @@ class FileOutlineView: NSOutlineView,
}
override func reloadData() {
self.cells.removeAll()
self.widths.removeAll()
super.reloadData()
}
@ -135,6 +136,7 @@ class FileOutlineView: NSOutlineView,
fileprivate var root: FileBrowserItem
fileprivate var widths = [String: CGFloat]()
fileprivate var cells = [String: ThemedTableCell]()
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
@ -179,7 +181,12 @@ class FileOutlineView: NSOutlineView,
.filter { (_, fileBrowserItem) in newPreparedChildren.contains(fileBrowserItem) == false }
.map { (idx, _) in idx }
indicesToRemove.forEach { self.widths.removeValue(forKey: curPreparedChildren[$0].url.path) }
indicesToRemove.forEach { index in
let path = curPreparedChildren[index].url.path
self.cells.removeValue(forKey: path)
self.widths.removeValue(forKey: path)
}
fileLog.debug("\(fileBrowserItem): \(curPreparedChildren) vs. \(indicesToRemove)")
@ -293,15 +300,48 @@ extension FileOutlineView {
}
func outlineView(_: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
let level = self.level(forItem: item) + 2
defer { self.adjustColumnWidths() }
if item == nil {
return self.prepare(self.root.children)[index]
let child = self.prepare(self.root.children)[index]
let cell = self.cell(forItem: child)
self.cells[child.url.path] = cell
self.widths[child.url.path] = self.cellWidth(for: cell, level: level)
return child
}
guard let fileBrowserItem = item as? FileBrowserItem else {
preconditionFailure("Should not happen")
}
return self.prepare(fileBrowserItem.children)[index]
let child = self.prepare(fileBrowserItem.children)[index]
let cell = self.cell(forItem: child)
self.cells[child.url.path] = cell
self.widths[child.url.path] = self.cellWidth(for: cell, level: level)
return child
}
private func cell(forItem item: FileBrowserItem) -> ThemedTableCell {
if let existingCell = self.cells[item.url.path] {
return existingCell
}
let cell = ThemedTableCell(withIdentifier: "file-cell-view")
cell.isDir = item.isDir
cell.text = item.url.lastPathComponent
if self.showsFileIcon {
let icon = FileUtils.icon(forUrl: item.url)
cell.image = cell.isHidden ? icon?.tinting(with: NSColor.white.withAlphaComponent(0.4)) : icon
}
return cell
}
func outlineView(_: NSOutlineView, isItemExpandable item: Any) -> Bool {
@ -350,23 +390,7 @@ extension FileOutlineView {
return nil
}
let cell = (self.makeView(withIdentifier: NSUserInterfaceItemIdentifier("file-cell-view"), owner: self) as? ThemedTableCell)?.reset()
?? ThemedTableCell(withIdentifier: "file-cell-view")
cell.isDir = fileBrowserItem.isDir
cell.text = fileBrowserItem.url.lastPathComponent
guard self.showsFileIcon else {
return cell
}
let icon = FileUtils.icon(forUrl: fileBrowserItem.url)
cell.image = fileBrowserItem.isHidden ? icon?.tinting(with: NSColor.white.withAlphaComponent(0.4)) : icon
self.widths[fileBrowserItem.url.path] = self.cellWidth(for: cell, level: self.level(forItem: item))
self.adjustColumnWidths()
return cell
return self.cells[fileBrowserItem.url.path]
}
func outlineView(_: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat {

View File

@ -32,7 +32,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-243</string>
<string>SNAPSHOT-246</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -100,13 +100,13 @@ class BuffersList: NSView,
}
fileprivate func adjustFileViewWidth() {
let maxWidth = self.buffers.reduce(CGFloat(0)) { (curMaxWidth, buffer) in
let maxWidth = self.buffers.reduce(CGFloat(100)) { (curMaxWidth, buffer) in
return max(self.text(for: buffer).size().width, curMaxWidth)
}
let column = self.bufferList.tableColumns[0]
column.minWidth = maxWidth + ThemedTableCell.widthWithoutText
column.maxWidth = column.minWidth
// If we set the minWidth and maxWidth here, the column does not get resized... Dunno why.
column.width = maxWidth + ThemedTableCell.widthWithoutText
}
}
@ -136,12 +136,14 @@ extension BuffersList {
extension BuffersList {
public func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
return tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("buffer-row-view"), owner: self) as? ThemedTableRow
?? ThemedTableRow(withIdentifier: "buffer-row-view", themedView: self)
return tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("buffer-row-view"), owner: self)
as? ThemedTableRow ?? ThemedTableRow(withIdentifier: "buffer-row-view", themedView: self)
}
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
let cachedCell = (tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("buffer-cell-view"), owner: self) as? ThemedTableCell)?.reset()
let cachedCell = (tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("buffer-cell-view"), owner: self)
as? ThemedTableCell)?.reset()
let cell = cachedCell ?? ThemedTableCell(withIdentifier: "buffer-cell-view")
let buffer = self.buffers[row]

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-243</string>
<string>SNAPSHOT-246</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>245</string>
<string>246</string>
</dict>
</plist>

View File

@ -7,22 +7,24 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>SNAPSHOT-243</title>
<title>SNAPSHOT-246</title>
<description><![CDATA[
<ul>
<li>GH-387: Show all buffers (the same as <code>:buffers</code>) in the buffers list</li>
<li>Some High Sierra related fixes</li>
<li>Do not crash on launch</li>
<li>Too narrow entries in the file browser and buffers list.</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/snapshot/243
https://github.com/qvacua/vimr/releases/tag/snapshot/246
</releaseNotesLink>
<pubDate>2017-12-01T22:07:42.069953</pubDate>
<pubDate>2017-12-09T17:57:47.512444</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/243/VimR-SNAPSHOT-243.tar.bz2"
sparkle:version="243"
sparkle:shortVersionString="SNAPSHOT-243"
sparkle:dsaSignature="MC0CFQDh4d54Pex+jDSdu0r9j1OhsrZYqQIUdbC+YQWl8bWB0cgkHra9JR9Zn4c="
length="14046487"
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/246/VimR-SNAPSHOT-246.tar.bz2"
sparkle:version="246"
sparkle:shortVersionString="SNAPSHOT-246"
sparkle:dsaSignature="MC0CFQDzBKxwPeP9IlKVvTwZqbQTR6gFAwIUQN9zAHmttTpkoH/OCs+//tw12yk="
length="14730787"
type="application/octet-stream"/>
</item>
</channel>