Revert "gpui: Assert validity of text runs for StyleText" (#39708)
Reverts zed-industries/zed#39581 This has done its job uncovering incorrect constructions of the highlight ranges pretty fast. Reverting this to prevent this from spilling into preview until I can fix the call sites next week
This commit is contained in:
@@ -225,15 +225,19 @@ impl LineWrapper {
|
||||
|
||||
fn update_runs_after_truncation(result: &str, ellipsis: &str, runs: &mut Vec<TextRun>) {
|
||||
let mut truncate_at = result.len() - ellipsis.len();
|
||||
let mut run_end = None;
|
||||
for (run_index, run) in runs.iter_mut().enumerate() {
|
||||
if run.len <= truncate_at {
|
||||
truncate_at -= run.len;
|
||||
} else {
|
||||
run.len = truncate_at + ellipsis.len();
|
||||
runs.truncate(run_index + 1);
|
||||
run_end = Some(run_index + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if let Some(run_end) = run_end {
|
||||
runs.truncate(run_end);
|
||||
}
|
||||
}
|
||||
|
||||
/// A fragment of a line that can be wrapped.
|
||||
|
||||
Reference in New Issue
Block a user