Skip to content

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.

@wenwen12345
Copy link

This code does not work well in vscode, it keeps flashing, repeating the previous content

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

3 participants