Remove painter debug output

This commit is contained in:
sholderbach 2022-03-14 12:47:03 +01:00 committed by Stefan Holderbach
parent 2d44337324
commit ad4760e476
3 changed files with 0 additions and 46 deletions

View File

@ -316,14 +316,6 @@ impl Reedline {
self
}
/// A builder which configures the painter for debug mode
#[must_use]
pub fn with_debug_mode(mut self) -> Self {
self.painter = Painter::new_with_debug(std::io::BufWriter::new(std::io::stderr()));
self
}
/// Returns the corresponding expected prompt style for the given edit mode
pub fn prompt_edit_mode(&self) -> PromptEditMode {
self.edit_mode.edit_mode()

View File

@ -21,7 +21,6 @@ use {
fn main() -> Result<()> {
// quick command like parameter handling
let vi_mode = matches!(std::env::args().nth(1), Some(x) if x == "--vi");
let debug_mode = matches!(std::env::args().nth(2), Some(x) if x == "--debug");
let args: Vec<String> = std::env::args().collect();
// if -k is passed, show the events
if args.len() > 1 && args[1] == "-k" {
@ -101,10 +100,6 @@ fn main() -> Result<()> {
line_editor = line_editor.with_edit_mode(edit_mode);
if debug_mode {
line_editor = line_editor.with_debug_mode();
}
let prompt = DefaultPrompt::new();
loop {

View File

@ -218,7 +218,6 @@ pub struct Painter {
terminal_size: (u16, u16),
last_required_lines: u16,
large_buffer: bool,
debug_mode: bool,
}
impl Painter {
@ -229,18 +228,6 @@ impl Painter {
terminal_size: (0, 0),
last_required_lines: 0,
large_buffer: false,
debug_mode: false,
}
}
pub fn new_with_debug(stdout: W) -> Self {
Painter {
stdout,
prompt_start_row: 0,
terminal_size: (0, 0),
last_required_lines: 0,
large_buffer: false,
debug_mode: true,
}
}
@ -343,26 +330,6 @@ impl Painter {
// can print without overwriting the things written during the painting
self.last_required_lines = required_lines;
// In debug mode a string with position information is printed at the end of the buffer
if self.debug_mode {
let cursor_distance = lines.distance_from_prompt(screen_width);
let prompt_lines = lines.prompt_lines_with_wrap(screen_width);
let prompt_length = lines.prompt_str_left.len() + lines.prompt_indicator.len();
let estimated_prompt = estimate_single_line_wraps(&lines.prompt_str_left, screen_width);
self.stdout
.queue(Print(format!(" [h{}:", screen_height)))?
.queue(Print(format!("w{}] ", screen_width)))?
.queue(Print(format!("y:{} ", self.prompt_start_row)))?
.queue(Print(format!("rm:{} ", remaining_lines)))?
.queue(Print(format!("re:{} ", required_lines)))?
.queue(Print(format!("di:{} ", cursor_distance)))?
.queue(Print(format!("pl:{} ", prompt_lines)))?
.queue(Print(format!("pr:{} ", prompt_length)))?
.queue(Print(format!("wr:{} ", estimated_prompt)))?
.queue(Print(format!("ls:{} ", self.last_required_lines)))?;
}
self.stdout.queue(RestorePosition)?.queue(cursor::Show)?;
self.stdout.flush()