Improve truncate efficiency and fix OBOE in truncate_and_remove_front (#22591)
* Skip walking string for truncate when byte len is <= char limit * Fix `truncate_and_remove_front` returning string that is `max_chars + 1` in length. Now more consistent with `truncate_and_trailoff` behavior. * Fix `truncate_and_remove_front` adding ellipsis when max_chars == char length Release Notes: - N/A
This commit is contained in:
parent
f9df8c1729
commit
2d431e9b51
3 changed files with 36 additions and 8 deletions
|
@ -570,7 +570,7 @@ mod tests {
|
|||
spawn_in_terminal.label,
|
||||
format!(
|
||||
"test label for 1234 and …{}",
|
||||
&long_value[..=MAX_DISPLAY_VARIABLE_LENGTH]
|
||||
&long_value[long_value.len() - MAX_DISPLAY_VARIABLE_LENGTH..]
|
||||
),
|
||||
"Human-readable label should have long substitutions trimmed"
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue