Skip to content

CodexBar 是一个 macOS 菜单栏应用,用于查看本机 Codex 账号状态、额度、Token 用量、详细统计信息

fix: 修复日志预览横向滚动

Bob3caf24ab8937
diff --git a/CodexBar.xcodeproj/project.pbxproj b/CodexBar.xcodeproj/project.pbxproj
index 98a2434..a327ccd 100644
--- a/CodexBar.xcodeproj/project.pbxproj
+++ b/CodexBar.xcodeproj/project.pbxproj
@@ -277,7 +277,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 25;
+ CURRENT_PROJECT_VERSION = 26;
DEVELOPMENT_TEAM = 4KJ362VJW5;
ENABLE_APP_INTENTS_METADATA_GENERATION = NO;
ENABLE_APP_SANDBOX = NO;
@@ -292,7 +292,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MARKETING_VERSION = 3.1.1;
+ MARKETING_VERSION = 3.1.2;
PRODUCT_BUNDLE_IDENTIFIER = app.zabrian.codexbar;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
@@ -314,7 +314,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
- CURRENT_PROJECT_VERSION = 25;
+ CURRENT_PROJECT_VERSION = 26;
DEVELOPMENT_TEAM = 4KJ362VJW5;
ENABLE_APP_INTENTS_METADATA_GENERATION = NO;
ENABLE_APP_SANDBOX = NO;
@@ -329,7 +329,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MARKETING_VERSION = 3.1.1;
+ MARKETING_VERSION = 3.1.2;
PRODUCT_BUNDLE_IDENTIFIER = app.zabrian.codexbar;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/CodexBar/Views/Log/LogView.swift b/CodexBar/Views/Log/LogView.swift
index 5e81f4e..4ee0cf7 100644
--- a/CodexBar/Views/Log/LogView.swift
+++ b/CodexBar/Views/Log/LogView.swift
@@ -466,7 +466,7 @@ private struct LogCodePreviewView: NSViewRepresentable {
)
textView.isVerticallyResizable = true
textView.isHorizontallyResizable = true
- textView.autoresizingMask = [.width]
+ textView.autoresizingMask = []
textView.textContainer?.containerSize = NSSize(
width: CGFloat.greatestFiniteMagnitude,
height: CGFloat.greatestFiniteMagnitude
@@ -483,6 +483,25 @@ private struct LogCodePreviewView: NSViewRepresentable {
}
textView.textStorage?.setAttributedString(attributedText)
+ updateDocumentSize(for: textView, in: scrollView)
+ }
+
+ private func updateDocumentSize(for textView: NSTextView, in scrollView: NSScrollView) {
+ guard let layoutManager = textView.layoutManager,
+ let textContainer = textView.textContainer else {
+ return
+ }
+
+ layoutManager.ensureLayout(for: textContainer)
+ let usedRect = layoutManager.usedRect(for: textContainer)
+ let inset = textView.textContainerInset
+ let minimumSize = scrollView.contentSize
+ let fittedSize = NSSize(
+ width: max(ceil(usedRect.maxX + inset.width * 2), minimumSize.width),
+ height: max(ceil(usedRect.maxY + inset.height * 2), minimumSize.height)
+ )
+
+ textView.setFrameSize(fittedSize)
}
}
diff --git a/appcast.xml b/appcast.xml
index 637448d..48b6e9a 100644
--- a/appcast.xml
+++ b/appcast.xml
@@ -7,6 +7,15 @@
<link>https://codexbar.zabrian.app/appcast.xml</link>
<description>CodexBar appcast feed</description>
<language>zh-CN</language>
+ <item>
+ <title>CodexBar.app 3.1.2</title>
+ <sparkle:version>26</sparkle:version>
+ <sparkle:shortVersionString>3.1.2</sparkle:shortVersionString>
+ <sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
+ <sparkle:releaseNotesLink>https://codexbar.zabrian.app/notes#3.1.2</sparkle:releaseNotesLink>
+ <pubDate>Thu, 25 Jun 2026 00:29:59 +0800</pubDate>
+ <enclosure url="https://codexbar.zabrian.app/download/CodexBar-v3.1.2.dmg" sparkle:edSignature="l0umYKfi2dvZxxuwWQOK3lm/ZBG2A5MbOvvKyo/odpcOYxKlvyxf9ktTstKwQ7N0+3IEZ1Q/cLajJn9HL2EMAg==" length="3131191" type="application/octet-stream"/>
+ </item>
<item>
<title>CodexBar.app 3.1.1</title>
<sparkle:version>25</sparkle:version>