Add more debugging
This commit is contained in:
parent
2ee0ecb677
commit
735f2029e9
3 changed files with 87 additions and 63 deletions
|
@ -638,7 +638,7 @@ impl TerminalElement {
|
|||
let connection = self.terminal.clone();
|
||||
|
||||
let mut this = self
|
||||
.on_mouse_down(MouseButton::Left, {
|
||||
.on_mouse_down_weird(MouseButton::Left, {
|
||||
let connection = connection.clone();
|
||||
let focus = focus.clone();
|
||||
move |e, cx| {
|
||||
|
@ -814,6 +814,7 @@ impl Element for TerminalElement {
|
|||
state: &mut Self::State,
|
||||
cx: &mut WindowContext<'_>,
|
||||
) {
|
||||
dbg!(bounds);
|
||||
let mut layout = self.compute_layout(bounds, cx);
|
||||
|
||||
let theme = cx.theme();
|
||||
|
@ -832,54 +833,51 @@ impl Element for TerminalElement {
|
|||
let mut this = self.register_mouse_listeners(origin, layout.mode, bounds, cx);
|
||||
let interactivity = mem::take(&mut this.interactivity);
|
||||
|
||||
cx.with_z_index(0, |cx| {
|
||||
interactivity.paint(bounds, bounds.size, state, cx, |_, _, cx| {
|
||||
this.register_key_listeners(cx);
|
||||
interactivity.paint(bounds, bounds.size, state, cx, |_, _, cx| {
|
||||
this.register_key_listeners(cx);
|
||||
|
||||
for rect in &layout.rects {
|
||||
rect.paint(origin, &layout, cx);
|
||||
}
|
||||
for rect in &layout.rects {
|
||||
rect.paint(origin, &layout, cx);
|
||||
}
|
||||
|
||||
cx.with_z_index(1, |cx| {
|
||||
for (relative_highlighted_range, color) in
|
||||
layout.relative_highlighted_ranges.iter()
|
||||
cx.with_z_index(1, |cx| {
|
||||
for (relative_highlighted_range, color) in layout.relative_highlighted_ranges.iter()
|
||||
{
|
||||
if let Some((start_y, highlighted_range_lines)) =
|
||||
to_highlighted_range_lines(relative_highlighted_range, &layout, origin)
|
||||
{
|
||||
if let Some((start_y, highlighted_range_lines)) =
|
||||
to_highlighted_range_lines(relative_highlighted_range, &layout, origin)
|
||||
{
|
||||
let hr = HighlightedRange {
|
||||
start_y, //Need to change this
|
||||
line_height: layout.size.line_height,
|
||||
lines: highlighted_range_lines,
|
||||
color: color.clone(),
|
||||
//Copied from editor. TODO: move to theme or something
|
||||
corner_radius: 0.15 * layout.size.line_height,
|
||||
};
|
||||
hr.paint(bounds, cx);
|
||||
}
|
||||
let hr = HighlightedRange {
|
||||
start_y, //Need to change this
|
||||
line_height: layout.size.line_height,
|
||||
lines: highlighted_range_lines,
|
||||
color: color.clone(),
|
||||
//Copied from editor. TODO: move to theme or something
|
||||
corner_radius: 0.15 * layout.size.line_height,
|
||||
};
|
||||
hr.paint(bounds, cx);
|
||||
}
|
||||
});
|
||||
|
||||
cx.with_z_index(2, |cx| {
|
||||
for cell in &layout.cells {
|
||||
cell.paint(origin, &layout, bounds, cx);
|
||||
}
|
||||
});
|
||||
|
||||
if this.cursor_visible {
|
||||
cx.with_z_index(3, |cx| {
|
||||
if let Some(cursor) = &layout.cursor {
|
||||
cursor.paint(origin, cx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(element) = layout.hyperlink_tooltip.take() {
|
||||
let width: AvailableSpace = bounds.size.width.into();
|
||||
let height: AvailableSpace = bounds.size.height.into();
|
||||
element.draw(origin, Size { width, height }, cx)
|
||||
}
|
||||
});
|
||||
|
||||
cx.with_z_index(2, |cx| {
|
||||
for cell in &layout.cells {
|
||||
cell.paint(origin, &layout, bounds, cx);
|
||||
}
|
||||
});
|
||||
|
||||
if this.cursor_visible {
|
||||
cx.with_z_index(3, |cx| {
|
||||
if let Some(cursor) = &layout.cursor {
|
||||
cursor.paint(origin, cx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(element) = layout.hyperlink_tooltip.take() {
|
||||
let width: AvailableSpace = bounds.size.width.into();
|
||||
let height: AvailableSpace = bounds.size.height.into();
|
||||
element.draw(origin, Size { width, height }, cx)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -266,18 +266,18 @@ impl TerminalView {
|
|||
.detach();
|
||||
|
||||
let focus = cx.focus_handle();
|
||||
let focus_in = cx.on_focus_in(&focus, |this, cx| {
|
||||
this.has_new_content = false;
|
||||
this.terminal.read(cx).focus_in();
|
||||
this.blink_cursors(this.blink_epoch, cx);
|
||||
cx.notify();
|
||||
});
|
||||
let focus_out = cx.on_focus_out(&focus, |this, cx| {
|
||||
this.terminal.update(cx, |terminal, _| {
|
||||
terminal.focus_out();
|
||||
});
|
||||
cx.notify();
|
||||
});
|
||||
// let focus_in = cx.on_focus_in(&focus, |this, cx| {
|
||||
// this.has_new_content = false;
|
||||
// this.terminal.read(cx).focus_in();
|
||||
// this.blink_cursors(this.blink_epoch, cx);
|
||||
// cx.notify();
|
||||
// });
|
||||
// let focus_out = cx.on_focus_out(&focus, |this, cx| {
|
||||
// this.terminal.update(cx, |terminal, _| {
|
||||
// terminal.focus_out();
|
||||
// });
|
||||
// cx.notify();
|
||||
// });
|
||||
|
||||
Self {
|
||||
terminal,
|
||||
|
@ -291,7 +291,7 @@ impl TerminalView {
|
|||
blink_epoch: 0,
|
||||
can_navigate_to_selected_word: false,
|
||||
workspace_id,
|
||||
_subscriptions: vec![focus_in, focus_out],
|
||||
_subscriptions: vec![/*focus_in, focus_out*/],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue