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

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

This commit is contained in:
Tae Won Ha 2019-03-11 08:48:35 +01:00
commit cafeeeeb55
17 changed files with 203 additions and 95 deletions

View File

@ -1,4 +1,4 @@
github "ReactiveX/RxSwift" == 4.4.1
github "ReactiveX/RxSwift" == 4.4.2
github "PureLayout/PureLayout" == 3.1.4
github "eonil/FileSystemEvents" == 1.0.0
github "sparkle-project/Sparkle" == 1.21.3
@ -12,4 +12,4 @@ github "a2/MessagePack.swift" == 3.0.0
github "elegantchaos/DictionaryCoding" == 1.0.6
github "qvacua/ShortcutRecorder" "temporary"
github "Quick/Nimble" == 7.3.4
github "Quick/Nimble" == 8.0.1

View File

@ -1,7 +1,7 @@
github "IBM-Swift/BlueSocket" "1.0.44"
github "PureLayout/PureLayout" "v3.1.4"
github "Quick/Nimble" "v7.3.4"
github "ReactiveX/RxSwift" "4.4.1"
github "Quick/Nimble" "v8.0.1"
github "ReactiveX/RxSwift" "4.4.2"
github "a2/MessagePack.swift" "3.0.0"
github "elegantchaos/DictionaryCoding" "1.0.6"
github "eonil/FileSystemEvents" "1.0.0"

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.26.3</string>
<string>0.26.4</string>
<key>CFBundleVersion</key>
<string>306</string>
<string>307</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>

View File

@ -66,7 +66,7 @@ class MyView: NSView {
)
*/
let runs = (0..<4).map { row in
let runs = (0..<5).map { row in
AttributesRun(
location: CGPoint(x: 0, y: CGFloat(row) * cellSize.height),
cells: self.ugrid.cells[row][0..<10],
@ -88,6 +88,7 @@ class MyView: NSView {
reverse: false
)
self.runDrawer.usesLigatures = true
runs.forEach { run in
self.runDrawer.draw(
runs,
@ -181,6 +182,15 @@ class MyView: NSView {
chunk: (0..<10).compactMap { String($0) },
attrIds: Array(repeating: 0, count: 10)
)
self.ugrid.update(
row: 4,
startCol: 0,
endCol: 8,
clearCol: 8,
clearAttr: 0,
chunk: ["", "", "", "", "", "-", ">", ""],
attrIds: Array(repeating: 0, count: 8)
)
}
}

View File

@ -11,6 +11,7 @@
1929B06F50B2585777FFBE48 /* NvimApiCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B002A03693B14B14BE34 /* NvimApiCommons.swift */; };
1929B14D2EBC34BCFEC78ACB /* CellAttributesCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BB19DD03ECD6ECC35F94 /* CellAttributesCollection.swift */; };
1929B2DB631E6EB5C3452B68 /* MyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BAF033A398BFBC2A7890 /* MyView.swift */; };
1929B2E9F089A9E2800B67F2 /* NimbleCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BF88DE64FC62AFFCBC84 /* NimbleCommons.swift */; };
1929B36C51BCDFCCEE974EA2 /* SwiftCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B9C55A79D97272894F5D /* SwiftCommons.swift */; };
1929B3B70C96A78FD63DE737 /* NvimView+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929BDC8F32F4A0D2299B5C5 /* NvimView+Debug.swift */; };
1929B40A751BDA2882D4FC94 /* NvimView+Objects.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B22A0CAD417EC3790F02 /* NvimView+Objects.swift */; };
@ -49,6 +50,7 @@
4B17E549209E3E4100265C1D /* RxNeovimApi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B17E548209E3E4100265C1D /* RxNeovimApi.framework */; };
4B21ED53213D4AEC009FD017 /* CocoaCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B0C89838D8402BB80BFC /* CocoaCommons.swift */; };
4B4A48DC222C7C6A00C8E3A1 /* SharedTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4A48DB222C7C6A00C8E3A1 /* SharedTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B6DFB39223592B90066BB43 /* OSLogCommons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1929B39C7DCDA4E9D5220CD8 /* OSLogCommons.swift */; };
4B8662E81FDC3F9F007F490D /* com.qvacua.NvimView.vim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B8662E41FDC3D4F007F490D /* com.qvacua.NvimView.vim */; };
4B90F02E1FD2AFAE008A39E0 /* NvimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0101FD2AFAC008A39E0 /* NvimView.swift */; };
4B90F02F1FD2AFAE008A39E0 /* NvimView+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B90F0111FD2AFAC008A39E0 /* NvimView+Resize.swift */; };
@ -196,6 +198,7 @@
1929BDE2C6003A6EDC02129C /* ColorUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorUtils.swift; sourceTree = "<group>"; };
1929BE45756C88F8B43804D2 /* CellAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CellAttributes.swift; sourceTree = "<group>"; };
1929BF14AE831C6832659B66 /* Defs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Defs.swift; sourceTree = "<group>"; };
1929BF88DE64FC62AFFCBC84 /* NimbleCommons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NimbleCommons.swift; sourceTree = "<group>"; };
1929BFCCDE5C7145BE5A7387 /* TypesetterTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypesetterTest.swift; sourceTree = "<group>"; };
4B0A1B112129F49500F1E02F /* NvimViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NvimViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
4B0A1B132129F49500F1E02F /* SwiftCommonsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftCommonsTest.swift; sourceTree = "<group>"; };
@ -329,6 +332,7 @@
1929BFCCDE5C7145BE5A7387 /* TypesetterTest.swift */,
1929BBA08E4195666290EC6A /* UGridTest.swift */,
1929B0B60CCAA00B08ACAB15 /* CellAttributesCollectionTest.swift */,
1929BF88DE64FC62AFFCBC84 /* NimbleCommons.swift */,
);
path = NvimViewTests;
sourceTree = "<group>";
@ -643,6 +647,7 @@
1929BB552C9D99E9ED938759 /* CellAttributesCollectionTest.swift in Sources */,
1929B90E2CFEAADE0CEE1562 /* CursorModeShape.swift in Sources */,
1929BDC146B699BF49116CAB /* Defs.swift in Sources */,
1929B2E9F089A9E2800B67F2 /* NimbleCommons.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -704,6 +709,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B6DFB39223592B90066BB43 /* OSLogCommons.swift in Sources */,
4B21ED53213D4AEC009FD017 /* CocoaCommons.swift in Sources */,
4BF18531213142F900954FE7 /* ColorUtils.swift in Sources */,
4BF18532213142F900954FE7 /* FontUtils.swift in Sources */,
@ -809,7 +815,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 306;
CURRENT_PROJECT_VERSION = 307;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -871,7 +877,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 306;
CURRENT_PROJECT_VERSION = 307;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -900,7 +906,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 306;
DYLIB_CURRENT_VERSION = 307;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;
@ -922,7 +928,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 306;
DYLIB_CURRENT_VERSION = 307;
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>0.26.3</string>
<string>0.26.4</string>
<key>CFBundleVersion</key>
<string>306</string>
<string>307</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -100,11 +100,9 @@ final class Typesetter {
let unichars = self.utf16Chars(from: run.nvimUtf16Cells)
var glyphs = Array<CGGlyph>(repeating: CGGlyph(), count: unichars.count)
let gotAllGlyphs = unichars.withUnsafeBufferPointer { pointer in
CTFontGetGlyphsForCharacters(
font, pointer.baseAddress!, &glyphs, unichars.count
)
}
let gotAllGlyphs = CTFontGetGlyphsForCharacters(
font, unichars, &glyphs, unichars.count
)
if gotAllGlyphs {
let startColumnForPositions = startColumn + run.startColumn
let endColumn = startColumnForPositions + glyphs.count
@ -119,12 +117,9 @@ final class Typesetter {
]
}
self.logger.info(
"Could not get all glyphs for single-width singe UTF16 character!"
)
let groupRanges = glyphs.groupedRanges { _, element in element == 0 }
let groupRuns: [[FontGlyphRun]] = groupRanges.map { range in
if unichars[range.lowerBound] == 0 {
if glyphs[range.lowerBound] == 0 {
let nvimUtf16Cells = unichars[range].map { [$0] }
return self.fontGlyphRunsWithLigatures(
nvimUtf16Cells: nvimUtf16Cells,
@ -135,16 +130,15 @@ final class Typesetter {
)
} else {
let startColumnForPositions = startColumn + range.lowerBound
let endColumn = startColumnForPositions + glyphs.count
let endColumn = startColumnForPositions + range.count
let positions = (startColumnForPositions..<endColumn).map { i in
CGPoint(
x: offset.x
+ CGFloat(i + startColumn + range.lowerBound) * cellWidth,
x: offset.x + CGFloat(i) * cellWidth,
y: offset.y
)
}
return [
FontGlyphRun(font: font, glyphs: glyphs, positions: positions)
FontGlyphRun(font: font, glyphs: Array(glyphs[range]), positions: positions)
]
}
}
@ -166,7 +160,7 @@ final class Typesetter {
string: String(utf16CodeUnits: utf16Chars, count: utf16Chars.count),
attributes: [
.font: font,
.ligature: 1
.ligature: NSNumber(integerLiteral: 0)
]
)

View File

@ -15,8 +15,8 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.26.3</string>
<string>0.26.4</string>
<key>CFBundleVersion</key>
<string>306</string>
<string>307</string>
</dict>
</plist>

View File

@ -0,0 +1,29 @@
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Cocoa
import Nimble
// I don't know why the font returned by Typesetter is not equal to the font
// it should be equal to. This is a workaround.
func equalFont(_ expectedValue: NSFont?) -> Predicate<NSFont> {
return Predicate { actualExpression in
let msg = ExpectationMessage.expectedActualValueTo(
"equal <\(String(describing: expectedValue))>"
)
if let actualValue = try actualExpression.evaluate() {
return PredicateResult(
bool: NSFont(name: actualValue.fontName,
size: actualValue.pointSize) == expectedValue!,
message: msg
)
} else {
return PredicateResult(
status: .fail,
message: msg.appendedBeNilHint()
)
}
}
}

View File

@ -11,6 +11,48 @@ import Nimble
class TypesetterWithoutLigaturesTest: XCTestCase {
// GH-709
func testHindi() {
let runs = typesetter.fontGlyphRunsWithoutLigatures(
nvimUtf16Cells: emojiMarked(["", "", "", "", "", "-", ">", ""]),
startColumn: 10,
offset: offset,
font: defaultFont,
cellWidth: defaultWidth
)
expect(runs).to(haveCount(4))
var run = runs[0]
expect(run.font).to(equalFont(kohinoorDevanagari))
expect(run.glyphs).to(equal([51, 52, 53, 54, 99]))
expect(run.positions).to(equal(
(10..<15).map {
CGPoint(x: offset.x + CGFloat($0) * defaultWidth, y: offset.y)
}
))
run = runs[1]
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(equal([16, 33]))
expect(run.positions).to(equal(
(15..<17).map {
CGPoint(x: offset.x + CGFloat($0) * defaultWidth, y: offset.y)
}
))
run = runs[2]
expect(run.font).to(equalFont(kohinoorDevanagari))
expect(run.glyphs).to(equal([99]))
expect(run.positions).to(equal(
(17..<18).map {
CGPoint(x: offset.x + CGFloat($0) * defaultWidth, y: offset.y)
}
))
self.assertEmojiMarker(run: runs[3],
xPosition: offset.x + 18 * defaultWidth)
}
func testSimpleAsciiChars() {
let runs = typesetter.fontGlyphRunsWithoutLigatures(
nvimUtf16Cells: emojiMarked(["a", "b", "c"]),
@ -22,7 +64,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(3))
expect(run.positions).to(equal(
(10..<13).map {
@ -45,7 +87,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(3))
expect(run.positions).to(equal(
(20..<23).map {
@ -70,7 +112,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(6))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(1))
expect(run.positions).to(equal(
[
@ -79,7 +121,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(courierNew))
expect(run.font).to(equalFont(courierNew))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 11 * defaultWidth, y: offset.y)))
@ -88,7 +130,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(run.positions[1].y).to(beCloseTo(offset.y + 0.305, within: 0.001))
run = runs[2]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 12 * defaultWidth, y: offset.y)))
@ -97,7 +139,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(run.positions[1].y).to(beCloseTo(offset.y - 0.279, within: 0.001))
run = runs[3]
expect(run.font).to(equal(monaco))
expect(run.font).to(equalFont(monaco))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 13 * defaultWidth, y: offset.y)))
@ -106,7 +148,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(run.positions[1].y).to(beCloseTo(offset.y + 2.446, within: 0.001))
run = runs[4]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions).to(equal(
[
@ -130,7 +172,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(3))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions).to(equal(
[
@ -140,7 +182,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.glyphs).to(haveCount(2))
expect(run.positions).to(equal(
[
@ -164,7 +206,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(3))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(1))
expect(run.positions).to(equal(
[
@ -173,7 +215,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 2 * defaultWidth, y: offset.y),
@ -194,7 +236,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(3))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions).to(equal(
[
@ -204,7 +246,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(gothic))
expect(run.font).to(equalFont(gothic))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 3 * defaultWidth, y: offset.y),
@ -227,7 +269,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(3))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions).to(equal(
[
@ -237,7 +279,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(gothic))
expect(run.font).to(equalFont(gothic))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 3 * defaultWidth, y: offset.y),
@ -260,7 +302,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(4))
var run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(1))
expect(run.positions).to(equal(
[
@ -269,7 +311,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(baskerville))
expect(run.font).to(equalFont(baskerville))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 2 * defaultWidth, y: offset.y),
@ -277,7 +319,7 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
))
run = runs[2]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(1))
expect(run.positions).to(equal(
[
@ -300,8 +342,8 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(fira))
expect(run.glyphs).to(equal([133, 1023, 1023, 1148, 133]))
expect(run.font).to(equalFont(fira))
expect(run.glyphs).to(equal([133, 1023, 1023, 1152, 133]))
expect(run.positions).to(equal(
(1..<6).map {
CGPoint(x: offset.x + CGFloat($0) * firaWidth, y: offset.y)
@ -312,12 +354,12 @@ class TypesetterWithoutLigaturesTest: XCTestCase {
}
private func assertAsciiMarker(run: FontGlyphRun, xPosition: CGFloat) {
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.positions).to(equal([CGPoint(x: xPosition, y: offset.y)]))
}
private func assertEmojiMarker(run: FontGlyphRun, xPosition: CGFloat) {
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.positions).to(equal([CGPoint(x: xPosition, y: offset.y)]))
}
}
@ -335,7 +377,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(20))
expect(run.positions).to(equal(
(1..<21).map {
@ -359,7 +401,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(3))
expect(run.positions).to(equal(
[
@ -385,7 +427,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
// The positions of the combining characters are copied from print outputs
// and they are visually checked by drawing them and inspecting them...
var run = runs[0]
expect(run.font).to(equal(courierNew))
expect(run.font).to(equalFont(courierNew))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y)))
@ -394,7 +436,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(run.positions[1].y).to(beCloseTo(offset.y + 0.305, within: 0.001))
run = runs[1]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 2 * defaultWidth, y: offset.y)))
@ -403,7 +445,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(run.positions[1].y).to(beCloseTo(offset.y - 0.279, within: 0.001))
run = runs[2]
expect(run.font).to(equal(monaco))
expect(run.font).to(equalFont(monaco))
expect(run.glyphs).to(haveCount(2))
expect(run.positions[0])
.to(equal(CGPoint(x: offset.x + 3 * defaultWidth, y: offset.y)))
@ -425,7 +467,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 0, y: offset.y),
@ -450,7 +492,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 0, y: offset.y),
@ -477,7 +519,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.glyphs).to(haveCount(1))
expect(run.positions).to(equal(
[
@ -499,7 +541,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(gothic))
expect(run.font).to(equalFont(gothic))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y),
@ -522,7 +564,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(gothic))
expect(run.font).to(equalFont(gothic))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y),
@ -545,7 +587,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(3))
var run = runs[0]
expect(run.font).to(equal(baskerville))
expect(run.font).to(equalFont(baskerville))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 0, y: offset.y),
@ -553,7 +595,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
))
run = runs[1]
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.positions).to(equal(
[
CGPoint(x: offset.x + 1 * defaultWidth, y: offset.y),
@ -574,10 +616,10 @@ class TypesetterWithLigaturesTest: XCTestCase {
expect(runs).to(haveCount(2))
let run = runs[0]
expect(run.font).to(equal(fira))
expect(run.font).to(equalFont(fira))
// Ligatures of popular monospace fonts like Fira Code seem to be composed
// of multiple characters with the same advance as other normal characters.
expect(run.glyphs).to(equal([1614, 1614, 1063, 133]))
expect(run.glyphs).to(equal([1623, 1623, 1065, 133]))
expect(run.positions).to(equal(
(0..<4).map {
CGPoint(x: offset.x + CGFloat($0) * firaWidth, y: offset.y)
@ -588,7 +630,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
}
private func assertAsciiMarker(run: FontGlyphRun, xPosition: CGFloat) {
expect(run.font).to(equal(defaultFont))
expect(run.font).to(equalFont(defaultFont))
expect(run.positions).to(equal(
[
CGPoint(x: xPosition, y: offset.y),
@ -597,7 +639,7 @@ class TypesetterWithLigaturesTest: XCTestCase {
}
private func assertEmojiMarker(run: FontGlyphRun, xPosition: CGFloat) {
expect(run.font).to(equal(emoji))
expect(run.font).to(equalFont(emoji))
expect(run.positions).to(equal(
[
CGPoint(x: xPosition, y: offset.y),
@ -613,6 +655,7 @@ private let monaco = NSFont(name: "Monaco", size: 13)!
private let emoji = NSFont(name: "AppleColorEmoji", size: 13)!
private let gothic = NSFont(name: "Apple SD Gothic Neo", size: 13)!
private let baskerville = NSFont(name: "Baskerville", size: 13)!
private let kohinoorDevanagari = NSFont(name: "Kohinoor Devanagari", size: 13)!
private let defaultWidth = FontUtils
.cellSize(of: defaultFont, linespacing: 1).width

View File

@ -23,6 +23,7 @@ class UGridTest: XCTestCase {
chunk: ["0", "", "", "3", "4", "", "", "7", "8", "9"],
attrIds: Array(repeating: 0, count: 10)
)
self.ugrid.recomputeFlatIndices(rowStart: 0, rowEndInclusive: 2)
expect(self.ugrid.cells.reduce(into: []) { result, row in
return result.append(contentsOf: row.reduce(into: []) { rowResult, cell in
@ -43,6 +44,8 @@ class UGridTest: XCTestCase {
chunk: ["", ""],
attrIds: Array(repeating: 0, count: 2)
)
self.ugrid.recomputeFlatIndices(rowStart: 0, rowEndInclusive: 2)
expect(self.ugrid.cells.reduce(into: []) { result, row in
return result.append(contentsOf: row.reduce(into: []) { rowResult, cell in
rowResult.append(cell.flatCharIndex)
@ -62,6 +65,8 @@ class UGridTest: XCTestCase {
chunk: ["", ""],
attrIds: Array(repeating: 0, count: 2)
)
self.ugrid.recomputeFlatIndices(rowStart: 0, rowEndInclusive: 2)
expect(self.ugrid.cells.reduce(into: []) { result, row in
return result.append(contentsOf: row.reduce(into: []) { rowResult, cell in
rowResult.append(cell.flatCharIndex)
@ -114,6 +119,8 @@ class UGridTest: XCTestCase {
CellAttributesCollection.reversedDefaultAttributesId
]
)
self.ugrid.recomputeFlatIndices(rowStart: 9, rowEndInclusive: 9)
self.ugrid.markCell(at: Position(row: 9, column: 4))
expect(self.ugrid.cells[9][4].attrId).to(equal(-4))
self.ugrid.markCell(at: Position(row: 9, column: 1))
@ -125,12 +132,14 @@ class UGridTest: XCTestCase {
self.ugrid.update(
row: 7,
startCol: 0,
endCol: 9,
endCol: 10,
clearCol: 0,
clearAttr: 0,
chunk: Array("23456789".compactMap { String($0) }) + ["", ""],
chunk: Array("01234567".compactMap { String($0) }) + ["", ""],
attrIds: [0, 1, 2, 3, 4, 5, 6, 7, 8, 8]
)
self.ugrid.recomputeFlatIndices(rowStart: 7, rowEndInclusive: 9)
self.ugrid.markCell(at: Position(row: 7, column: 8))
expect(self.ugrid.cells[7][8].attrId)
.to(equal(-8))

View File

@ -1330,7 +1330,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 306;
CURRENT_PROJECT_VERSION = 307;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -1388,7 +1388,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 306;
CURRENT_PROJECT_VERSION = 307;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;

View File

@ -1224,7 +1224,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.26.3</string>
<string>0.26.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -1241,7 +1241,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>306</string>
<string>307</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.26.3</string>
<string>0.26.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>306</string>
<string>307</string>
</dict>
</plist>

View File

@ -7,22 +7,27 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>v0.26.3-306</title>
<title>v0.26.4-307</title>
<description><![CDATA[
<ul>
<li>Bugfix: Memory leak.</li>
<li>GH-709: Bugfix: Some Unicode characters were broken when ligatures are turned off.</li>
<li>Dependencies updates:<ul>
<li>ReactiveX/RxSwift@4.4.2</li>
<li>Quick/nimble@8.0.1</li>
</ul>
</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/v0.26.3-306
https://github.com/qvacua/vimr/releases/tag/v0.26.4-307
</releaseNotesLink>
<pubDate>2019-03-10T18:58:31.542648</pubDate>
<pubDate>2019-03-11T08:47:11.815092</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.3-306/VimR-v0.26.3-306.tar.bz2"
sparkle:version="306"
sparkle:shortVersionString="0.26.3"
sparkle:dsaSignature="MC4CFQCcY7GI852mTSbMl/T8KbTA/efNPQIVANnhf9PuV4UsXYKtumgeKmsGQRf7"
length="15170307"
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.4-307/VimR-v0.26.4-307.tar.bz2"
sparkle:version="307"
sparkle:shortVersionString="0.26.4"
sparkle:dsaSignature="MC4CFQDPFAkM7rKGHzg120syVP8w6N0yywIVAOZPK2SlVunrzhoQymfMzftreKGP"
length="15169685"
type="application/octet-stream"/>
</item>
</channel>

View File

@ -7,22 +7,27 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>v0.26.3-306</title>
<title>v0.26.4-307</title>
<description><![CDATA[
<ul>
<li>Bugfix: Memory leak.</li>
<li>GH-709: Bugfix: Some Unicode characters were broken when ligatures are turned off.</li>
<li>Dependencies updates:<ul>
<li>ReactiveX/RxSwift@4.4.2</li>
<li>Quick/nimble@8.0.1</li>
</ul>
</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/v0.26.3-306
https://github.com/qvacua/vimr/releases/tag/v0.26.4-307
</releaseNotesLink>
<pubDate>2019-03-10T18:58:31.542648</pubDate>
<pubDate>2019-03-11T08:47:11.815092</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.3-306/VimR-v0.26.3-306.tar.bz2"
sparkle:version="306"
sparkle:shortVersionString="0.26.3"
sparkle:dsaSignature="MC4CFQCcY7GI852mTSbMl/T8KbTA/efNPQIVANnhf9PuV4UsXYKtumgeKmsGQRf7"
length="15170307"
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.26.4-307/VimR-v0.26.4-307.tar.bz2"
sparkle:version="307"
sparkle:shortVersionString="0.26.4"
sparkle:dsaSignature="MC4CFQDPFAkM7rKGHzg120syVP8w6N0yywIVAOZPK2SlVunrzhoQymfMzftreKGP"
length="15169685"
type="application/octet-stream"/>
</item>
</channel>

View File

@ -1,8 +1,15 @@
# 0.27.0-???
# next
* ...
# 0.26.3-???
# 0.26.4-???
* GH-709: Bugfix: Some Unicode characters were broken when ligatures are turned off.
* Dependencies updates:
- ReactiveX/RxSwift@4.4.2
- Quick/nimble@8.0.1
# 0.26.3-306
* Bugfix: Memory leak.