Skip to content

Commit

Permalink
Introduce depreated badge to character inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Aug 15, 2023
1 parent 21d778d commit 6859d4b
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Get information about a character in CotEditor</h1>
<img src="../gfx/characterInspector@2x.png" width="637" alt="The character inspector indicating the information about the character 🐕"/>
</figure>

<p>In the inspector, the character in close-up, the Unicode character name, block name, general category, and the Unicode code point will be displayed. It shows also UTF-16 codes of each character in braces if the character is a surrogate pair. If the selected letter consists actually of multiple Unicode characters, only the code points and Unicode name will be listed-up.</p>
<p>The inspector displays: the character in close-up, the Unicode code point, the Unicode character name, block name, general category, and the Unicode version that introduced the character. It shows also UTF-16 codes of each character in braces if the character is a surrogate pair. If the selected letter consists actually of multiple Unicode characters, only the code points and Unicode name will be listed-up.</p>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>CotEditorで文字情報を表示する</h1>
<img src="../gfx/characterInspector@2x.png" width="637" alt="🐕の文字の情報を表示する文字インスペクタ"/>
</figure>

<p>表示には、拡大表示された文字、Unicode文字名、Unicodeブロック名、Unicodeカテゴリ名、Unicodeコードポイントが表示されます。選択された文字がサロゲートペアの場合には、括弧内に分割されたコードポイントも表示します。選択された文字が実際には複数のUnicode文字から成り立っていた場合は内包するコードポイントと文字名のみがリストアップされます。</p>
<p>インスペクタには、拡大表示された文字、Unicodeコードポイント、Unicode文字名、Unicodeブロック名、Unicodeカテゴリ名、その文字が導入されたUnicodeバージョンが表示されます。選択された文字がサロゲートペアの場合には、括弧内に分割されたコードポイントも表示します。選択された文字が実際には複数のUnicode文字から成り立っていた場合は内包するコードポイントと文字名のみがリストアップされます。</p>

</body>
</html>
22 changes: 19 additions & 3 deletions CotEditor/Sources/CharacterInspectorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,16 @@ private struct ScalarDetailView: View {
Text("Code Point:")
.gridColumnAlignment(.trailing)

Group {
HStack {
if let surrogates = self.scalar.surrogateCodePoints {
Text(verbatim: "\(self.scalar.codePoint) (\(surrogates.lead) \(surrogates.trail))")
} else {
Text(self.scalar.codePoint)
}
if self.scalar.properties.isDeprecated {
Spacer()
DeprecatedBadge()
}
}
.monospacedDigit()
.foregroundColor(.label)
Expand Down Expand Up @@ -213,6 +217,18 @@ private struct CharacterView: NSViewRepresentable {
}


private struct DeprecatedBadge: View {

var body: some View {

Text("deprecated")
.padding(.horizontal, 3)
.overlay(RoundedRectangle(cornerRadius: 3).stroke(.secondary))
.foregroundColor(.secondary)
}
}



// MARK: - Preview

Expand All @@ -236,6 +252,6 @@ private struct CharacterView: NSViewRepresentable {
CharacterInspectorView(info: CharacterInfo(character: "🇦🇦"))
}

#Preview("deprecated") {
CharacterInspectorView(info: CharacterInfo(character: ""))
#Preview("deprecated") {
CharacterInspectorView(info: CharacterInfo(character: ""))
}
1 change: 1 addition & 0 deletions CotEditor/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:";
"Category:" = "Kategorie:";
"Version:" = "Version:";
"deprecated" = "abgelehnt";



Expand Down
1 change: 1 addition & 0 deletions CotEditor/en-GB.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:";
"Category:" = "Category:";
"Version:" = "Version:";
"deprecated" = "deprecated";



Expand Down
1 change: 1 addition & 0 deletions CotEditor/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "ブロック:";
"Category:" = "カテゴリ:";
"Version:" = "バージョン:";
"deprecated" = "非推奨";



Expand Down
1 change: 1 addition & 0 deletions CotEditor/pt.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down
1 change: 1 addition & 0 deletions CotEditor/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@
"Block:" = "Block:"; // FIXME: new
"Category:" = "Category:"; // FIXME: new
"Version:" = "Version:"; // FIXME: new
"deprecated" = "deprecated"; // FIXME: new



Expand Down

0 comments on commit 6859d4b

Please sign in to comment.