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

Error in Json Editor tutorial - Printing before LeaveAlternateScreen #729

Open
JustTheCoolest opened this issue Sep 22, 2024 · 1 comment

Comments

@JustTheCoolest
Copy link

If we don’t call our print function before we call execute!(LeaveAlternateScreen), our prints will be rendered on an old screen and lost when we leave the alternate screen.

https://ratatui.rs/tutorials/json-editor/main/

I'm guessing "before" was written by mistake instead of "after"

Code from the same page:

  execute!(
      terminal.backend_mut(),
      LeaveAlternateScreen,
      DisableMouseCapture
  )?;
  terminal.show_cursor()?;

  if let Ok(do_print) = res {
      if do_print {
          app.print_json()?;
      }
  } else if let Err(err) = res {
      println!("{err:?}");
  }
@joshka
Copy link
Member

joshka commented Sep 25, 2024

I think it's the word "don't" that was the problem

If we call our print function before we call execute!(LeaveAlternateScreen), our prints will be rendered on an old screen and lost when we leave the alternate screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants