When the terminal connected to the noline Editor is resized, we need a mechanism to update the internal Terminal state so that it matches the new size & cursor position.
At this snapshot, both the sync & async Editors have grown a reinit function that re-probes the terminal environment to ensure these data line up.
One possible pattern for managing resync is to do so after every line is read, so that an operator who has resized their terminal can hit "enter" to get the terminals' states to line back up (similar to how many shells commonly appear to function):
while let Ok(line) = {
editor.reinit(&mut io).unwrap(); // On every newline, re-initialize the cursor/terminal state
editor.readline(prompt, &mut io)
} {
// Do something with line...
}
When the terminal connected to the noline Editor is resized, we need a mechanism to update the internal Terminal state so that it matches the new size & cursor position.
At this snapshot, both the sync & async Editors have grown a
reinit
function that re-probes the terminal environment to ensure these data line up.One possible pattern for managing resync is to do so after every line is read, so that an operator who has resized their terminal can hit "enter" to get the terminals' states to line back up (similar to how many shells commonly appear to function):