feat(cli): add Unicode width support for input composer#54
Open
titan wants to merge 1 commit intomadebyaris:mainfrom
Open
feat(cli): add Unicode width support for input composer#54titan wants to merge 1 commit intomadebyaris:mainfrom
titan wants to merge 1 commit intomadebyaris:mainfrom
Conversation
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/cli/src/tui/app.rs">
<violation number="1" location="crates/cli/src/tui/app.rs:357">
P2: Inclusive iteration over a half-open visible window renders one extra cell beyond the width budget.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| let mut run_style: Option<Style> = None; | ||
|
|
||
| for idx in 0..=chars.len() { | ||
| for idx in win_start..=win_end { |
There was a problem hiding this comment.
P2: Inclusive iteration over a half-open visible window renders one extra cell beyond the width budget.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/cli/src/tui/app.rs, line 357:
<comment>Inclusive iteration over a half-open visible window renders one extra cell beyond the width budget.</comment>
<file context>
@@ -292,16 +292,69 @@ fn push_styled_run(
let mut run_style: Option<Style> = None;
- for idx in 0..=chars.len() {
+ for idx in win_start..=win_end {
if idx == cursor_char_idx {
let cursor_char = chars.get(idx).copied().unwrap_or(' ');
</file context>
Owner
|
Hi @titan That's look good, and thanks for your contribution. Can you make it to merge DEV instead of main? That would be great, thank you 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Adds proper Unicode display width handling and horizontal scrolling to the CLI input composer, fixing misaligned cursors with CJK and emoji. Also simplifies key handling across pickers for clearer behavior.
New Features
unicode-widthto compute display width (CJK=2, ASCII=1, zero-width=0).Refactors
composer_linenow acceptsmax_cols; tests updated.Written for commit a738e47. Summary will update on new commits. Review in cubic