mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Keep bidirectional TUI headers stable during shimmer (#61731)
## Why Per-grapheme color updates can break native terminal bidirectional rendering in thinking and reasoning headers. ## What changed Render text containing strong right-to-left characters or Arabic numbers as a single, static dimmed span in both shimmer implementations. Preserve logical text order and use one-second clock updates for these status headers when progress animation is disabled. ## Testing Add snapshot coverage for Hebrew, Arabic, mixed-direction text, and Arabic numbers, checking that headers remain unchanged during the shimmer sweep. Add scheduling tests for static headers and active progress animation. GitOrigin-RevId: 911abc50f00db597ae4dcfca9941e9f63547c2f9
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
use unicode_bidi::BidiClass;
|
||||
use unicode_bidi::bidi_class;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
|
||||
use crate::width::display_width;
|
||||
|
||||
/// Returns whether the text contains a strong RTL character or an Arabic number.
|
||||
pub(crate) fn contains_rtl_or_arabic_number(text: &str) -> bool {
|
||||
text.chars()
|
||||
.any(|c| matches!(bidi_class(c), BidiClass::R | BidiClass::AL | BidiClass::AN))
|
||||
}
|
||||
|
||||
pub(crate) fn capitalize_first(input: &str) -> String {
|
||||
let mut chars = input.chars();
|
||||
match chars.next() {
|
||||
|
||||
Reference in New Issue
Block a user