Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(debugger): use context when drawing #6520

Merged
merged 8 commits into from
Dec 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stuff
  • Loading branch information
DaniPopes committed Dec 4, 2023
commit ff2d3afe5970045ad895e027f07c78a86df98310
9 changes: 3 additions & 6 deletions crates/debugger/src/tui/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ use crate::op::OpcodeParam;
use alloy_primitives::U256;
use foundry_evm_core::{debug::Instruction, utils::CallKind};
use ratatui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
terminal::Frame,
text::{Line, Span, Text},
widgets::{Block, Borders, Paragraph, Wrap},
Terminal,
};
use revm::interpreter::opcode;
use std::{cmp, collections::VecDeque, io};

impl DebuggerContext<'_> {
pub(crate) fn draw(&self, terminal: &mut Terminal<impl Backend>) -> io::Result<()> {
/// Draws the TUI layout and subcomponents to the given terminal.
pub(crate) fn draw(&self, terminal: &mut super::DebuggerTerminal) -> io::Result<()> {
terminal.draw(|f| self.draw_layout(f)).map(drop)
}

/// Create layout and subcomponents.
fn draw_layout(&self, f: &mut Frame<'_>) {
let total_size = f.size();
if total_size.width < 225 {
if f.size().width < 225 {
self.vertical_layout(f);
} else {
self.square_layout(f);
Expand Down
Loading