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
|
@ -791,7 +791,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
task_names(&tasks_picker, cx),
|
||||
vec![
|
||||
"hello from …th.odd_extension:1:1".to_string(),
|
||||
"hello from …h.odd_extension:1:1".to_string(),
|
||||
"opened now: /dir".to_string()
|
||||
],
|
||||
"Second opened buffer should fill the context, labels should be trimmed if long enough"
|
||||
|
@ -820,7 +820,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
task_names(&tasks_picker, cx),
|
||||
vec![
|
||||
"hello from …ithout_extension:2:3".to_string(),
|
||||
"hello from …thout_extension:2:3".to_string(),
|
||||
"opened now: /dir".to_string()
|
||||
],
|
||||
"Opened buffer should fill the context, labels should be trimmed if long enough"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue