Skip to content

fix(markdown): preserve korean spacing in wrapped structured output#2909

Open
iosif2 wants to merge 4 commits intotailcallhq:mainfrom
iosif2:fix/korean-spacing-loss
Open

fix(markdown): preserve korean spacing in wrapped structured output#2909
iosif2 wants to merge 4 commits intotailcallhq:mainfrom
iosif2:fix/korean-spacing-loss

Conversation

@iosif2
Copy link
Copy Markdown

@iosif2 iosif2 commented Apr 9, 2026

Summary

Fix Korean spacing being lost in wrapped structured markdown output, most visibly in numbered and bulleted content.

Context

Korean text could lose explicit spaces while wrapping streamed markdown output.
The issue was most visible in structured body content such as numbered lists and bullet lists, where wrapped lines could be reflowed with incorrect separator handling. The same wrapping behavior also affected other wrapped markdown surfaces.

Changes

  • added preserved-space wrapping utilities in forge_markdown_stream
  • updated list and blockquote wrapping to use the new preserved-space wrapper
  • aligned heading wrapping with the same behavior to avoid inconsistent wrapping paths
  • made wrapping grapheme-aware for safer Unicode handling
  • preserved ANSI style state across wrapped lines
  • corrected blockquote wrapping to use the visible width of the rendered margin

Key Implementation Details

The main user-visible failure happened in structured body content, especially list-style output.
The fix centralizes wrapping behavior in forge_markdown_stream/src/utils.rs so explicit separators are preserved consistently instead of being reconstructed differently across render paths. Headings were updated as part of the same wrapping path cleanup, but they were not the primary symptom.

Before / After

Manually compared the released forge binary against a locally built forge binary by entering the same prompts inside Forge directly.

Example prompt entered inside Forge:

너는 뭘 할 수 있는지 상세하게 알려줘

Before

Numbered lists:

## 제가 도와드리는 방식

보통 이런 순서로 진행합니다:

1. 요구사항파악
2. 관련코드조사
3. 수정또는구현
4. 테스트/체크로검증
5. 무엇을바꿨는지정리해서보고

즉, “대충 답만 하는” 방식보다, 실제 코드 기준으로 확인하고 작업하는 방식에 가깝습니다.

Bullet lists:

### 1. 코드베이스 분석
• 프로젝트구조파악
• 특정기능이어디서구현되는지추적
• 에러처리흐름,데이터흐름,모듈관계분석
• “이코드가왜이렇게동작하는지”조사

이 저장소는 주로 Rust 워크스페이스이고, 보조적으로 TypeScript 벤치마크 도구와 Zsh 셸 플러그인도 포함합니다.

After

Numbered lists:

## 제가 일할 때의 방식

보통 이렇게 진행합니다.

1. 먼저 현재 코드와 구조를 확인
2. 추측하지 않고 실제 구현 위치를 찾음
3. 필요한 수정만 최소 범위로 적용
4. 가능하면 테스트/체크로 검증
5. 무엇을 바꿨는지 파일 단위로 정리해서 보고

즉, 그럴듯한 답변만 하는 게 아니라 실제 프로젝트 상태를 기준으로 움직이는 방식입니다.

Bullet lists:

### 1. 코드베이스 구조를 빠르게 파악
예를 들면:

• 프로젝트가 어떤 언어/크레이트/모듈로 나뉘는지 정리
• 특정 기능이 어디서 시작되고 어디로 흐르는지 추적
• “이 저장소에서 인증/CLI/설정/스트리밍이 어떻게 동작해?” 같은 질문에 답변
• 낯선 코드베이스도 핵심 파일부터 빠르게 맥락 정리

이 저장소는 crates/* 아래에 여러 내부 Rust 크레이트를 둔 워크스페이스 구조이고, 보조적으로 TypeScript 기반 평가/자동화 스크립트도 포함합니다.

This example uses Korean text to show that explicit spaces are now preserved during wrapping.

Testing

cargo check -p forge_markdown_stream
cargo test -p forge_markdown_stream

Added regression coverage for:

  • Korean spacing preservation in structured markdown output
  • chunked streaming output
  • list prefix-aware wrapping
  • blockquote width behavior
  • nested blockquotes
  • grapheme cluster integrity
  • ANSI style carry-over

@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 9, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 9, 2026

CLA assistant check
All committers have signed the CLA.

@iosif2 iosif2 force-pushed the fix/korean-spacing-loss branch from 1b34ef7 to 1352cd6 Compare April 10, 2026 05:30
@iosif2 iosif2 force-pushed the fix/korean-spacing-loss branch from 1352cd6 to fb98366 Compare April 10, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants