Skip to content

[Feat] upgrade cosmic-text to 0.14.2#95

Merged
mistricky merged 1 commit intomainfrom
feature/upgrade-cosmic-text
May 9, 2025
Merged

[Feat] upgrade cosmic-text to 0.14.2#95
mistricky merged 1 commit intomainfrom
feature/upgrade-cosmic-text

Conversation

@mistricky
Copy link
Copy Markdown
Member

No description provided.

@mistricky mistricky requested a review from Copilot May 9, 2025 11:00
@mistricky mistricky merged commit 0b6d80f into main May 9, 2025
2 checks passed
@mistricky mistricky deleted the feature/upgrade-cosmic-text branch May 9, 2025 11:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades cosmic-text to version 0.14.2 and adapts the code to work with the new API. The key changes include updating imports and font loading in text.rs, refactoring attribute handling in text measurement and rich text, and adjusting font style handling in highlight.rs.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

File Description
core/src/utils/text.rs Updated imports, new font constants, and usage of a default attribute helper function to align with cosmic-text 0.14.2 API.
core/src/utils/highlight.rs Introduced cloning of attributes to avoid mutation when applying different font styles.
core/Cargo.toml Upgraded the cosmic-text dependency version from 0.12.0 to 0.14.2.
Comments suppressed due to low confidence (1)

core/src/utils/text.rs:25

  • Verify that the family name string 'CaskaydiaCove Nerd Font' matches the expected naming convention used in the font asset filenames (e.g., 'CaskaydiaCoveNerdFont').
    Attrs::new().family(Family::Name("CaskaydiaCove Nerd Font"))

.into_iter()
.map(|(style, str)| {
let syntect::highlighting::Color { r, g, b, a } = style.foreground;
let attrs_cloned = attrs.clone();
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider whether cloning 'attrs' on every iteration might introduce a slight performance overhead; if 'attrs' remains constant, reusing a previously cloned value could be more efficient.

Suggested change
let attrs_cloned = attrs.clone();

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants