ratatui/tests
Neal Fachan aed60b9839
fix(terminal): Terminal::insert_before would crash when called while the viewport filled the screen (#1329)
Reimplement Terminal::insert_before. The previous implementation would
insert the new lines in chunks into the area between the top of the
screen and the top of the (new) viewport. If the viewport filled the
screen, there would be no area in which to insert lines, and the
function would crash.

The new implementation uses as much of the screen as it needs to, all
the way up to using the whole screen.

This commit:
- adds a scrollback buffer to the `TestBackend` so that tests can
inspect and assert the state of the scrollback buffer in addition to the
screen
- adds functions to `TestBackend` to assert the state of the scrollback
- adds and updates `TestBackend` tests to test the behavior of the
scrollback and the new asserting functions
- reimplements `Terminal::insert_before`, including adding two new
helper functions `Terminal::draw_lines` and `Terminal::scroll_up`.
- updates the documentation for `Terminal::insert_before` to clarify
some of the edge cases
- updates terminal tests to assert the state of the scrollback buffer
- adds a new test for the condition that causes the bug
- adds a conversion constructor `Cell::from(char)`

Fixes: https://github.com/ratatui/ratatui/issues/999
2024-08-23 15:27:54 -07:00
..
backend_termion.rs build: simplify Windows build (#1317) 2024-08-13 10:09:46 -07:00
state_serde.rs feat(frame): replace Frame::size() with Frame::area() (#1293) 2024-08-05 20:15:14 -07:00
stylize.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
terminal.rs fix(terminal): Terminal::insert_before would crash when called while the viewport filled the screen (#1329) 2024-08-23 15:27:54 -07:00
widgets_barchart.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_block.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_calendar.rs feat(frame): replace Frame::size() with Frame::area() (#1293) 2024-08-05 20:15:14 -07:00
widgets_canvas.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_chart.rs feat(chart)!: accept IntoIterator for axis labels (#1283) 2024-08-06 11:39:44 +02:00
widgets_gauge.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_list.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_paragraph.rs feat(frame): replace Frame::size() with Frame::area() (#1293) 2024-08-05 20:15:14 -07:00
widgets_table.rs feat(buffer): add Buffer::cell, cell_mut and index implementations (#1084) 2024-08-06 00:40:47 -07:00
widgets_tabs.rs refactor(buffer): deprecate assert_buffer_eq! in favor of assert_eq! (#1007) 2024-05-13 18:13:46 -07:00