Revert "debugger: Process ANSI color escape codes in console" (#32906)

Reverts zed-industries/zed#32817

Release Notes:
- N/A
This commit is contained in:
Cole Miller 2025-06-17 18:13:12 -04:00 committed by GitHub
parent 0cda28f786
commit 2f1d25d7f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 234 additions and 558 deletions

View file

@ -80,7 +80,7 @@ pub trait ToDisplayPoint {
fn to_display_point(&self, map: &DisplaySnapshot) -> DisplayPoint;
}
type TextHighlights = TreeMap<TypeId, Vec<(Range<Anchor>, HighlightStyle)>>;
type TextHighlights = TreeMap<TypeId, Arc<(HighlightStyle, Vec<Range<Anchor>>)>>;
type InlayHighlights = TreeMap<TypeId, TreeMap<InlayId, (HighlightStyle, InlayHighlight)>>;
/// Decides how text in a [`MultiBuffer`] should be displayed in a buffer, handling inlay hints,
@ -474,9 +474,11 @@ impl DisplayMap {
pub fn highlight_text(
&mut self,
type_id: TypeId,
ranges: Vec<(Range<Anchor>, HighlightStyle)>,
ranges: Vec<Range<Anchor>>,
style: HighlightStyle,
) {
self.text_highlights.insert(type_id, ranges);
self.text_highlights
.insert(type_id, Arc::new((style, ranges)));
}
pub(crate) fn highlight_inlays(
@ -498,25 +500,16 @@ impl DisplayMap {
}
}
pub fn text_highlights(&self, type_id: TypeId) -> Option<&[(Range<Anchor>, HighlightStyle)]> {
self.text_highlights
.get(&type_id)
.map(|highlights| highlights.as_slice())
pub fn text_highlights(&self, type_id: TypeId) -> Option<(HighlightStyle, &[Range<Anchor>])> {
let highlights = self.text_highlights.get(&type_id)?;
Some((highlights.0, &highlights.1))
}
pub fn clear_highlights(&mut self, type_id: TypeId) -> bool {
let mut cleared = self.text_highlights.remove(&type_id).is_some();
cleared |= self.inlay_highlights.remove(&type_id).is_some();
cleared
}
pub fn remove_text_highlights(
&mut self,
type_id: TypeId,
) -> Option<Vec<(Range<Anchor>, HighlightStyle)>> {
self.text_highlights.remove(&type_id)
}
pub fn set_font(&self, font: Font, font_size: Pixels, cx: &mut Context<Self>) -> bool {
self.wrap_map
.update(cx, |map, cx| map.set_font_with_size(font, font_size, cx))
@ -1338,7 +1331,7 @@ impl DisplaySnapshot {
#[cfg(any(test, feature = "test-support"))]
pub fn text_highlight_ranges<Tag: ?Sized + 'static>(
&self,
) -> Option<Vec<(Range<Anchor>, HighlightStyle)>> {
) -> Option<Arc<(HighlightStyle, Vec<Range<Anchor>>)>> {
let type_id = TypeId::of::<Tag>();
self.text_highlights.get(&type_id).cloned()
}
@ -2303,17 +2296,12 @@ pub mod tests {
map.highlight_text(
TypeId::of::<usize>(),
vec![
(
buffer_snapshot.anchor_before(Point::new(3, 9))
..buffer_snapshot.anchor_after(Point::new(3, 14)),
red.into(),
),
(
buffer_snapshot.anchor_before(Point::new(3, 17))
..buffer_snapshot.anchor_after(Point::new(3, 18)),
red.into(),
),
buffer_snapshot.anchor_before(Point::new(3, 9))
..buffer_snapshot.anchor_after(Point::new(3, 14)),
buffer_snapshot.anchor_before(Point::new(3, 17))
..buffer_snapshot.anchor_after(Point::new(3, 18)),
],
red.into(),
);
map.insert_blocks(
[BlockProperties {
@ -2632,13 +2620,11 @@ pub mod tests {
highlighted_ranges
.into_iter()
.map(|range| {
(
buffer_snapshot.anchor_before(range.start)
..buffer_snapshot.anchor_before(range.end),
style,
)
buffer_snapshot.anchor_before(range.start)
..buffer_snapshot.anchor_before(range.end)
})
.collect(),
style,
);
});