Skip to content

fix: panic on non-unicode line#110

Merged
zifeo merged 1 commit into
mainfrom
fix
Jun 7, 2025
Merged

fix: panic on non-unicode line#110
zifeo merged 1 commit into
mainfrom
fix

Conversation

@zifeo
Copy link
Copy Markdown
Owner

@zifeo zifeo commented Jun 7, 2025

No description provided.

@zifeo zifeo requested a review from Copilot June 7, 2025 22:28
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 pull request addresses a panic occurring on non-Unicode lines by improving the display width calculation for output formatting. The changes include reordering imported items in src/shell.rs and src/main.rs, updating the spacing calculation in the hydration error output, and bumping various dependency versions and package metadata.

Reviewed Changes

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

File Description
src/shell.rs Reordered imports for anyhow and sysinfo to match a new convention.
src/main.rs Modified the spacing calculation in error output and reordering imports.
sdk/Cargo.toml Updated package version from beta to stable release.
Cargo.toml Bumped package version, edition, and various dependency versions.
Comments suppressed due to low confidence (1)

src/shell.rs:1

  • [nitpick] Ensure the import order is consistent with the project conventions; if alphabetical ordering is preferred, consider reordering to 'bail, Result'.
use anyhow::{Result, bail};

Comment thread src/main.rs
eprintln!(
"| > {} {}|",
line,
" ".repeat(wrap_width - 2 - textwrap::core::display_width(&line)),
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

Ensure the computed space count never becomes negative; consider using a safety check (e.g., max(0, wrap_width - 2 - textwrap::core::display_width(&line))) to prevent any potential panic when handling unexpected display widths.

Suggested change
" ".repeat(wrap_width - 2 - textwrap::core::display_width(&line)),
" ".repeat(std::cmp::max(0, wrap_width - 2 - textwrap::core::display_width(&line))),

Copilot uses AI. Check for mistakes.
@zifeo zifeo merged commit 8777b90 into main Jun 7, 2025
5 checks passed
@zifeo zifeo deleted the fix branch June 7, 2025 23:16
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