Skip to content

Use wide char aware hstr_strlen() for promptLength #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lbrabec
Copy link

@lbrabec lbrabec commented Apr 3, 2025

Calculate length of prompt correctly if HSTR_PROMPT contains UTF-8 characters (e.g. '❯ ')

Calculate length of prompt correctly if `HSTR_PROMPT`
contains UTF-8 characters (e.g. `'❯ '`)
@dvorka dvorka requested review from Copilot and dvorka May 9, 2025 06:52
Copy link

@Copilot 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 modifies the prompt length calculation to correctly handle UTF-8 characters by replacing the call to strlen() with the wide char aware hstr_strlen() function.

  • Replaces the call to strlen() with hstr_strlen() in the prompt printing logic.
  • Ensures that prompts containing UTF-8 characters, such as "❯ ", are measured correctly for proper display.

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.

1 participant