Cleaned up debugging code

This commit is contained in:
Mikayla Maki 2022-07-01 11:39:43 -07:00
parent 8e4c54ab61
commit ce60a9a50a
2 changed files with 2 additions and 32 deletions

View File

@ -484,7 +484,6 @@ mod tests {
let (chunks, _) = build_chunks(
term.lock().renderable_content().display_iter,
&Default::default(),
0.,
);
let content = chunks.iter().map(|e| e.0.trim()).collect::<String>();
content.contains("7")

View File

@ -1,6 +1,6 @@
use alacritty_terminal::{
ansi::Color as AnsiColor,
grid::{Dimensions, GridIterator, Indexed},
grid::{GridIterator, Indexed},
index::Point,
term::{
cell::{Cell, Flags},
@ -121,13 +121,8 @@ impl Element for TerminalEl {
let term = view_handle.read(cx).term.lock();
let content = term.renderable_content();
//TODO: Remove
// dbg!("*******");
// dbg!(cur_size.columns());
//And we're off! Begin layouting
let (chunks, line_count) =
build_chunks(content.display_iter, &terminal_theme, cell_width.0);
let (chunks, line_count) = build_chunks(content.display_iter, &terminal_theme);
let shaped_lines = layout_highlighted_chunks(
chunks
@ -140,11 +135,6 @@ impl Element for TerminalEl {
line_count,
);
//TODO: Remove
// for shaped_line in &shaped_lines {
// dbg!(shaped_line.width());
// }
let backgrounds = chunks
.iter()
.filter(|(_, _, line_span)| line_span != &RectSpan::default())
@ -192,16 +182,6 @@ impl Element for TerminalEl {
..Default::default()
});
//TODO: Implement cursor region based styling
// cx.scene.push_cursor_region(CursorRegion {
// bounds,
// style: if !view.link_go_to_definition_state.definitions.is_empty() {
// CursorStyle::PointingHand
// } else {
// CursorStyle::IBeam
// },
// });
let origin = bounds.origin() + vec2f(layout.em_width.0, 0.);
//Start us off with a nice simple background color
@ -336,7 +316,6 @@ fn make_new_size(
pub(crate) fn build_chunks(
grid_iterator: GridIterator<Cell>,
theme: &TerminalStyle,
em_width: f32,
) -> (Vec<(String, Option<HighlightStyle>, RectSpan)>, usize) {
let mut line_count: usize = 0;
//Every `group_by()` -> `into_iter()` pair needs to be seperated by a local variable so
@ -369,14 +348,6 @@ pub(crate) fn build_chunks(
.chain(iter::once(("\n".to_string(), None, Default::default())))
.collect::<Vec<(String, Option<HighlightStyle>, RectSpan)>>()
})
//TODO: Remove
// .inspect(|line_chunks| {
// let mut line_len = 0;
// for chunk in line_chunks {
// line_len += chunk.0.len();
// }
// dbg!((line_len, line_len as f32 * em_width));
// })
.flatten()
//We have a Vec<Vec<>> (Vec of lines of styled chunks), flatten to just Vec<> (the styled chunks)
.collect::<Vec<(String, Option<HighlightStyle>, RectSpan)>>();