mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Merge branch 'main' into 4.9.0
This commit is contained in:
commit
086ac76217
@ -37,12 +37,14 @@
|
|||||||
|
|
||||||
### Implements
|
### Implements
|
||||||
|
|
||||||
|
- Update the Markdown syntax to fix highlighting strikethrough.
|
||||||
- Improve the User Guide contents.
|
- Improve the User Guide contents.
|
||||||
- [non-AppStore ver.] Update Sparkle from 2.6.2 to 2.6.3.
|
- [non-AppStore ver.] Update Sparkle from 2.6.2 to 2.6.3.
|
||||||
|
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
|
- Fix an issue that a saved document could not revert to the horizontal text orientation when it was saved once as a vertical text document.
|
||||||
- Fix a trivial memory leak in the line ending menu (thanks to Yoshimasa Niwa).
|
- Fix a trivial memory leak in the line ending menu (thanks to Yoshimasa Niwa).
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,6 +463,11 @@ import FilePermissions
|
|||||||
try super.writeSafely(to: url, ofType: typeName, for: saveOperation)
|
try super.writeSafely(to: url, ofType: typeName, for: saveOperation)
|
||||||
|
|
||||||
if saveOperation != .autosaveElsewhereOperation {
|
if saveOperation != .autosaveElsewhereOperation {
|
||||||
|
// set/remove flag for vertical text orientation
|
||||||
|
if UserDefaults.standard[.savesTextOrientation] {
|
||||||
|
try? url.setExtendedAttribute(data: self.isVerticalText ? Data([1]) : nil, for: FileExtendedAttributeName.verticalText)
|
||||||
|
}
|
||||||
|
|
||||||
// get the latest file attributes
|
// get the latest file attributes
|
||||||
do {
|
do {
|
||||||
let attributes = try FileManager.default.attributesOfItem(atPath: url.path) // FILE_ACCESS
|
let attributes = try FileManager.default.attributesOfItem(atPath: url.path) // FILE_ACCESS
|
||||||
@ -491,6 +496,8 @@ import FilePermissions
|
|||||||
}
|
}
|
||||||
|
|
||||||
// save document state to the extended file attributes
|
// save document state to the extended file attributes
|
||||||
|
// -> Save FileExtendedAttributeName.verticalText at `super.writeSafely(to:ofType:for:)`
|
||||||
|
// since the xattr already set to the file cannot remove at this point. (2024-06-12)
|
||||||
var xattrs: [String: Data] = [:]
|
var xattrs: [String: Data] = [:]
|
||||||
if self.shouldSaveEncodingXattr {
|
if self.shouldSaveEncodingXattr {
|
||||||
xattrs[FileExtendedAttributeName.encoding] = self.fileEncoding.encoding.xattrEncodingData
|
xattrs[FileExtendedAttributeName.encoding] = self.fileEncoding.encoding.xattrEncodingData
|
||||||
@ -498,9 +505,6 @@ import FilePermissions
|
|||||||
if self.suppressesInconsistentLineEndingAlert {
|
if self.suppressesInconsistentLineEndingAlert {
|
||||||
xattrs[FileExtendedAttributeName.allowLineEndingInconsistency] = Data([1])
|
xattrs[FileExtendedAttributeName.allowLineEndingInconsistency] = Data([1])
|
||||||
}
|
}
|
||||||
if UserDefaults.standard[.savesTextOrientation] {
|
|
||||||
xattrs[FileExtendedAttributeName.verticalText] = self.isVerticalText ? Data([1]) : nil
|
|
||||||
}
|
|
||||||
if !xattrs.isEmpty {
|
if !xattrs.isEmpty {
|
||||||
attributes[FileAttributeKey.extendedAttributes.rawValue] = xattrs
|
attributes[FileAttributeKey.extendedAttributes.rawValue] = xattrs
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// © 2018-2023 1024jp
|
// © 2018-2024 1024jp
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
@ -27,7 +27,10 @@ import Foundation
|
|||||||
|
|
||||||
extension URL {
|
extension URL {
|
||||||
|
|
||||||
/// Gets extended attribute
|
/// Gets extended attribute.
|
||||||
|
///
|
||||||
|
/// - Parameter name: The key name of the attribute to get.
|
||||||
|
/// - Returns: Data.
|
||||||
func extendedAttribute(for name: String) throws -> Data {
|
func extendedAttribute(for name: String) throws -> Data {
|
||||||
|
|
||||||
try self.withUnsafeFileSystemRepresentation { fileSystemPath -> Data in
|
try self.withUnsafeFileSystemRepresentation { fileSystemPath -> Data in
|
||||||
@ -49,7 +52,11 @@ extension URL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Sets extended attribute
|
/// Sets extended attribute.
|
||||||
|
///
|
||||||
|
/// - Parameters:
|
||||||
|
/// - data: The data to set.
|
||||||
|
/// - name: The attribute key name to set.
|
||||||
func setExtendedAttribute(data: Data?, for name: String) throws {
|
func setExtendedAttribute(data: Data?, for name: String) throws {
|
||||||
|
|
||||||
// remove if nil is passed
|
// remove if nil is passed
|
||||||
@ -67,7 +74,9 @@ extension URL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Removes extended attribute
|
/// Removes extended attribute.
|
||||||
|
///
|
||||||
|
/// - Parameter name: The attribute key name to remove.
|
||||||
private func removeExtendedAttribute(for name: String) throws {
|
private func removeExtendedAttribute(for name: String) throws {
|
||||||
|
|
||||||
try self.withUnsafeFileSystemRepresentation { fileSystemPath in
|
try self.withUnsafeFileSystemRepresentation { fileSystemPath in
|
||||||
|
@ -39,7 +39,7 @@ extensions:
|
|||||||
filenames: []
|
filenames: []
|
||||||
interpreters: []
|
interpreters: []
|
||||||
keywords:
|
keywords:
|
||||||
- beginString: (?<!\\)\b~~(?![ \t])((?!\R{2})(?:.|\R))*?(?<![\\\t ])~~
|
- beginString: (?<!\\)~~[^ \t~]((?!\R{2})(?:.|\R))*?(?<![\\ ])~~
|
||||||
description: '[github] strikethrough'
|
description: '[github] strikethrough'
|
||||||
regularExpression: true
|
regularExpression: true
|
||||||
- beginString: \R[\t ]*\R(?:\- *){3,}$
|
- beginString: \R[\t ]*\R(?:\- *){3,}$
|
||||||
@ -71,9 +71,9 @@ kind: general
|
|||||||
metadata:
|
metadata:
|
||||||
author: 1024jp
|
author: 1024jp
|
||||||
distributionURL: https://coteditor.com
|
distributionURL: https://coteditor.com
|
||||||
lastModified: '2024-05-10'
|
lastModified: '2024-06-09'
|
||||||
license: Same as CotEditor
|
license: Same as CotEditor
|
||||||
version: 1.4.0
|
version: 1.4.1
|
||||||
numbers:
|
numbers:
|
||||||
- beginString: (?<!\\)!\[.*?(?<!\\)\](?=\()
|
- beginString: (?<!\\)!\[.*?(?<!\\)\](?=\()
|
||||||
description: img
|
description: img
|
||||||
|
Loading…
Reference in New Issue
Block a user