Skip to content

Restore explicit newlines in DrawState::draw_to_term when not moving cursor - #861

Open
ychampion wants to merge 1 commit into
console-rs:mainfrom
ychampion:fix/multiline-newlines
Open

ychampion wants to merge 1 commit into
console-rs:mainfrom
ychampion:fix/multiline-newlines

Conversation

@ychampion

Copy link
Copy Markdown

Restore explicit newlines between logical lines in DrawState::draw_to_term when move_cursor is disabled.

Problem

In #790, DrawState::draw_to_term stopped calling term.write_line("") between logical lines and padded every line with spaces to term_width, relying on right-margin auto-wrap to advance rows. In the default mode (!self.move_cursor), all previous lines are already erased via term.clear_line() up front, so padding intermediate lines to force a wrap is unnecessary and loses row/cursor sync if terminal wrapping or width differs from term_width (for example on resize, wider PTYs, or disabled auto-wrap).

Changes

  • Emit term.write_line("") between logical lines when !self.move_cursor, and only write trailing write_line_filler spaces after the last printed line (src/draw_target.rs).
  • Keep per-line space padding when self.move_cursor is enabled so shorter updated lines still clear trailing characters from prior ticks (Clear the rest of line after drawing to the terminal #790).
  • Update multi_progress_many_bars and multi_progress_many_spinners in tests/render.rs for the restored NewLine transitions, and add regression tests for multiline explicit newlines, wider-terminal redraws, and set_move_cursor(true) shortened-line clearing (src/draw_target.rs, tests/render.rs).

Fixes #859

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.

Multiline progress redraw can lose cursor position after 0.18.5 padding change

1 participant