1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-26 15:25:14 +03:00

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

This commit is contained in:
Tae Won Ha 2019-03-06 16:45:40 +01:00
commit 21289d79d9
29 changed files with 162 additions and 157 deletions

View File

@ -4,10 +4,8 @@ github "eonil/FileSystemEvents" == 1.0.0
github "sparkle-project/Sparkle" == 1.21.3 github "sparkle-project/Sparkle" == 1.21.3
github "qvacua/CocoaFontAwesome" "master" github "qvacua/CocoaFontAwesome" "master"
github "qvacua/CocoaMarkdown" "master" github "qvacua/CocoaMarkdown" "master"
github "qvacua/RxMessagePort" == 0.0.5 github "qvacua/RxMessagePort" == 0.0.6
github "qvacua/RxNeovimApi" == 0.3.4 github "qvacua/RxNeovimApi" == 0.3.4-1
# remove after 10.12 update
github "qvacua/RxMsgpackRpc" == 0.0.7
github "sindresorhus/github-markdown-css" == 3.0.1 github "sindresorhus/github-markdown-css" == 3.0.1
github "httpswift/swifter" == 1.4.5 github "httpswift/swifter" == 1.4.5
github "a2/MessagePack.swift" == 3.0.0 github "a2/MessagePack.swift" == 3.0.0

View File

@ -6,11 +6,11 @@ github "a2/MessagePack.swift" "3.0.0"
github "elegantchaos/DictionaryCoding" "1.0.6" github "elegantchaos/DictionaryCoding" "1.0.6"
github "eonil/FileSystemEvents" "1.0.0" github "eonil/FileSystemEvents" "1.0.0"
github "httpswift/swifter" "1.4.5" github "httpswift/swifter" "1.4.5"
github "qvacua/CocoaFontAwesome" "76cf6c4ef3088d84f78988183c56fc6abdc19f83" github "qvacua/CocoaFontAwesome" "c4d9ac161c43a7d22ae711d112ca6c6d90c86b52"
github "qvacua/CocoaMarkdown" "7756ad96d5fb390c66531004868e828bb54d3609" github "qvacua/CocoaMarkdown" "c58166490a71ad4d8466f7e7b9faf7cb0917c42f"
github "qvacua/RxMessagePort" "v0.0.5" github "qvacua/RxMessagePort" "v0.0.6"
github "qvacua/RxMsgpackRpc" "v0.0.7" github "qvacua/RxMsgpackRpc" "v0.0.8"
github "qvacua/RxNeovimApi" "0.3.4" github "qvacua/RxNeovimApi" "v0.3.4-1"
github "qvacua/ShortcutRecorder" "71baf522a1e57b5f130055e33dcd800687f6ea80" github "qvacua/ShortcutRecorder" "71baf522a1e57b5f130055e33dcd800687f6ea80"
github "sindresorhus/github-markdown-css" "v3.0.1" github "sindresorhus/github-markdown-css" "v3.0.1"
github "sparkle-project/Sparkle" "1.21.3" github "sparkle-project/Sparkle" "1.21.3"

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>SNAPSHOT-302</string> <string>0.26.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>302</string> <string>303</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>

View File

@ -803,7 +803,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 302; CURRENT_PROJECT_VERSION = 303;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -821,7 +821,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@ -865,7 +865,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 302; CURRENT_PROJECT_VERSION = 303;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -877,7 +877,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SWIFT_DISABLE_SAFETY_CHECKS = YES; SWIFT_DISABLE_SAFETY_CHECKS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@ -894,7 +894,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 302; DYLIB_CURRENT_VERSION = 303;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac"; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
@ -916,7 +916,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 302; DYLIB_CURRENT_VERSION = 303;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac"; FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;

View File

@ -20,6 +20,8 @@ final class AttributesRunDrawer {
} }
var usesLigatures: Bool var usesLigatures: Bool
var drawsParallel = false
private(set) var cellSize: CGSize = .zero private(set) var cellSize: CGSize = .zero
private(set) var baselineOffset: CGFloat = 0 private(set) var baselineOffset: CGFloat = 0
private(set) var descent: CGFloat = 0 private(set) var descent: CGFloat = 0
@ -40,15 +42,11 @@ final class AttributesRunDrawer {
offset: CGPoint, offset: CGPoint,
`in` context: CGContext `in` context: CGContext
) { ) {
#if DEBUG let runs = self.drawsParallel ?
self.drawByParallelComputation( attrsRuns.parallelMap(chunkSize: 50) { run in
attrsRuns, self.fontGlyphRuns(from: run, offset: offset)
defaultAttributes: defaultAttributes, }
offset: offset, : attrsRuns.map { self.fontGlyphRuns(from: $0, offset: offset) }
in: context
)
#else
let runs = attrsRuns.map { self.fontGlyphRuns(from: $0, offset: offset) }
for i in 0..<attrsRuns.count { for i in 0..<attrsRuns.count {
self.draw( self.draw(
@ -58,9 +56,10 @@ final class AttributesRunDrawer {
in: context in: context
) )
} }
#endif
} }
private let typesetter = Typesetter()
private func draw( private func draw(
_ run: AttributesRun, _ run: AttributesRun,
fontGlyphRuns: [FontGlyphRun], fontGlyphRuns: [FontGlyphRun],
@ -144,8 +143,6 @@ final class AttributesRunDrawer {
context.strokePath() context.strokePath()
} }
private let typesetter = Typesetter()
private func draw( private func draw(
backgroundFor run: AttributesRun, backgroundFor run: AttributesRun,
with defaultAttributes: CellAttributes, with defaultAttributes: CellAttributes,
@ -196,27 +193,6 @@ final class AttributesRunDrawer {
return fontGlyphRuns return fontGlyphRuns
} }
private func drawByParallelComputation(
_ attrsRuns: [AttributesRun],
defaultAttributes: CellAttributes,
offset: CGPoint,
`in` context: CGContext
) {
var result = Array(repeating: [FontGlyphRun](), count: attrsRuns.count)
DispatchQueue.concurrentPerform(iterations: attrsRuns.count) { i in
result[i] = self.fontGlyphRuns(from: attrsRuns[i], offset: offset)
}
attrsRuns.enumerated().forEach { (i, attrsRun) in
self.draw(
attrsRun,
fontGlyphRuns: result[i],
defaultAttributes: defaultAttributes,
in: context
)
}
}
private func updateFontMetrics() { private func updateFontMetrics() {
self.cellSize = FontUtils.cellSize( self.cellSize = FontUtils.cellSize(
of: self.font, linespacing: self.linespacing of: self.font, linespacing: self.linespacing

View File

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

View File

@ -139,6 +139,12 @@ public class NvimView: NSView,
} }
} }
public var drawsParallel = false {
didSet {
self.drawer.drawsParallel = self.drawsParallel
}
}
public var linespacing: CGFloat { public var linespacing: CGFloat {
get { get {
return self._linespacing return self._linespacing

View File

@ -16,20 +16,34 @@ extension Array where Element: Hashable {
extension RandomAccessCollection where Index == Int { extension RandomAccessCollection where Index == Int {
/// Does not retain the order of elements. func parallelMap<T>(
func parallelMap<T>(_ transform: @escaping (Element) -> T) -> [T] { chunkSize: Int = 1,
var result = Array<T>() _ transform: @escaping (Element) -> T
result.reserveCapacity(self.count) ) -> [T] {
let count = self.count
guard count > chunkSize else { return self.map(transform) }
var lock = OS_SPINLOCK_INIT var result = Array<T?>(repeating: nil, count: count)
DispatchQueue.concurrentPerform(iterations: self.count) { i in
let mapped = transform(self[self.startIndex + i]) // If we don't use Array.withUnsafeMutableBufferPointer,
OSSpinLockLock(&lock) // then we get crashes.
result.append(mapped) result.withUnsafeMutableBufferPointer { pointer in
OSSpinLockUnlock(&lock) if chunkSize == 1 {
DispatchQueue.concurrentPerform(iterations: count) { i in
pointer[i] = transform(self[i])
}
} else {
let chunkCount = Int(ceil(Double(self.count) / Double(chunkSize)))
DispatchQueue.concurrentPerform(iterations: chunkCount) { chunkIndex in
let start = Swift.min(chunkIndex * chunkSize, count)
let end = Swift.min(start + chunkSize, count)
(start..<end).forEach { i in pointer[i] = transform(self[i]) }
}
}
} }
return result return result.map { $0! }
} }
func groupedRanges<T: Equatable>( func groupedRanges<T: Equatable>(

View File

@ -15,8 +15,8 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>SNAPSHOT-302</string> <string>0.26.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>302</string> <string>303</string>
</dict> </dict>
</plist> </plist>

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,7 @@ VimR — Neovim Refined
[Download](https://github.com/qvacua/vimr/releases) • <http://vimr.org> [Download](https://github.com/qvacua/vimr/releases) • <http://vimr.org>
[![Bountysource](https://www.bountysource.com/badge/team?team_id=933&style=raised)](https://www.bountysource.com/teams/vimr?utm_source=VimR%20%E2%80%94%20Vim%20Refined&utm_medium=shield&utm_campaign=raised) [![Chat at https://gitter.im/vimr/vimr](https://badges.gitter.im/vimr/vimr.svg)](https://gitter.im/vimr/vimr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Travis builds](https://travis-ci.org/qvacua/vimr.svg?branch=develop)](https://travis-ci.org/qvacua/vimr) [![Stories in Ready](https://badge.waffle.io/qvacua/vimr.svg?label=ready&title=Ready)](http://waffle.io/qvacua/vimr) [![Bountysource](https://www.bountysource.com/badge/team?team_id=933&style=raised)](https://www.bountysource.com/teams/vimr?utm_source=VimR%20%E2%80%94%20Vim%20Refined&utm_medium=shield&utm_campaign=raised) [![Chat at https://gitter.im/vimr/vimr](https://badges.gitter.im/vimr/vimr.svg)](https://gitter.im/vimr/vimr?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Stories in Ready](https://badge.waffle.io/qvacua/vimr.svg?label=ready&title=Ready)](http://waffle.io/qvacua/vimr)
![Screenshot 1](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot1.png) ![Screenshot 1](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot1.png)
![Screenshot 0](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot0.png) ![Screenshot 0](https://raw.githubusercontent.com/qvacua/vimr/develop/resources/screenshot0.png)
@ -13,9 +13,9 @@ VimR — Neovim Refined
## About ## About
Project VimR is an attempt to refine the Neovim experience (or just YA Neovim GUI for mac OS). The goal is to build an editor that uses Neovim inside with many of the convenience GUI features similar to those present in modern editors. We mainly use Swift, but also use Objective-C when its C-nature helps. Project VimR is an attempt to refine the Neovim experience (or just YA Neovim GUI for macOS). The goal is to build an editor that uses Neovim inside with many of the convenience GUI features similar to those present in modern editors. We mainly use Swift, but also use Objective-C when its C-nature helps.
There are other working Neovim GUIs for OS X, e.g. [NyaoVim](https://github.com/rhysd/NyaoVim), [neovim-dot-app](https://github.com/rogual/neovim-dot-app), etc., why another? There are other working Neovim GUIs for macOS, e.g. [NyaoVim](https://github.com/rhysd/NyaoVim), [neovim-dot-app](https://github.com/rogual/neovim-dot-app), [Oni](https://onivim.io), etc., why another?
- play around (obviously) with [Neovim](https://github.com/qvacua/neovim), - play around (obviously) with [Neovim](https://github.com/qvacua/neovim),
- play around with Swift (and especially with [RxSwift](https://github.com/ReactiveX/RxSwift)) and - play around with Swift (and especially with [RxSwift](https://github.com/ReactiveX/RxSwift)) and
@ -33,17 +33,14 @@ If you want to support VimR financially, you can use [Bountysource](https://www.
Pre-built binaries can be found under [Releases](https://github.com/qvacua/vimr/releases). Pre-built binaries can be found under [Releases](https://github.com/qvacua/vimr/releases).
## Implemented Features ## Some Features
* Multiple windows.
* Basic input including Emojis and Hangul (+Hanja): We don't know whether other input systems work... * Basic input including Emojis and Hangul (+Hanja): We don't know whether other input systems work...
* Markdown preview * Markdown preview
* Generic HTML preview (retains the scroll position when reloading) * Generic HTML preview (retains the scroll position when reloading)
* Basic mouse support: Left button actions and scrolling.
* Fuzzy file finder a la Xcode's "Open Quickly..." * Fuzzy file finder a la Xcode's "Open Quickly..."
* Basic trackpad support: Pinching for zooming and two-finger scrolling. * Trackpad support: Pinching for zooming and two-finger scrolling.
* Ligatures: Turned off by default. Turn it on in the Preferences. * Ligatures: Turned off by default. Turn it on in the Preferences.
* Basic File and Edit menu items.
* Command line tool. * Command line tool.
* (Simple) File browser * (Simple) File browser
* Flexible workspace model a la JetBrain's IDEs * Flexible workspace model a la JetBrain's IDEs
@ -59,7 +56,7 @@ git submodule init
git submodule update git submodule update
``` ```
You have to use Xcode 9. First install `homebrew`, then in the project root: You have to use Xcode 10.1. First install `homebrew`, then in the project root:
```bash ```bash
xcode-select --install # install the Xcode command line tools, if you haven't already xcode-select --install # install the Xcode command line tools, if you haven't already
@ -75,7 +72,7 @@ brew bundle
``` ```
VimR.app VimR.app
+-- NvimView.framework +-- NvimView.framework
   +-- NeoVimView    +-- NVimView
   +-- runtime files for Neovim    +-- runtime files for Neovim
   +-- NvimServer    +-- NvimServer
      +-- libnvim       +-- libnvim

View File

@ -1334,7 +1334,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 302; CURRENT_PROJECT_VERSION = 303;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@ -1352,7 +1352,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG"; OTHER_SWIFT_FLAGS = "-D DEBUG";
@ -1392,7 +1392,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 302; CURRENT_PROJECT_VERSION = 303;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -1404,7 +1404,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11; MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SWIFT_DISABLE_SAFETY_CHECKS = YES; SWIFT_DISABLE_SAFETY_CHECKS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";

View File

@ -19,6 +19,10 @@ class AdvancedPrefReducer: ReducerType {
state.mainWindowTemplate.useLiveResize = value state.mainWindowTemplate.useLiveResize = value
state.mainWindows.keys.forEach { state.mainWindows[$0]?.useLiveResize = value } state.mainWindows.keys.forEach { state.mainWindows[$0]?.useLiveResize = value }
case let .setDrawsParallel(value):
state.mainWindowTemplate.drawsParallel = value
state.mainWindows.keys.forEach { state.mainWindows[$0]?.drawsParallel = value }
case let .setTrackpadScrollResistance(value): case let .setTrackpadScrollResistance(value):
state.mainWindowTemplate.trackpadScrollResistance = value state.mainWindowTemplate.trackpadScrollResistance = value
state.mainWindows.keys.forEach { state.mainWindows[$0]?.trackpadScrollResistance = value } state.mainWindows.keys.forEach { state.mainWindows[$0]?.trackpadScrollResistance = value }

View File

@ -17,6 +17,7 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
case setUseSnapshotUpdate(Bool) case setUseSnapshotUpdate(Bool)
case setTrackpadScrollResistance(Double) case setTrackpadScrollResistance(Double)
case setUseLiveResize(Bool) case setUseLiveResize(Bool)
case setDrawsParallel(Bool)
} }
override var displayName: String { override var displayName: String {
@ -34,6 +35,7 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
self.useSnapshotUpdate = state.useSnapshotUpdate self.useSnapshotUpdate = state.useSnapshotUpdate
self.sensitivity = 1 / state.mainWindowTemplate.trackpadScrollResistance self.sensitivity = 1 / state.mainWindowTemplate.trackpadScrollResistance
self.useLiveResize = state.mainWindowTemplate.useLiveResize self.useLiveResize = state.mainWindowTemplate.useLiveResize
self.drawsParallel = state.mainWindowTemplate.drawsParallel
super.init(frame: .zero) super.init(frame: .zero)
@ -63,11 +65,13 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
private var useInteractiveZsh: Bool private var useInteractiveZsh: Bool
private var useSnapshotUpdate: Bool private var useSnapshotUpdate: Bool
private var useLiveResize: Bool private var useLiveResize: Bool
private var drawsParallel: Bool
private var sensitivity: Double private var sensitivity: Double
private let useInteractiveZshCheckbox = NSButton(forAutoLayout: ()) private let useInteractiveZshCheckbox = NSButton(forAutoLayout: ())
private let useSnapshotUpdateCheckbox = NSButton(forAutoLayout: ()) private let useSnapshotUpdateCheckbox = NSButton(forAutoLayout: ())
private let useLiveResizeCheckbox = NSButton(forAutoLayout: ()) private let useLiveResizeCheckbox = NSButton(forAutoLayout: ())
private let drawsParallelCheckbox = NSButton(forAutoLayout: ())
private let sensitivitySlider = NSSlider(forAutoLayout: ()) private let sensitivitySlider = NSSlider(forAutoLayout: ())
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -78,6 +82,7 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
self.useSnapshotUpdateCheckbox.boolState = self.useSnapshotUpdate self.useSnapshotUpdateCheckbox.boolState = self.useSnapshotUpdate
self.useInteractiveZshCheckbox.boolState = self.useInteractiveZsh self.useInteractiveZshCheckbox.boolState = self.useInteractiveZsh
self.useLiveResizeCheckbox.boolState = self.useLiveResize self.useLiveResizeCheckbox.boolState = self.useLiveResize
self.drawsParallelCheckbox.boolState = self.drawsParallel
// We don't update the value of the NSSlider since we don't know when events are fired. // We don't update the value of the NSSlider since we don't know when events are fired.
} }
@ -108,7 +113,7 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
""") """)
let useLiveResize = self.useLiveResizeCheckbox let useLiveResize = self.useLiveResizeCheckbox
self.configureCheckbox(button: self.useLiveResizeCheckbox, self.configureCheckbox(button: useLiveResize,
title: "Use Live Window Resizing", title: "Use Live Window Resizing",
action: #selector(AdvancedPref.useLiveResizeAction(_:))) action: #selector(AdvancedPref.useLiveResizeAction(_:)))
@ -117,6 +122,19 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
If you do, please report them at [GitHub](https://github.com/qvacua/vimr/issues). If you do, please report them at [GitHub](https://github.com/qvacua/vimr/issues).
""") """)
let drawsParallelBox = self.drawsParallelCheckbox
self.configureCheckbox(button: drawsParallelBox,
title: "Use Concurrent Rendering",
action: #selector(AdvancedPref.drawParallelAction(_:)))
let drawsParallelInfo = self.infoTextField(
markdown: """
VimR can compute the glyphs concurrently. This may result in faster rendering,
depending on the situation. It will definitely result in higher CPU usage, e.g.
when scrolling very fast.
"""
)
let sensitivityTitle = self.titleTextField(title: "Scroll Sensitivity:") let sensitivityTitle = self.titleTextField(title: "Scroll Sensitivity:")
let sensitivity = self.sensitivitySlider let sensitivity = self.sensitivitySlider
sensitivity.maxValue = 1 / 5.0 sensitivity.maxValue = 1 / 5.0
@ -142,6 +160,8 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
self.addSubview(sensitivityInfo) self.addSubview(sensitivityInfo)
self.addSubview(useLiveResize) self.addSubview(useLiveResize)
self.addSubview(useLiveResizeInfo) self.addSubview(useLiveResizeInfo)
self.addSubview(drawsParallelBox)
self.addSubview(drawsParallelInfo)
paneTitle.autoPinEdge(toSuperviewEdge: .top, withInset: 18) paneTitle.autoPinEdge(toSuperviewEdge: .top, withInset: 18)
paneTitle.autoPinEdge(toSuperviewEdge: .left, withInset: 18) paneTitle.autoPinEdge(toSuperviewEdge: .left, withInset: 18)
@ -165,7 +185,14 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
useLiveResizeInfo.autoPinEdge(.left, to: .left, of: useLiveResize) useLiveResizeInfo.autoPinEdge(.left, to: .left, of: useLiveResize)
useLiveResizeInfo.autoSetDimension(.width, toSize: 300) useLiveResizeInfo.autoSetDimension(.width, toSize: 300)
useSnapshotUpdate.autoPinEdge(.top, to: .bottom, of: useLiveResizeInfo, withOffset: 18) drawsParallelBox.autoPinEdge(.top, to: .bottom, of: useLiveResizeInfo, withOffset: 18)
drawsParallelBox.autoPinEdge(.left, to: .right, of: sensitivityTitle, withOffset: 5)
drawsParallelInfo.autoPinEdge(.top, to: .bottom, of: drawsParallelBox, withOffset: 5)
drawsParallelInfo.autoPinEdge(.left, to: .left, of: drawsParallelBox)
drawsParallelInfo.autoSetDimension(.width, toSize: 300)
useSnapshotUpdate.autoPinEdge(.top, to: .bottom, of: drawsParallelInfo, withOffset: 18)
useSnapshotUpdate.autoPinEdge(.left, to: .right, of: sensitivityTitle, withOffset: 5) useSnapshotUpdate.autoPinEdge(.left, to: .right, of: sensitivityTitle, withOffset: 5)
useSnapshotUpdateInfo.autoPinEdge(.top, to: .bottom, of: useSnapshotUpdate, withOffset: 5) useSnapshotUpdateInfo.autoPinEdge(.top, to: .bottom, of: useSnapshotUpdate, withOffset: 5)
@ -188,6 +215,10 @@ extension AdvancedPref {
self.emit(.setUseLiveResize(sender.boolState)) self.emit(.setUseLiveResize(sender.boolState))
} }
@objc func drawParallelAction(_ sender: NSButton) {
self.emit(.setDrawsParallel(sender.boolState))
}
@objc func sensitivitySliderAction(_ sender: NSSlider) { @objc func sensitivitySliderAction(_ sender: NSSlider) {
self.emit(.setTrackpadScrollResistance(1 / sender.doubleValue)) self.emit(.setTrackpadScrollResistance(1 / sender.doubleValue))
} }

View File

@ -1224,7 +1224,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>SNAPSHOT-302</string> <string>0.26.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -1241,7 +1241,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>302</string> <string>303</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string> <string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View File

@ -215,6 +215,7 @@ class MainWindow: NSObject,
self.defaultFont = state.appearance.font self.defaultFont = state.appearance.font
self.linespacing = state.appearance.linespacing self.linespacing = state.appearance.linespacing
self.usesLigatures = state.appearance.usesLigatures self.usesLigatures = state.appearance.usesLigatures
self.usesLigatures = state.drawsParallel
self.editorPosition = state.preview.editorPosition self.editorPosition = state.preview.editorPosition
self.previewPosition = state.preview.previewPosition self.previewPosition = state.preview.previewPosition
@ -253,6 +254,7 @@ class MainWindow: NSObject,
state.trackpadScrollResistance state.trackpadScrollResistance
) )
self.neoVimView.usesLiveResize = state.useLiveResize self.neoVimView.usesLiveResize = state.useLiveResize
self.neoVimView.drawsParallel = self.drawsParallel
self.updateNeoVimAppearance() self.updateNeoVimAppearance()
Observable Observable
@ -401,6 +403,11 @@ class MainWindow: NSObject,
self.neoVimView.usesLiveResize = state.useLiveResize self.neoVimView.usesLiveResize = state.useLiveResize
} }
if self.drawsParallel != state.drawsParallel {
self.drawsParallel = state.drawsParallel
self.neoVimView.drawsParallel = self.drawsParallel
}
if self.defaultFont != state.appearance.font if self.defaultFont != state.appearance.font
|| self.linespacing != state.appearance.linespacing || self.linespacing != state.appearance.linespacing
|| self.usesLigatures != state.appearance.usesLigatures { || self.usesLigatures != state.appearance.usesLigatures {
@ -460,6 +467,7 @@ class MainWindow: NSObject,
private var defaultFont = NvimView.defaultFont private var defaultFont = NvimView.defaultFont
private var linespacing = NvimView.defaultLinespacing private var linespacing = NvimView.defaultLinespacing
private var usesLigatures = false private var usesLigatures = false
private var drawsParallel = false
private var previewPosition = Marked(Position.beginning) private var previewPosition = Marked(Position.beginning)

View File

@ -263,6 +263,7 @@ extension MainWindow {
var trackpadScrollResistance = 5.0 var trackpadScrollResistance = 5.0
var useLiveResize = false var useLiveResize = false
var drawsParallel = false
var isTemporarySession = false var isTemporarySession = false
@ -308,6 +309,7 @@ extension MainWindow {
case trackpadScrollResistance = "trackpad-scroll-resistance" case trackpadScrollResistance = "trackpad-scroll-resistance"
case useInteractiveZsh = "use-interactive-zsh" case useInteractiveZsh = "use-interactive-zsh"
case useLiveResize = "use-live-resize" case useLiveResize = "use-live-resize"
case drawsParallel = "draws-parallel"
case isShowHidden = "is-show-hidden" case isShowHidden = "is-show-hidden"
case appearance = "appearance" case appearance = "appearance"
@ -326,6 +328,7 @@ extension MainWindow {
self.trackpadScrollResistance = try container.decode(forKey: .trackpadScrollResistance, self.trackpadScrollResistance = try container.decode(forKey: .trackpadScrollResistance,
default: State.default.trackpadScrollResistance) default: State.default.trackpadScrollResistance)
self.useLiveResize = try container.decode(forKey: .useLiveResize, default: State.default.useLiveResize) self.useLiveResize = try container.decode(forKey: .useLiveResize, default: State.default.useLiveResize)
self.drawsParallel = try container.decode(forKey: .drawsParallel, default: State.default.drawsParallel)
if let frameRawValue = try container.decodeIfPresent(String.self, forKey: .frame) { if let frameRawValue = try container.decodeIfPresent(String.self, forKey: .frame) {
self.frame = NSRectFromString(frameRawValue) self.frame = NSRectFromString(frameRawValue)
} else { } else {
@ -380,6 +383,7 @@ extension MainWindow {
try container.encode(NSStringFromRect(self.frame), forKey: .frame) try container.encode(NSStringFromRect(self.frame), forKey: .frame)
try container.encode(self.trackpadScrollResistance, forKey: .trackpadScrollResistance) try container.encode(self.trackpadScrollResistance, forKey: .trackpadScrollResistance)
try container.encode(self.useLiveResize, forKey: .useLiveResize) try container.encode(self.useLiveResize, forKey: .useLiveResize)
try container.encode(self.drawsParallel, forKey: .drawsParallel)
try container.encode(self.isLeftOptionMeta, forKey: .isLeftOptionMeta) try container.encode(self.isLeftOptionMeta, forKey: .isLeftOptionMeta)
try container.encode(self.isRightOptionMeta, forKey: .isRightOptionMeta) try container.encode(self.isRightOptionMeta, forKey: .isRightOptionMeta)
try container.encode(self.useInteractiveZsh, forKey: .useInteractiveZsh) try container.encode(self.useInteractiveZsh, forKey: .useInteractiveZsh)

View File

@ -21,42 +21,6 @@ extension String {
} }
} }
extension Array {
/// Concurrent and chunked version of `Array.map`.
///
/// - parameters:
/// - chunk: Batch size; defaults to `100`.
/// - queue: Defaults to `dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0)`.
/// - transform: The transform function.
/// - returns: Transformed array of `self`.
func concurrentChunkMap<R>(
_ chunk: Int = 100,
queue: DispatchQueue = .global(qos: .userInitiated),
transform: (Element) -> R
) -> [R] {
let count = self.count
let chunkedCount = Int(ceil(Float(count) / Float(chunk)))
var result: [[R]] = []
var spinLock = OS_SPINLOCK_INIT
DispatchQueue.concurrentPerform(iterations: chunkedCount) { idx in
let startIndex = Swift.min(idx * chunk, count)
let endIndex = Swift.min(startIndex + chunk, count)
let mappedChunk = self[startIndex..<endIndex].map(transform)
OSSpinLockLock(&spinLock)
result.append(mappedChunk)
OSSpinLockUnlock(&spinLock)
}
return result.flatMap { $0 }
}
}
extension Array where Element: Equatable { extension Array where Element: Equatable {
func removingDuplicatesPreservingFromBeginning() -> [Element] { func removingDuplicatesPreservingFromBeginning() -> [Element] {

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>SNAPSHOT-302</string> <string>0.26.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>302</string> <string>303</string>
</dict> </dict>
</plist> </plist>

View File

@ -7,36 +7,28 @@
<description>Most recent changes with links to updates for VimR.</description> <description>Most recent changes with links to updates for VimR.</description>
<language>en</language> <language>en</language>
<item> <item>
<title>v0.25.0-297</title> <title>v0.26.0-303</title>
<description><![CDATA[ <description><![CDATA[
<ul> <ul>
<li>Neovim 0.3.4</li> <li>Minimum macOS requirement is now 10.12 Sierra.</li>
<li>GH-625: <code>vimr --cur-env</code> will pass the current environment variables to the new neovim process. This will result in <code>virtualenv</code> support.</li> <li>Optional parallel computation of glyphs. This may result in faster rendering depending on the situation.</li>
<li>GH-443: <code>vimr --line ${LINE_NUMBER} ${SOME_FILE}</code> will open the file and go to the given line. If the file is already open in a UI window, then that window will be selected and the cursor will be moved to the given line. This can be used for example to reverse-search LaTeX.</li> <li>GH-314: You can customize the key shortcut for all menu items in the <em>Shortcut</em> preferences pane.</li>
<li>GH-603: Bugfix: <code>Cmd-V</code> pastes at the wrong location in the insert mode.</li> <li>GH-501: Add key shortcuts to toggle the Buffer List, Markdown Preview, and HTML Preview tools.</li>
<li>GH-659: Bugfix (introduced in a snapshot): Turning off ligatures does not really turn off ligatures.</li> <li>GH-649: Add commands that can control some of GUI elements.</li>
<li>GH-664: Bugfix: VimR crashes for some shell configurations.</li> <li>GH-506: Set font, size and linespacing via <code>~/.config/nvim/ginit.vim</code>.</li>
<li>GH-666: Adapt to the new UI-API of Neovim</li> <li>Draw the disclosure triangle in appropriate color of the current color scheme (and improve handling of changes of <code>cwd</code> in the file browser).</li>
<li>Dependencies updates:<ul>
<li>ReactiveX/RxSwift@4.4.1</li>
<li>httpswift/swifter@1.4.5</li>
<li>PureLayout/PureLayout@3.1.4</li>
<li>sindresorhus/github-markdown-css@3.0.1</li>
<li>sparkle-project/Sparkle@1.21.3</li>
</ul>
</li>
</ul> </ul>
]]></description> ]]></description>
<releaseNotesLink> <releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/v0.25.0-297 https://github.com/qvacua/vimr/releases/tag/v0.26.0-303
</releaseNotesLink> </releaseNotesLink>
<pubDate>2019-02-23T17:55:14.811734</pubDate> <pubDate>2019-03-06T16:41:54.852561</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion> <minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.25.0-297/VimR-v0.25.0-297.tar.bz2" <enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.0-303/VimR-v0.26.0-303.tar.bz2"
sparkle:version="297" sparkle:version="303"
sparkle:shortVersionString="0.25.0" sparkle:shortVersionString="0.26.0"
sparkle:dsaSignature="MC4CFQC7d60NkbkgZndkDtFrmfJ2Um1yBAIVAKwxaxYy+9FpNNJXOFhAhVUTdxfK" sparkle:dsaSignature="MCwCFHaP11nsWF1cpjdrkDzT+lgmYkzIAhQn7eyPAKIRr3ej1ZOpBwub3NXYRw=="
length="14935040" length="15025572"
type="application/octet-stream"/> type="application/octet-stream"/>
</item> </item>
</channel> </channel>

View File

@ -7,22 +7,28 @@
<description>Most recent changes with links to updates for VimR.</description> <description>Most recent changes with links to updates for VimR.</description>
<language>en</language> <language>en</language>
<item> <item>
<title>SNAPSHOT-302</title> <title>v0.26.0-303</title>
<description><![CDATA[ <description><![CDATA[
<ul> <ul>
<li>Minimum macOS requirement is now 10.12 Sierra.</li>
<li>Optional parallel computation of glyphs. This may result in faster rendering depending on the situation.</li>
<li>GH-314: You can customize the key shortcut for all menu items in the <em>Shortcut</em> preferences pane.</li>
<li>GH-501: Add key shortcuts to toggle the Buffer List, Markdown Preview, and HTML Preview tools.</li>
<li>GH-649: Add commands that can control some of GUI elements.</li>
<li>GH-506: Set font, size and linespacing via <code>~/.config/nvim/ginit.vim</code>.</li> <li>GH-506: Set font, size and linespacing via <code>~/.config/nvim/ginit.vim</code>.</li>
<li>Draw the disclosure triangle in appropriate color of the current color scheme (and improve handling of changes of <code>cwd</code> in the file browser).</li>
</ul> </ul>
]]></description> ]]></description>
<releaseNotesLink> <releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/snapshot/302 https://github.com/qvacua/vimr/releases/tag/v0.26.0-303
</releaseNotesLink> </releaseNotesLink>
<pubDate>2019-03-05T09:14:18.762884</pubDate> <pubDate>2019-03-06T16:41:54.852561</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion> <minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/302/VimR-SNAPSHOT-302.tar.bz2" <enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.0-303/VimR-v0.26.0-303.tar.bz2"
sparkle:version="302" sparkle:version="303"
sparkle:shortVersionString="SNAPSHOT-302" sparkle:shortVersionString="0.26.0"
sparkle:dsaSignature="MC0CFQC2CIhh9s/ypv/buT4NeP2+Un5IYAIUQXfPdSh2dbROxYJyZ4zx808ylV0=" sparkle:dsaSignature="MCwCFHaP11nsWF1cpjdrkDzT+lgmYkzIAhQn7eyPAKIRr3ej1ZOpBwub3NXYRw=="
length="15102917" length="15025572"
type="application/octet-stream"/> type="application/octet-stream"/>
</item> </item>
</channel> </channel>

View File

@ -3,7 +3,7 @@
set -e set -e
GETTEXT_VERSION="0.19.8.1" GETTEXT_VERSION="0.19.8.1"
DEPLOYMENT_TARGET="10.11" DEPLOYMENT_TARGET="10.12"
echo "### Building deps" echo "### Building deps"

View File

@ -2,7 +2,7 @@
set -e set -e
DEPLOYMENT_TARGET="10.11" DEPLOYMENT_TARGET="10.12"
echo "### Building libnvim" echo "### Building libnvim"

BIN
resources/advanced-pref.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 KiB

View File

@ -1,11 +1,16 @@
# 0.26.0-??? # 0.27.0-???
* ...
# 0.26.0-303
* Minimum macOS requirement is now 10.12 Sierra.
* Optional parallel computation of glyphs. This may result in faster rendering depending on the situation.
* GH-314: You can customize the key shortcut for all menu items in the *Shortcut* preferences pane. * GH-314: You can customize the key shortcut for all menu items in the *Shortcut* preferences pane.
* GH-501: Add key shortcuts to toggle the Buffer List, Markdown Preview, and HTML Preview tools. * GH-501: Add key shortcuts to toggle the Buffer List, Markdown Preview, and HTML Preview tools.
* GH-649: Add commands that can control some of GUI elements. * GH-649: Add commands that can control some of GUI elements.
* GH-506: Set font, size and linespacing via `~/.config/nvim/ginit.vim`. * GH-506: Set font, size and linespacing via `~/.config/nvim/ginit.vim`.
* Draw the disclosure triangle in appropriate color of the current color scheme (and improve handling of changes of `cwd` in the file browser). * Draw the disclosure triangle in appropriate color of the current color scheme (and improve handling of changes of `cwd` in the file browser).
* ...
# 0.25.0-297 # 0.25.0-297

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 664 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB