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

docs: Improve clarity in documentation for Frame #545

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

kdheepak
Copy link
Collaborator

@kdheepak kdheepak commented Sep 29, 2023

The documentation currently says This allows for widgets to be drawn in any order. which I believe is incorrect.

I removed that line and tweaked the remaining text for more clarity.

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Merging #545 (119ebc3) into main (11076d0) will not change coverage.
Report is 2 commits behind head on main.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #545   +/-   ##
=======================================
  Coverage   89.65%   89.65%           
=======================================
  Files          41       41           
  Lines       11437    11437           
=======================================
  Hits        10254    10254           
  Misses       1183     1183           
Files Coverage Δ
src/terminal.rs 58.46% <ø> (ø)

@joshka
Copy link
Member

joshka commented Sep 29, 2023

Is there a way to rephrase this without "changes drawn"? I don't get from that wording that the entire frame should be drawn rather than the full frame needs to be refreshed.

@kdheepak
Copy link
Collaborator Author

kdheepak commented Sep 29, 2023

How about something like this?

/// The `Terminal` struct maintains two buffers: the current and the previous.
/// When the widgets are drawn, the changes are accumulated in the current buffer.
/// At the end of each draw pass, the two buffers are compared, and only the changes
/// between these buffers are written to the terminal, avoiding any redundant operations.
/// After flushing these changes, the buffers are swapped to prepare for the next draw cycle.

@joshka
Copy link
Member

joshka commented Sep 29, 2023

How about something like this?

/// The `Terminal` struct maintains two buffers: the current and the previous.
/// When the widgets are drawn, the changes are accumulated in the current buffer.
/// At the end of each draw pass, the two buffers are compared, and only the changes
/// between these buffers are written to the terminal, avoiding any redundant operations.
/// After flushing these changes, the buffers are swapped to prepare for the next draw cycle.

LGTM

@kdheepak kdheepak force-pushed the kd/frame-documentation branch from 2ed7019 to 119ebc3 Compare September 29, 2023 02:03
@kdheepak
Copy link
Collaborator Author

Looking at the code again. This change is for the Frame struct, but the comment I shared above is better documentation for the Terminal struct.

I'm pushing another change that rephrases the comment for the Frame struct and updating the Terminal struct's docstring with the text above. Let me know what you think?

@joshka joshka merged commit 401a7a7 into main Sep 29, 2023
33 checks passed
@joshka joshka deleted the kd/frame-documentation branch September 29, 2023 03:18
tonogdlp pushed a commit to tonogdlp/ratatui that referenced this pull request Oct 6, 2023
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.

2 participants