-
-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Single Text Storage For Documents (#1740)
- Loading branch information
1 parent
f2caddf
commit e17584e
Showing
8 changed files
with
151 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// FileEncoding.swift | ||
// CodeEdit | ||
// | ||
// Created by Khan Winter on 5/31/24. | ||
// | ||
|
||
import Foundation | ||
|
||
enum FileEncoding: CaseIterable { | ||
case utf8 | ||
case utf16BE | ||
case utf16LE | ||
|
||
var nsValue: UInt { | ||
switch self { | ||
case .utf8: | ||
return NSUTF8StringEncoding | ||
case .utf16BE: | ||
return NSUTF16BigEndianStringEncoding | ||
case .utf16LE: | ||
return NSUTF16LittleEndianStringEncoding | ||
} | ||
} | ||
|
||
init?(_ int: UInt) { | ||
switch int { | ||
case NSUTF8StringEncoding: | ||
self = .utf8 | ||
case NSUTF16BigEndianStringEncoding: | ||
self = .utf16BE | ||
case NSUTF16LittleEndianStringEncoding: | ||
self = .utf16LE | ||
default: | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
CodeEdit/Utils/Extensions/NSTextStorage/NSTextStorage+isEmpty.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// NSTextStorage+isEmpty.swift | ||
// CodeEdit | ||
// | ||
// Created by Khan Winter on 5/19/24. | ||
// | ||
|
||
import AppKit | ||
|
||
extension NSTextStorage { | ||
var isEmpty: Bool { | ||
length == 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters