console-rs / console-rs/console

How to deal with overflowing lines?

Open
#204 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.2k
Forks
144
Avg merge
8h 24m
Merged PRs (30d)
4

Description

I am having trouble with clearing when lines overflow. If all the lines of the output are within the terminal width, the terminal is cleared properly via the following.

self.term.clear_to_end_of_screen()?;
self.term.clear_last_lines(self.height)?; // height being the number of lines of the written output

But when one of the lines (see screenshow) overflows, the first line of the output is not cleared and written all over again. Even if i account for overflowing lines and increase the height to clear, the first line is not cleared.

Screenshot

Any ideas how to mitigate this?

Example Source

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the example source in src/multiselect.rs and inspect how console's clear_to_end_of_screen() and clear_last_lines() handle output containing an overflowing line. Reproduce the reported behavior with a terminal-width overflow and compare it with output whose lines fit. Done means the complete prior output, including its first line, is cleared before redraw.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.