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

add an example of incrementally printing markdown #47

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ifsheldon
Copy link

This is a minimum code example for incrementally printing markdown. This should close #42

@Canop
Copy link
Owner

Canop commented Sep 15, 2023

There's a problem: the save/restore thing breaks as soon as there's a scrollbar.

I can run it with clear & cargo run --example incremental_print_markdown but otherwise it doesn't work.

@ifsheldon
Copy link
Author

ifsheldon commented Sep 15, 2023

I think it's fine. It's an MVP after all. Otherwise, I guess we need to do something like you did in render_input_markdown, which is to use Area. But I haven't tried out to embed one Area in the current terminal instead of opening up a new alternate screen.

BTW, do you know why this happens? I'm not very familiar with nitty gritty of terminals. From my view, the code logic is fine regardless scrollbar. I tested it on my Mac default terminal and iTerm2 and Warp. Former 2 have this issue, but Warp seems to handle it pretty well.

@ifsheldon
Copy link
Author

There's a problem: the save/restore thing breaks as soon as there's a scrollbar.

I fixed this in commit fb5b0eb by calculating where the anchored cursor should be instead of storing a fixed cursor position.

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

Successfully merging this pull request may close these issues.

How to render markdown dynamically in real time
2 participants